Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Expect disruption to service on Thursday, Feb. 9!

Neosemantics support to RDF Named Graphs



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(' <> <> <> <> . ',"N-Quads")

List imported N-Quad:

:GET /rdf/neo4j/describe/


<> <neo4j://graph.schema#enemyOf> <> .

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

Thanks in advance.


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(' <> <> <> <> . ',"N-Quads")



Nodes 2022
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online