how to get individual(s) for given class/individual with given object property using SPARQL

天涯浪子 提交于 2019-12-11 06:45:26

问题


I have simple ontology called "campus.owl".There is a class called"Lecturer" and which has two sub classes ,RegularLecturer and VisitingLecturer.There is a another class called "Student" which is a sibling class of Lecturer class. I have created individuals for all the classes.

Student class is joind with Lecture class with "has" object property.

problem

I want to get some Lecturer/VisitingLecturer individuals for given student individual. Could you please help me to get this result! Thanks in advance!

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 ?lec WHERE { ?lec..........??? }

any idea..??

Thank in advance!


回答1:


Something like:

SELECT ?lec WHERE { ?lec a ?lectype. 
                    ?lectype <http://www.w3.org/2000/01/rdf-schema#subClassOf> <Lecturer>.
                    <student> <has> ?lec.}

Should do it.



来源:https://stackoverflow.com/questions/3061032/how-to-get-individuals-for-given-class-individual-with-given-object-property-u

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!