neosemantics icon indicating copy to clipboard operation
neosemantics copied to clipboard

How to get the rdf:type of an instance?

Open masium opened this issue 6 years ago • 1 comments

Hi Jesus,

I have a sample ontology that contains classes and instances, modeled in Protege:

screen shot 2019-01-10 at 10 59 22 am

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

masium avatar Jan 10 '19 19:01 masium

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:

image

I hope this helps.

JB.

jbarrasa avatar Apr 15 '19 00:04 jbarrasa