how to get individual(s) for given class/individual with given object property using SPARQL
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 j开发者_Python百科oind 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!
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.
精彩评论