SPARQL equivalence for SQL IN () statement

Is there a SPARQL equivalence for an SQL statement IN()? I filter the results and now use:

FILTER ( lang(?label) = 'en' )

I need something like:

FILTER ( lang(?label) IN ('en', 'de') )

Is this possible with SPARQL?

+5
source share
2 answers

In SPARQL 1.1, yes .

FILTER ( lang(?label) IN ('en', 'de') )

must work.

Pre-1.1 you will need a big clause:

FILTER ( (lang(?label) = 'en') || (lang(?label) = 'de') )
+9
source

According to the official W3C documentation ,

AT

boolean  rdfTerm IN (expression, ...)

The IN statement checks whether the RDF member on the left is in the values ​​of the expression list on the right. The test is performed using the operator "=", which checks the same value determined by the display of the operator.

.

, IN , RDF .

IN SPARQL:

(lhs = expression1) || (lhs = 2) ||...

< > :

enter image description here

, IN . , SPARQL FILTER + IN:

SELECT ?s1 
WHERE 
{
      ?s1 rdf:type dbpedia-owl:Scientist.
      FILTER (?s1 IN (<http://example.com/#1>,<http://example.com/#2>, <http://example.com/#3>)) 
 }
0

All Articles