SPARQL Where Clause
WHERE clauses are comprised of a series of triples, which correspond to subject-predicate-object. We can string multiple triples together, but in this first lesson, we'll look at how to just use one triple.
All components of the triple can either be variables or values. For example, the below is a valid SPARQL query:
SELECT ?person
WHERE {
?person fd:person/handle "jdoe".
}
The triple in the above WHERE clause has a subject, ?person
that is a variable.
The predicate, is fd:person/handle
. The fd:
portion of the predicate means that the predicate is in Fluree (see sources for more information). This is required, because SPARQL allows you to query across data sources.
The object is "jdoe", and we are SELECTing ?person. This means that the results will return any subject where the object of the predicate, person/handle
, is jdoe
.
Write your own SPARQL query
How would you write a query that selects any `?person` and `?handle` with any `person/handle`?