I'm trying to export an existing Label property graph in neo4j as RDF and trying to use neosemantics for that purpose and for the sake of PoC, I tried to use the example database with Movie dataset that comes preinstalled with Neo4j desktop.
Below are the steps I followed
- Create Ontology using cypher Reference here
- Data already exists in the neo4j desktop
- Init configuration
CALL n10s.graphconfig.init();
Pretty much that's it. I'm pretty sure I have missed some steps and reading the docs could give me some hint, but I thought to ask here as well to get a direction so as to speed up a bit.
I can access the Ontology using :GET http://localhost:7474/rdf/neo4j/onto
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<neo4j://graph.schema#WROTE> a owl:ObjectProperty;
rdfs:range <neo4j://graph.schema#Movie>;
rdfs:domain <neo4j://graph.schema#Person>;
rdfs:label "WROTE" .
<neo4j://graph.schema#RANGE> a owl:ObjectProperty;
rdfs:range <neo4j://graph.schema#Class>;
rdfs:domain <neo4j://graph.schema#ObjectProperty>;
rdfs:label "RANGE" .
<neo4j://graph.schema#ACTED_IN> a owl:ObjectProperty;
rdfs:label "ACTED_IN";
rdfs:domain <neo4j://graph.schema#Person>;
rdfs:range <neo4j://graph.schema#Movie> .
........
I can validate the Label property graph against the Ontology using Cypher like this
// DatatypeProperty domain semantics meta-rule
MATCH (n:Class)<-[:DOMAIN]-(p:DatatypeProperty)
WITH DISTINCT n.uri as classUri, n.label as classLabel, p.uri as prop, p.label as propLabel
MATCH (x) WHERE x[propLabel] IS NOT NULL AND NOT classLabel IN labels(x)
RETURN id(x) AS nodeUID,
'domain of ' + propLabel + ' [' + prop + ']' AS `check failed`,
'Node labels: (' + reduce(s = '', l IN Labels(x) | s + ' ' + l) + ') should include ' + classLabel AS extraInfo
But what I cannot do is access the data as RDF, like for example
:POST /rdf/neo4j/cypher
{ "cypher" :"match (m: Movie)<-[:ACTED_IN]-(actor: Person) match (m)<-[:DIRECTED]-(director: Person) where m.title = 'The Matrix' RETURN m, actor, director", "format": "RDF/XML"}
returns Empty
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
</rdf:RDF>
Any pointers will be highly appreciated.
Thanks