##Installation
- Build it
mvn clean package
- Drop the jar in the <NEO_HOME>/plugins directory of your Neo4j instance.
- Download additional jars to the plugins directory if needed.
- Add the following line to your <NEO_HOME>/conf/neo4j.conf
dbms.unmanaged_extension_classes=semantics=/rdf
- Restart the server.
- Check that the installation went well by running
call dbms.procedures()
. The list of procedures should include the ones documented below. You can check that the extension is mounted by running:GET /rdf/ping
##What's in this repository This repository contains a set of stored procedures and extensions to both produce and consume RDF from Neo4j.
###Stored Procedures
Stored Proc Name | params | Description and example usage |
---|---|---|
semantics.importRDF |
|
Imports into Neo4j all the triples in the data set according to [the mapping defined in this post] (https://jesusbarrasa.wordpress.com/2016/06/07/importing-rdf-data-into-neo4j/). Note that before running the import procedure an index needs to be created on property uri of Resource nodes. Just run CREATE INDEX ON :Resource(uri) on your Neo4j DB. Examples: CALL semantics.importRDF("file:///.../myfile.ttl","Turtle", false, true, 9000) CALL semantics.importRDF("http:///.../data.rdf","RDF/XML", true, true, 9000) |
semantics.previewRDF |
|
Parses some RDF and produces a preview in Neo4j browser. Same parameters as data import except for periodic commit, since there is no data written to the DB. Notice that this is adequate for a preliminary visual analysis of a SMALL dataset. Think how many nodes you want rendered in your browser. Examples: CALL semantics.previewRDF("https://.../clapton.n3","Turtle", true, true) |
semantics.previewRDFSnippet |
|
Identical to previewRDF but takes an RDF snippet instead of the url of the dataset. Again, adequate for a preliminary visual analysis of a SMALL dataset. Think how many nodes you want rendered in your browser :) Examples: CALL semantics.previewRDFSnippet('[{"@id": "http://indiv#9132", "@type": ... }]', "JSON-LD", true, true) |
semantics.LiteOntoImport |
|
Imports the basic elements of an OWL or RDFS ontology, i.e. Classes, Properties, Domains, Ranges. Extended description here Example: CALL semantics.LiteOntoImport("http://.../myonto.trig","TriG") |
(*) Valid formats: Turtle, N-Triples, JSON-LD, TriG, RDF/XML
###Extensions
Extension | params | Description and example usage |
---|---|---|
/rdf/describe/id |
|
Produces an RDF serialization of the selected node. The format will be determined by the accept parameter in the header. Default is JSON-LD Example: :GET /rdf/describe/id?nodeid=0&excludeContext |
/rdf/describe/uri |
|
Produces an RDF serialization of the selected node. It works on a model either imported from an RDF dataset via semantics.importRDF or built in a way that nodes are labeled as :Resource and have an uri. This property is the one used by this extension to lookup a node. Example: :GET /rdf/describe/uri?nodeuri=http://dataset.com#id_1234 |
/rdf/cypher | Takes a cypher query in the payload | Produces an RDF serialization of the nodes and relationships returned by the query. Example: :POST /rdf/cypher "MATCH (a:Type1)-[r:REL]-(b) RETURN a, r, b" |
/rdf/cypheronrdf | Takes a cypher query in the payload | Produces an RDF serialization of the nodes and relationships returned by the query. It works on a model either imported from an RDF dataset via semantics.importRDF or built in a way that nodes are labeled as :Resource and have an uri. Example: :POST /rdf/cypheronrdf "MATCH (a:Resource {uri:'http://dataset/indiv#153'})-[r]-(b) RETURN a, r, b" |