What RDF and LPG Graph Stores Are Compatible with Semantica
Semantica supports nine graph database backends: four LPG (Property Graph) stores including Neo4j, FalkorDB, Amazon Neptune, and Apache AGE, plus five RDF stores including RDF4J, Blazegraph, Apache Jena (TDB2), Oxigraph, and Anzo.
The semantica-agi/semantica repository provides a unified Python abstraction layer for knowledge graph applications. Understanding what RDF and LPG graph stores are compatible with Semantica enables developers to switch between property-graph and triple-store paradigms without modifying application logic, using the factory methods defined in semantica/graph_store/graph_store.py and semantica/triplet_store/triplet_store.py.
Supported LPG (Property Graph) Stores
Semantica implements the GraphStore interface in semantica/graph_store/graph_store.py and provides four native drivers for property-graph databases that support Cypher or Gremlin query languages.
Neo4j
The Neo4j backend is implemented in semantica/graph_store/neo4j_store.py and provides access to the industry-standard native graph database. This driver supports the Bolt protocol for efficient client-server communication and implements methods including connect(), create_node(), and execute_query().
FalkorDB
The FalkorDB driver resides in semantica/graph_store/falkordb_store.py and connects to this Redis-based graph engine. FalkorDB offers a Cypher-compatible API, allowing Semantica to execute property-graph operations against Redis-backed datasets using the same interface as Neo4j.
Amazon Neptune
Implemented in semantica/graph_store/amazon_neptune.py, the Amazon Neptune backend connects to AWS's fully managed graph service. This driver supports both openCypher and Gremlin endpoints, enabling Semantica applications to leverage managed cloud infrastructure while maintaining compatibility with standard graph query languages.
Apache AGE
The Apache AGE backend in semantica/graph_store/age_store.py provides a PostgreSQL extension that adds native graph model support. This driver allows Semantica to execute Cypher queries against existing PostgreSQL installations, bridging relational and graph database architectures.
Supported RDF (Triple) Stores
For RDF datasets, Semantica defines the TripletStore interface in semantica/triplet_store/triplet_store.py with five backend implementations supporting SPARQL 1.1 endpoints.
RDF4J
The RDF4J backend in semantica/triplet_store/rdf4j_store.py connects to the Java-based SPARQL endpoint over HTTP. This driver handles repository management and implements add_triplet() and execute_sparql() methods for standard RDF operations.
Blazegraph
Implemented in semantica/triplet_store/blazegraph_store.py, the Blazegraph driver targets this high-performance RDF store. It supports SPARQL 1.1 queries and provides optimized batch loading capabilities for large-scale knowledge graphs.
Apache Jena (TDB2)
The Apache Jena backend in semantica/triplet_store/jena_store.py interfaces with the TDB2 native storage engine. This driver enables Semantica to perform SPARQL queries against Jena's persistent triple store while supporting transactional updates.
Oxigraph
The Oxigraph driver in semantica/triplet_store/oxigraph_store.py implements a Rust-based SPARQL engine. Unlike server-based alternatives, Oxigraph can be embedded as a library, offering zero-configuration RDF storage for lightweight applications.
Anzo
For enterprise deployments, the Anzo backend in semantica/triplet_store/anzo_store.py connects to this commercial RDF store. This driver supports Anzo's proprietary extensions while maintaining standard SPARQL compatibility for enterprise knowledge graph initiatives.
Implementation Examples
The following examples demonstrate initializing specific backends using the unified factory interfaces.
Connecting to an LPG Store (Neo4j)
To instantiate a Neo4j-backed graph store, import GraphStore and specify the backend identifier:
from semantica.graph_store import GraphStore
store = GraphStore(backend="neo4j", uri="bolt://localhost:7687", auth=("neo4j", "secret"))
store.connect()
store.create_node(labels=["Person"], properties={"name": "Alice"})
results = store.execute_query("MATCH (n:Person) RETURN n")
print(results["records"])
store.close()
Alternative LPG backends: Replace backend="neo4j" with "falkordb", "amazon_neptune", or "age" and provide the respective connection parameters documented in each backend file.
Connecting to an RDF Store (RDF4J)
For RDF operations, use TripletStore with the appropriate backend string:
from semantica.triplet_store import TripletStore
store = TripletStore(backend="rdf4j",
endpoint="http://localhost:8080/rdf4j-server",
repository_id="myrepo")
store.connect()
store.add_triplet(subject="http://example.org/Alice",
predicate="http://xmlns.com/foaf/0.1/name",
obj="Alice")
sparql = "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 5"
result = store.execute_sparql(sparql)
print(result["bindings"])
store.close()
Alternative RDF backends: Use "blazegraph", "jena", "oxigraph", or "anzo" as the backend parameter with connection arguments specific to each implementation.
Switching Between LPG and RDF Stores
Semantica allows simultaneous connections to both store types within a single application:
# LPG store for property-graph operations
graph = GraphStore(backend="neo4j", uri="bolt://localhost:7687")
graph.connect()
# RDF store for SPARQL queries
triple = TripletStore(backend="blazegraph",
endpoint="http://localhost:9999/blazegraph")
triple.connect()
# Export data between models
node = graph.create_node(labels=["Concept"], properties={"id": "C1", "label": "Planet"})
rdf_data = f"<{node['properties']['id']}> <http://example.org/hasLabel> \"{node['properties']['label']}\" ."
triple.add_rdf(rdf_data)
This interoperability pattern enables hybrid architectures where property-graph data can be serialized to RDF formats for semantic web integration.
Summary
- Semantica supports nine graph backends: Four LPG stores (Neo4j, FalkorDB, Amazon Neptune, Apache AGE) and five RDF stores (RDF4J, Blazegraph, Apache Jena, Oxigraph, Anzo).
- Unified interfaces are defined in
semantica/graph_store/graph_store.py(LPG) andsemantica/triplet_store/triplet_store.py(RDF). - Backend selection occurs via the
backendparameter when constructingGraphStoreorTripletStoreinstances. - Driver implementations reside in separate files within
semantica/graph_store/andsemantica/triplet_store/directories. - Cross-paradigm operations allow applications to utilize both property-graph and RDF models simultaneously.
Frequently Asked Questions
Can Semantica migrate data between LPG and RDF formats?
Yes. Semantica's unified API allows you to read nodes and relationships from an LPG store via GraphStore and serialize them to RDF triples using a TripletStore instance. While the library provides the connection abstractions in semantica/graph_store/graph_store.py and semantica/triplet_store/triplet_store.py, you must implement the specific transformation logic to map property-graph schemas to RDF vocabularies.
How does Semantica handle authentication for cloud-based graph stores?
Authentication parameters are passed as constructor arguments to the specific backend drivers. For example, the Amazon Neptune driver in semantica/graph_store/amazon_neptune.py accepts AWS credential configurations, while the Neo4j driver accepts auth tuples. Each backend implementation in the semantica-agi/semantica repository documents its required authentication parameters in the respective store file.
Which backend should I choose for high-performance SPARQL queries?
Blazegraph and Apache Jena (TDB2) provide optimized SPARQL 1.1 engines suitable for high-performance workloads according to the implementations in semantica/triplet_store/blazegraph_store.py and semantica/triplet_store/jena_store.py. For embedded applications without server infrastructure, Oxigraph (semantica/triplet_store/oxigraph_store.py) offers a lightweight, Rust-based alternative that compiles directly into your Python application.
Is it possible to use multiple backends simultaneously in one application?
Yes. You can instantiate multiple GraphStore and TripletStore objects with different backend parameters within the same Python process. Each maintains independent connection pools and state, allowing you to query a local Neo4j instance while simultaneously writing to a remote RDF4J repository, as demonstrated in the switching examples using semantica/graph_store/graph_store.py and semantica/triplet_store/triplet_store.py interfaces.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →