tags:

views:

109

answers:

1

hi,

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

Any Idea..??

Thank in advance!

+2  A: 
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>.
                     }
Jeremy French
Thank you Jeremy.But I have one more question.please consider this situation.Lecture class has two sub classes called "RegularLecture and VisitingLecturer"and which have some individuals too.Student class also has some individuals.I want to get some Lecturer/VisitingLecturer individuals for given student individual.Could you please help me to get this result!Thanks in advance!
udayalkonline
There are two ways to do that. Simple way would be to use UNION of two queries. Or you could define that Lecture and VisitingLecture are both derivitives of a LectureTypeObject and extend your query to use that. If you you want a more detailed answer, ask another question.
Jeremy French
Ok..I asked this as new question.please refer that following url..Thank you!http://stackoverflow.com/questions/3061032/how-to-get-individuals-for-given-class-individual-with-given-object-property-us
udayalkonline