Multiple Triples
You can include multiple triples in a single where clause. Any variables in the where clauses are bound across triples.
For example, the triple ?person fd:person/fullName ?fullName.
binds ?person
to any subject _id
with a person/fullName
, and ?fullName
binds to all objects of the person/fullName
predicate.
However, if we combine multiple triples, like below, the values of ?person
and ?fullName
are different.
SELECT ?person
WHERE {
?person fd:person/handle "jdoe".
?person fd:person/fullName ?fullName.
}
A ?person not only has to have a person/fullName
, but also a person/handle
that equals jdoe
. Therefore, if we are using our Basic Schema, ?fullName
would only be bound to Jane Doe
.
Write your own SPARQL query
How would you write a query that selects all `?person` and `?handle` where the one of person's favorite number (person/favNums)` is 1223?