In addition of the DefaultInMemoryGraphStore which is an in-memory graph implementation provided by the Core module, Graal provides other Store implementations on top of database systems: relational databases, triple stores, graph databases.
There are two modules based on a relational database system.
The first module is called NaturalRDBMSStore and is provided by the rdbms-natural module. This implementation can be plugged on top of any existing relational database. Each n-ary relation is seen as an n-ary predicate with the same name. Hence, each row of each table is seen as an atom of the form tableName(column1Value, column2Value, …, columnKValue). Note that the predicates are restricted to strings accepted as relations (table names) by the database management system.
The second module is called AdHocRdbmsStore and is provided by the rdbms-adhoc module. It allows to use predicates not supported by the database management system. This implementation needs a specific database schema to work. It uses specific tables to store predicates (and their correspondence with relations of the database), term types (constants or variables) and a counter for fresh variables. So it can only be plugged on top of a fresh database instance (ie not containing any table) or a database initialized by the AdHocRdbmsStore .
These two implementations currently support the following database management systems: HSQLDB, Mysql, PostgreSQL and Sqlite. These RDBMS are supported through the following RdbmsDriver : HSQLDBDriver , MysqlDriver , PostgreSQLDriver and SqliteDriver . Of course you may implement your own driver.
The graal-store-rdf4j module provides a Store
implementation called RDF4jStore
based on the RDF4J API. The translation from triples to atoms is natural, each triple being seen as a binary atom of the form predicate(subject, object). To convert triples of the form subject rdf:type class into atoms of the form class(subject), please see RDFTypeAtomMapper
.
This implementation can be plugged on top of any RDF4J Repository that includes Sesame but also any SPARQL endpoint thanks to SPARQLRepository.
The graal-store-neo4j module provides a Store implementation called Neo4jStore built on a Neo4j graph database. As for AdHocRDBMSStore, it is a specific implementation. An Atom of arity k > 0 is represented as a Neo4j Node with a special label "Atom" related via Predicate Nodes (ie nodes labeled "Predicate") to k Term Nodes. So n-ary atoms and variables are supported by this storage.