neosemantics
neosemantics copied to clipboard
How to get the rdf:type of an instance?
Hi Jesus,
I have a sample ontology that contains classes and instances, modeled in Protege:

I import the RDF into neo4j using:
CALL semantics.importRDF("file:///ontologies/resources/protege/automobile/volkswagen-inferred.owl", "Turtle", {shortenUrls: true, typesToLabels: true})
I'd like the query to return an instance and it's type (e.g. "Golf GTI S" and "Golf GTI") but am unable to formulate a query to do so. I've tried the following which returns no results:
MATCH (n:owl__NamedIndividual)-[*..3]->(m:owl__Class) WHERE n.rdfs__label = 'Golf GTI S' RETURN n, m LIMIT 25
Is there a way to get the type (rdf:type) of the instance?
Sample RDF, zipped:
volkswagen-inferred.owl.zip
Hi masium, apologies for the embarrassingly late reply.
I'm not giving this project the love it deserves :(
Anyway, I've loaded your ontology and here's what I see.
If you set the typesToLabels param to true, then your types will be represented as labels in Neo4j so the way to get all NamedIndividuals and their types would be:
MATCH (n:owl__NamedIndividual) RETURN n.rdfs__label as label, labels(n) as types
And this in your dataset returns:

I hope this helps.
JB.