Feature request: IN operator

Analogous to the SQL operator of the same name.

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?thing ?name
WHERE {
  ?thing ?p ?name .
  FILTER (?p IN (foaf:name foaf:nick rdfs:label))
}

This query can already be written as

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?thing ?name
WHERE {
  ?thing ?p ?name .
  FILTER (?p = foaf:name || ?p = foaf:nick || ?p = rdfs:label)
}

But I hope people agree that the former syntax is more legible.

Formally, IN would be an infix operator taking a term as its first
argument and an rdf:List as its second argument.

-- 
Toby Inkster <tai@g5n.co.uk>

Received on Wednesday, 4 March 2009 14:46:06 UTC