cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neosemantics support to RDF Named Graphs

Hello,

I’m evaluating Neosemantics according with my project’s requirements. One of the major requirements is support to “RDF Named Graphs (N-Quads)”: An RDF database can store collections of RDF statements (triples) in separate graphs identified (named) by a URI. A group of statements with a unique name is called a ‘named graph’. 

Although Neosemantics can import/export N-Quads format, it seems that Neosemantics just stores the RDF Statement (triple) and doesn’t preserve the URI that identifies the name of the Graph.

I’ve tested it in Neo4J Sandbox with following commands:

 Importing N-Quad:

call n10s.rdf.import.inline(' <http://example.org/#batman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#coringa> <http://example.org/graphs/batman> . ',"N-Quads")

List imported N-Quad:

:GET /rdf/neo4j/describe/http%3A%2F%2Fexample.org%2F%23batman?format=N-Quads

Result:

<http://example.org/#batman> <neo4j://graph.schema#enemyOf> <http://example.org/#coringa> .

Does anyone knows if Neosemantics really cannot support RDF Named Graphs?

Thanks in advance.

1 REPLY 1

Support is limited and not being maintained so don't expect it to be perfect. 

Basically the way it works is it annotates nodes with the graph Uri, which means that you can have multiple nodes in the graph representing the same resource but with different graph uris, or in other words in different named graphs.

I don't think it's a great implementation TBH, give it a try and if it's useful to you do not hesitate to contribute a pull request to improve it  😉

 Here's the code:

// remove the uniqueness constraint on :Resource(uri)
// with named graphs you can have multiple nodes with the same uri but 
// with different graph uris

DROP constraint n10s_unique_uri ;

CREATE INDEX ON :Resource(uri);

//use the experimental procedure to import named graphs
call n10s.experimental.quadrdf.import.fetch(' <http://example.org/#batman> <http://www.perceive.net/schemas/relationship/enemyOf> <http://example.org/#coringa> <http://example.org/graphs/batman> . ',"N-Quads")

 

 

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online