I have an RDFS ontology where i have one class Person and another class Department The class Person has a property called has_name and a property called member_of with domain Person and range Department. The class Department has a property called dep_city and another called dep_name,both have domain Department and range literal.
I want to create a query so that returns the has_name value of every Person that is member_of a Department that has dep_city = "New York".
My question is how to connect the two classes that i need to create my query.
I can return the dep_name of all the Departments that have dep_city = "New York"
I also know how return all the has_name of all the Persons but i don't if i can connect the two.
Please help me Thank you!!
I don't know what namespace you use, so I will use http://example.org/
SELECT ?name
WHERE {
?person <http://example.org/has_name> ?name .
?person <http://example.org/member_of> ?department .
?department <http://example.org/dep_city> "New York"
}
By the way, have you read SPARQL 1.1 Query specification? It is a very concise document with a lot of examples
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.