(n10s) is a plugin that enables the use of RDF and its associated vocabularies like (OWL, RDFS, SKOS and others) in [neo4j].

Basic flow

0. Pre-req: Constraint Creation

CREATE CONSTRAINT n10s_unique_uri FOR (r:Resource) REQUIRE r.uri IS UNIQUE

1. Creating a Graph Configuration

Before any RDF import operation a GraphConfig needs to be created. Here we define the way the RDF data is persisted in Neo4j. We’ll find things like

Param Values Desc
handleVocabUris “SHORTEN”,”KEEP”,”SHORTEN_STRICT”,”MAP” how namespaces are handled
handleMultival “OVERWRITE”,”ARRAY” how multivalued properties are handled
handleRDFTypes “LABELS”,”NODES”,”LABELS_AND_NODES” how RDF datatypes are handled
multivalPropList [ list of predicate uris ]  

Check the complete list in the reference.

You can create a graph config with all the defaults like this:

call n10s.graphconfig.init()

Or customize it by passing a map with your options:

call n10s.graphconfig.init( { handleMultival: "ARRAY",
                              multivalPropList: ["", ""],
                              keepLangTag: true })

2. Importing RDF data

Once the Graph config is created we can import data from a url using fetch:

call n10s.rdf.import.fetch( "",

Or pass it as a parameter using inline:

with '
@prefix neo4voc: <> .
@prefix neo4ind: <> .

neo4ind:nsmntx3502 neo4voc:name "NSMNTX" ;
a neo4voc:Neo4jPlugin ;
neo4voc:runsOn neo4ind:neo4j355 .

neo4ind:apoc3502 neo4voc:name "APOC" ;
a neo4voc:Neo4jPlugin ;
neo4voc:runsOn neo4ind:neo4j355 .

neo4ind:graphql3502 neo4voc:name "Neo4j-GraphQL" ;
a neo4voc:Neo4jPlugin ;
neo4voc:runsOn neo4ind:neo4j355 .

neo4ind:neo4j355 neo4voc:name "neo4j" ;
a neo4voc:GraphPlatform , neo4voc:AwesomePlatform .

' as  payload

call n10s.rdf.import.inline( payload, "Turtle") yield terminationStatus, triplesLoaded, triplesParsed, namespaces
return terminationStatus, triplesLoaded, triplesParsed, namespaces

It is possible to pass some request specific parameters like headerParams, commitSize, languageFilter… (also found the reference)

3. Importing Ontologies, QuadRDF, etc

Same naming scheme applies…

call n10s.onto.import.fetch(...)

Use autocompletion to discover the different procedures.

Смотри еще: