开发者

How to get object properties of specific class in SPARQL

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?


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>.
                     }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜