Question

I have some ontology (campus.owl). There are tree classes (Student, Sport, Lecturer). Student class is joined with Lecturer class using "has" object property and Student class joined with Sport class with "isPlay" object property.

Problem

I want to get the object property between Student and Lecturer using some SPARQL query.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX my: <http://www.semanticweb.org/ontologies/2010/5/Ontology1275975684120.owl#>

SELECT ?prop
WHERE {
  ?prop ..........???
}

How should I proceed?

Was it helpful?

Solution

SELECT ?prop WHERE { ?student ?prop ?lecturer.
                     ?student a <student>.
                     ?lecturer a <lecturer>.
                     }

I think that will do what you want.

If you want to get information abuot the property you can do something like

SELECT ?prop, ?pp, ?oo WHERE {
                     ?prop ?pp ?oo.
                     ?student ?prop ?lecturer.
                     ?student a <student>.
                     ?lecturer a <lecturer>.
                     }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top