Skip to content

blevinson/neosemantics

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

neosemantics

##Installation

  1. Build it
mvn clean package
  1. Drop the jar in the <NEO_HOME>/plugins directory of your Neo4j instance.
  2. Download additional jars to the plugins directory if needed.
  3. Add the following line to your <NEO_HOME>/conf/neo4j.conf
dbms.unmanaged_extension_classes=semantics=/rdf
  1. Restart the server.
  2. 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
  • URL of the dataset
  • serialization(*)
  • shorten urls [true,false]
  • convert types to labels
  • periodic commit
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
  • URL of the dataset
  • serialization(*)
  • shorten urls [true,false]
  • convert types to labels
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
  • An RDF snippet
  • serialization(*)
  • shorten urls [true,false]
  • convert types to labels
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
  • URL of the dataset
  • serialization(*)
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
  • nodeid:the id of a node
  • excludeContext:(optional) if present output will not include connected nodes, just selected one.
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
  • nodeuri:the uri of a node
  • excludeContext:(optional) if present output will not include connected nodes, just selected one.
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"

About

Experiments bridging the RDF and LPG worlds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 95.8%
  • Web Ontology Language 4.2%