Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-23-2021 03:06 PM
i am quite new to Neo4J and trying to import ontology via neosemantics. I had couple of questions:
06-23-2021 05:20 PM
Hi @caeserk , apologies but we are still finishing the updates to the documentation after the last release 😞 so there may be some bits that you will not find in the current version of the manual.
Regarding your questions:
ns0__
, ns1__
etc in the n10s.rdf.import.*
procedures is documented here. I'm not entirely sure what you mean with ns0__classFieldValue
, again the RDF fragment you're trying to import would be really useful.n10s.onto.import
or n10s.rdf.import
here? Could you describe how would you expect the restrictions imported instead of the way it happens now?A useful way of testing small fragments is by using the n10s.onto.preview.*
and n10s.rdf.preview.*
. You can check them out here.
here's the example in the image:
call n10s.onto.preview.inline('
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix vin: <http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#> .
vin:Wine a owl:Class ;
rdfs:subClassOf vin:PotableLiquid, [
a owl:Restriction ;
owl:onProperty vin:hasMaker ;
owl:allValuesFrom vin:Winery ] .
','Turtle')
Please send additional details and we'll be happy to help.
Cheers,
JB.
06-24-2021 11:50 AM
Thank you for the reply and suggestions on using the preview/ inline mode. sorry for being unclear before. i am new to both the ontology and neo4j worlds!
To elaborate, for the example rdf snippet given above:
call n10s.onto.preview.inline('
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix vin: <http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#> .
vin:Wine a owl:Class ;
rdfs:subClassOf vin:PotableLiquid, [
a owl:Restriction ;
owl:onProperty vin:hasMaker ;
owl:allValuesFrom vin:Winery ] .
','Turtle')
snapshot of the graph:
06-25-2021 09:43 AM
Hi @caeserk , looks like you're in an older version of n10s?
Restrictions were added in the latest release ( 4.3.0.0 for Neo4j 4.3.x or 4.2.0.2 for Neo4j 4.2.7 onward). Would it be possible for you to update to any of these?
You should get something similar to what I showed on my screen capture where you can see both the SubClassOf relationship (SCO) and the Restriction with all the details (including the reference to the vin:hasMaker
prop) as attributes of the relationship. I've highlighted them with the red arrow .
The reason why he went with a representation like this one is that it seems to be the one preferred by users, probably more intuitive for visualization? and is aligned with the one offered by other ontology viz libraries like WebOWL. It's actually a lot more compact than creating an intermediate node representing the restriction and linking to the node representing the vin:hasMaker
prop.
But in any case and answering your question there is no information loss, all elements in the Restriction definition are stored in the graph.
With the n10s.rdf.import.*
approach, you get an exact replica of the way the Restriction is defined in RDF, including the intermediate blank nodes. To make it more obvious think of the N-Triples serialization of the ontology fragment. This is what the previous ttl fragment looks as N-Triples (*):
<http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#Wine> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .
<http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#Wine> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#PotableLiquid> .
<http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#Wine> <http://www.w3.org/2000/01/rdf-schema#subClassOf> _:genid1 .
_:genid1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Restriction> .
_:genid1 <http://www.w3.org/2002/07/owl#onProperty> <http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#hasMaker> .
_:genid1 <http://www.w3.org/2002/07/owl#allValuesFrom> <http://www.w3.org/TR/2004/REC-owl-guide-20040210/wine#Winery> .
Here you can see that there is an intermediate blank node representing the Restriction. That's what I meant, the n10s.onto.import.*
produces a more "humane" view of the same information. But ultimately it's up to you which one makes more sense depending on what you're trying to achieve with the ontology.
I hope this helps.
What is the purpose of your experiment? Is it the visual exploration of the onto? Or are you planning to use it to automate some process based on it?
Cheers,
JB.
(*) You can actually try importing this version of the RDF instead, by just setting the second parameter of the preview|import
procedure to "N-Triples"
instead of "Turtle"
.
06-30-2021 03:59 PM
Thanks @jesus.barrasa. After upgrading to latest version, i can see the ontology imported with restrictions as you mentioned above. Are most other owl constructs supported in the latest version as well - for eg: unionOf, intersectionOf etc.?
currently I am just trying to understand the ontology and visualize how various classes in the ontology are related to each other. At the same time I am also trying to educate myself in the features of neo4j and cypher in general with respect to rdf data. thanks!
07-18-2021 06:31 AM
Complex classes are currently not supported but we're busy thinking what would be an efficient way of representing them. Any ideas on this are most welcome.
And in the mean time you can of course use the "selective import" via
CALL n10s.rdf.stream.fetch(...) yield subject, predicate, object, isLiteral, literalType, literalLang
WHERE predicate = ... // select your triples here
...your custom cypher here ... // persist them the way you want
Hope this helps.
JB.
All the sessions of the conference are now available online