Theory
FILTER drops bindings that fail a boolean test:
SELECT ?ninja ?age WHERE {
?ninja a :Ninja ; :age ?age .
FILTER(?age >= 18)
}
The operators you'll reach for most often inside FILTER(...):
| Operator | Does |
|---|---|
= / != | Equality / inequality on RDF terms |
< <= > >= | Numeric / date comparison |
&& / || | Boolean AND / OR |
regex(?s, "^foo") | Regex match on a string |
lang(?lit) = "en" | Match a language tag on a literal |
bound(?x) | Did this variable get a binding? (esp. OPTIONAL) |