Files
CleverRDFlib/features/graph_loading.feature
CoreRasurae e828acf175
CI / lint (push) Successful in 1m32s
CI / typecheck (push) Successful in 1m38s
CI / lint (pull_request) Successful in 1m30s
CI / typecheck (pull_request) Successful in 1m30s
CI / behave (3.11) (pull_request) Successful in 1m39s
CI / behave (3.12) (pull_request) Successful in 1m39s
CI / build (pull_request) Successful in 1m29s
CI / behave (3.13) (pull_request) Successful in 1m39s
CI / behave (3.11) (push) Successful in 1m39s
CI / behave (3.12) (push) Successful in 1m41s
CI / behave (3.13) (push) Successful in 1m37s
CI / build (push) Successful in 1m30s
feat: Initial version of CleverRDFLib
ISSUES CLOSED: #1
2025-12-19 22:26:14 +00:00

146 lines
6.2 KiB
Gherkin

Feature: Graph Loading
As a developer using CleverRDFLib
I want to load RDF graphs from various sources
So that I can work with RDF data regardless of its location
Background:
Given I have a test data directory
And I have a GraphLoader instance
Scenario: Load graph from local file path or file:// URI
Given I have a valid RDF file at "test_data/simple.rdf"
When I load the graph from the file path
Then the graph loading should succeed
And the graph should not be empty
And the graph should contain RDF triples
When I load the graph from the file:// URI
Then the graph loading should succeed
And the graph should not be empty
And the graph should contain RDF triples
Scenario: Load graph from HTTP or HTTPS URL
Given I have a valid RDF URL at "http://example.com/data.rdf"
When I load the graph from the HTTP URL
Then the graph loading may fail for non-existent URLs
And if successful, the graph should not be empty
And if successful, the graph should contain RDF triples
Given I have a valid RDF URL at "https://example.com/data.rdf"
When I load the graph from the HTTPS URL
Then the graph loading may fail for non-existent URLs
And if successful, the graph should not be empty
And if successful, the graph should contain RDF triples
Scenario: Load graph with explicit format
Given I have a Turtle file at "test_data/data.ttl"
When I load the graph with format "turtle"
Then the graph loading should succeed
And the graph should not be empty
And the graph should be parsed as Turtle format
Scenario: Auto-detect format from file extension
Given I have a Turtle file at "test_data/data.ttl"
When I load the graph without specifying format
Then the graph loading should succeed
And the format should be auto-detected from extension
And the graph should not be empty
Scenario: Detect format from HTTP Content-Type header
Given I have a test data directory
And I have a GraphLoader instance
Given I have an HTTP URL with Content-Type header
When I load the graph from the HTTP URL without format
Then the format should be detected from Content-Type
And the graph should be parsed with the detected format
Scenario: Load graph with unsupported format
Given I have a file with unsupported format at "test_data/data.xyz"
When I attempt to load the graph
Then the loading should fail with an appropriate error
And the error should indicate the format issue
Scenario: Handle file not found error
Given I have a non-existent file path "test_data/nonexistent.rdf"
When I attempt to load the graph from the file path
Then the loading should fail
And the error should indicate file not found
Scenario: Handle network error for HTTP URL
Given I have an unreachable URL at "http://unreachable.example.com/data.rdf"
When I attempt to load the graph from the URL
Then the loading should fail
And the error should indicate network or connection issues
Scenario: Load graph with chain of responsibility handlers
Given I have a GraphLoader with multiple handlers
When I load a graph from a file path
Then the file handler should process the request
And the handler chain should be traversed correctly
Scenario: Load graph with remapper handler
Given I have a GraphLoader with remapper handler
And I have configured URI remapping rules
When I load a graph with a URI that matches a remapping rule
Then the URI should be remapped according to the rule
And the remapped URI should be used for loading
Scenario: Insert handler into chain at specific position
Given I have a GraphLoader with a handler chain
And I have a new handler to insert
When I insert the handler at position 0
Then the handler should be inserted at the beginning
And the chain should maintain correct order
Scenario: Insert handler into chain by ID
Given I have a GraphLoader with a handler chain
And I have a new handler to insert
And I have a handler ID to insert after
When I insert the handler after the specified ID
Then the handler should be inserted after the specified handler
And the chain should maintain correct order
Scenario: Reset handler chain to single handler
Given I have a GraphLoader with a handler chain
And I have a new handler
When I reset the chain to the new handler
Then the chain should contain only the new handler
And previous handlers should be removed
Scenario: HTTP handler falls through for non-HTTP schemes
Given I have a GraphLoader instance
And I have a valid RDF file at "test_data/fallthrough_test.rdf"
When I load a graph with a non-HTTP scheme using HTTP handler
Then the HTTP handler should fall through to the next handler
And the graph should be loaded successfully
Scenario: Handler chain raises exception when no handler available
Given I have a test data directory
And I have a GraphLoader instance
Given I have a handler with no next handler
When I attempt to load with a handler that cannot handle the URI
Then a handler chain exception should be raised
Scenario: Insert handler at end of chain (position None)
Given I have a test data directory
And I have a GraphLoader instance
Given I have a GraphLoader with a handler chain
And I have a new handler to insert
When I insert the handler at the end of the chain
Then the handler should be inserted at the end
Scenario: Insert handler at specific integer position
Given I have a test data directory
And I have a GraphLoader instance
Given I have a GraphLoader with a handler chain
And I have a new handler to insert
When I insert the handler at integer position 2
Then the handler should be inserted at position 2
Scenario: Insert handler after handler with specific ID
Given I have a test data directory
And I have a GraphLoader instance
Given I have a GraphLoader with a handler chain
And I have a new handler to insert
When I insert the handler after handler with ID "DefaultGraphLoaderFileHandler"
Then the handler should be inserted after handler with ID "DefaultGraphLoaderFileHandler"