without property paths
SELECT ?person WHERE
{
?person :worksAt ?branch.
?branch :location ?town.
?town :country :?country.
}
with property paths
Using a sequence path defined as:
elt1 / elt2 A sequence path of elt1, followed by elt2
SELECT ?person WHERE
{
?person :worksAt/:location/:country ?country.
}
I don't understand what you mean with "given a property e.g. country", do you mean a specific instance instead? For example if the person should work in Germany, you would replace ?country
with :Germany
.
These examples assume that your properties only have a single class as a domain, e.g. only persons can work somewhere. Otherwise you have to add ?person a :Person.
and so on.