Kaixo Itziar!
By default all rdf:type
triples are transformed into labels when imported into Neo4j but you can change this behaviour using the typesToLabels
parameter. Let me show it to you with an example.
You will need to import your ontology and your instance data separately.
Let's say this is your ontology vehicle-classes.owl
:
@prefix : <http://neo4j.org/voc/automobile#> .
:Automobile rdf:type owl:Class ;
rdfs:label "Automobile" .
:Compact rdf:type owl:Class ;
rdfs:subClassOf :Automobile ;
rdfs:label "Compact" .
:Convertible rdf:type owl:Class ;
rdfs:subClassOf :Automobile ;
rdfs:label "Convertible" .
:Wagon rdf:type owl:Class ;
rdfs:subClassOf :Automobile ;
rdfs:label "Wagon" .
You can import it just like you were doing:
CALL semantics.importRDF('file:///...vehicle-classes.owl',"Turtle", { handleVocabUris: "IGNORE" })
which will import something like this in your graph:
Now your instances (individuals) could look something like this (vehicle-individuals.rdf):
@prefix voc: <http://neo4j.org/voc/automobile#> .
@prefix ind: <http://neo4j.org/indiv#> .
ind:Golf_GTI_Autobahn rdf:type owl:NamedIndividual ,
voc:Compact ;
voc:hasEngine ind:2.0L_Turbo ;
rdfs:label "Golf GTI Autobahn" .
ind:Golf_GTI_Rabbit_Edition rdf:type owl:NamedIndividual ,
voc:Compact ;
voc:hasEngine ind:2.0L_Turbo ;
rdfs:label "Golf GTI Rabbit Edition" .
ind:Beetle_Convertible rdf:type owl:NamedIndividual ,
voc:Convertible ;
voc:hasEngine ind:1.4L ;
rdfs:label "Beetle Convertible" .
You need to import them by adding the additional config parameter typesToLabels: false
to indicate that you don't want the rdf:type
triples to be transformed into labels but rather imported as relationships connecting the individuals to their class:
CALL semantics.importRDF('file:///...vehicle-individuals.rdf',"Turtle", { handleVocabUris: "IGNORE" , typesToLabels: false })
Which will create the individuals and attach them to the previously imported classes.
You will notice that the other types (owl:NamedIndividual
in this case) are also imported as relationships but you can delete these post-import if they're not needed.
I hope this helps. Let me know if there is anything unclear.
Cheers,
JB.