neosemantics is a plugin that enables the use of RDF in Neo4j. RDF is a W3C standard model for data interchange. This effectively means that neosemantics makes it possible to
⇨ Use this if you want to try neosemantics 4.0.0-beta. We should be publishing a complete manual shortly at the user manual pages. ⇦
You can either download a prebuilt jar from the releases area or build it from the source. If you prefer to build, check the note below.
- Copy the the jar(s) in the <NEO_HOME>/plugins directory of your Neo4j instance. (note: If you're going to use the JSON-LD serialisation format for RDF, you'll need to include also APOC)
- Add the following line to your <NEO_HOME>/conf/neo4j.conf
dbms.unmanaged_extension_classes=n10s.endpoint=/rdf
- Restart the server.
- Check that the installation went well by:
Running
call dbms.procedures()
. The list of procedures should include a number of them prefixed by n10s.
Checking that the logs show the following line on startup:
YYYY-MM-DD HH:MM:SS.000+0000 INFO Mounted unmanaged extension [n10s.endpoint] at [/rdf]
You can also test the extension is mounted by running :get http://localhost:7474/rdf/n10s/ping
on the neo4j browser and this should return the following message
{"ping":"here!"}
CREATE CONSTRAINT n10s_unique_uri ON (r:Resource) ASSERT r.uri IS UNIQUE
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 ] | |
... | ... | ... |
Most of them are the same (expect some changes) as in previous versions (see 3.5 manual for 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: ["http://voc1.com#pred1", "http://voc1.com#pred2"],
keepLangTag: true })
Once the Graph config is created we can import data from a url using fetch
:
call n10s.rdf.import.fetch( "https://raw.githubusercontent.com/jbarrasa/neosemantics/3.5/docs/rdf/nsmntx.ttl",
"Turtle")
Or pass it as a parameter using inline
:
with '
@prefix neo4voc: <http://neo4j.org/vocab/sw#> .
@prefix neo4ind: <http://neo4j.org/ind#> .
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 in the 3.5 manual)
Same naming scheme applies...
call n10s.onto.import.fetch(...)
Use autocompletion to discover the different procedures.
Full documentation will be available soon. In the meantime, please share your feedback in the Neo4j community portal.
Thanks!