Skip to content

Mapping Rules RDF2PG (RDF to Property Graph)

Ghislain edited this page Mar 5, 2019 · 1 revision

Mapping Rules - Schema for PG Cypher

Rule 1:

Subjects of triples are mapped to nodes in Neo4J or any . A node in Neo4J/PG representing an RDF resource will be labeled :Resource and have a property uri with the resource’s URI.

(S,P,O) => (:Resource {value:S,kind:uri})...

dbr:Mondeca rdf:type dbo:Agent , dbo:Organisation .

Mondeca subject would look like this (:Resource {value:’dbr:Mondeca’,kind:’uri’})

Rule 2 : Predicates of triples are mapped to relationships in Neo4j if the object of the triple is a literal

(S,P,O) && isLiteral(O) => (:Resource {value:S,kind:uri})-[:P]->(:Resource {value:O,kind:literal})

dbr:Mondeca rdfs:label "Mondeca".

(:Resource {value:’dbr:Mondeca’,kind:’uri’})-[:rdfs:label]->(:Resource {value:Mondeca,kind:literal} )

This rule is generic enough to handle multi valued properties, datatypes of literals, multilingual values in literals. Therefore, it is much easier to add in a given node the properties of Neo4J such as lang, type of a literal.

Example1: Representing multilingual information

dbr:Mondeca rdfs:label "Mondeca"@fr , "Mondeca"@en.

(:Resource {value:'dbr:Mondeca',kind:'uri'})-[:'rdfs:label']->(:Resource {value:'Mondeca',kind:'literal',lang:'fr'} )`

(:Resource {value:'dbr:Mondeca',kind:'uri'})-[:'rdfs:label']->(:Resource {value:'Mondeca',kind:'literal',lang:'en'} )

Example2: Representing data types of literals

dbr:Mondeca dbo:numberOfEmployees "21"^^xsd:nonNegativeInteger; dbo:foundingYear "2000"^^xsd:gYear

(:Resource {value:'dbr:Mondeca',kind:'uri'})-[:'dbo:numberOfEmployees']->(:Resource {value:'21',kind:'literal',type:'xsd:nonNegativeInteger'} )

(:Resource {value:'dbr:Mondeca',kind:'uri'})-[:'dbo:foundingYear']->(:Resource {value:'1999',kind:'literal',type:'xsd:gYear'} )

Rule 3 : Predicates of triples are mapped to relationships in Neo4j if the object of the triple is a resource

(S,P,O) && !isLiteral(O) => (:Resource {value:S,kind:uri})-[:P]->(:Resource {value:O,kind:’uri’})

dbr:Mondeca dbo:location dbr:Paris.

(:Resource {value:'dbr:Mondeca',kind:'uri'})-[:'dbo:foundingYear']->(:Resource {value:'1999',kind:'literal',type:'xsd:gYear'} )

(:Resource {value:dbr:Mondeca,kind:uri})-[:dbo:location]->(:Resource {value:dbr:Paris,kind:uri})

(:Resource {value:'dbr:Mondeca',kind:'uri'})-[:'dbo:numberOfEmployees']->(:Resource {value:'15',kind:'literal',type:'xsd:nonNegativeInteger'} )

ex:Person rdf:type owl:Class .

(:Resource {value:ex:Mondeca,kind:uri})-[:rdf:type]->(:Resource {value:owl:Class,kind:uri})