W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > March 2009

Feature request: IN operator

From: Toby Inkster <tai@g5n.co.uk>
Date: Wed, 04 Mar 2009 14:45:20 +0000
To: public-rdf-dawg-comments@w3.org
Message-Id: <1236177920.26486.27.camel@ophelia2.g5n.co.uk>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 4 March 2009 14:46:06 GMT