fix(triplet_store): honor RDF4J repository id

This commit is contained in:
Freakz2z
2026-08-23 23:02:15 +08:00
parent ea9b1f5d4a
commit e41993a6bd
3 changed files with 24 additions and 3 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ This page is intentionally conservative: it distinguishes between an adapter exi
| FalkorDB | LPG | Yes | Yes | Partial | Partial | Redis-based; provenance depends on node/edge properties, and multi-graph isolation depends on the selected graph name. |
| Amazon Neptune | LPG | Yes | Yes | Partial | Partial | Use the property-graph endpoint; AWS auth, VPC, and endpoint configuration can affect local tests. Provenance depends on node/edge properties. |
| Apache AGE | LPG | Yes | Yes | Partial | Partial | Runs through PostgreSQL/AGE; Cypher compatibility and property handling can differ from standalone LPG engines. |
| RDF4J | RDF | Yes | Partial | Partial | Partial | Context separation relies on named graphs; triple-level provenance may require reification or graph-level metadata. `RDF4JStore(repository_id=...)` currently has no effect — the constructor always connects to the `"default"` repository regardless of the value passed; track a fix separately. |
| RDF4J | RDF | Yes | Partial | Partial | Partial | Context separation relies on named graphs; triple-level provenance may require reification or graph-level metadata. |
| Apache Jena | RDF | Yes | Partial | Partial | Partial | Named graphs are needed for context separation; backend configuration and transaction behavior matter. |
| Blazegraph | RDF | Yes | Partial | Partial | Partial | Use quads/named graphs for context; IRI stability and graph naming matter for provenance. |
| Anzo | RDF | Yes | Partial | Partial | Partial | Anzo deployments are environment-specific; validate `dataset_uri`/graphmart naming, named-graph support, and provenance mapping. |
@@ -107,7 +107,7 @@ from semantica.triplet_store import RDF4JStore
store = RDF4JStore(
endpoint='http://localhost:8080/rdf4j-server',
repository_id='semantica' # currently has no effect; connects to "default" (see Known limitations)
repository_id='semantica'
)
```
+1 -1
View File
@@ -67,7 +67,7 @@ class RDF4JStore:
self.progress_tracker.enabled = True
self.endpoint = endpoint.rstrip("/")
self.repository_id = config.get("repository_id", "default")
self.repository_id = repository_id or config.get("repository_id", "default")
self.username = config.get("username")
self.password = config.get("password")
self.timeout = config.get("timeout", 30)
+21
View File
@@ -22,6 +22,27 @@ def _make_connected_store():
CONSTRUCT_QUERY = "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }"
class TestRDF4JStoreInitialization(unittest.TestCase):
def test_explicit_repository_id_selects_repository(self):
response = MagicMock(status_code=200)
with patch(
"semantica.triplet_store.rdf4j_store.requests.get",
return_value=response,
) as mock_get:
store = RDF4JStore(
endpoint="http://localhost:8080/rdf4j-server/",
repository_id="semantica",
)
self.assertEqual(store.repository_id, "semantica")
mock_get.assert_called_once_with(
"http://localhost:8080/rdf4j-server/repositories/semantica",
timeout=30,
auth=None,
)
class TestRDF4JStoreIsConstructQuery(unittest.TestCase):
def test_detects_uppercase(self):
self.assertTrue(_make_connected_store()._is_construct_query(