semsol / arc2

ARC RDF Classes for PHP
Other
331 stars 92 forks source link

FILTER subject in an array of values #139

Closed craigdietrich closed 4 years ago

craigdietrich commented 4 years ago

Hi all,

I can't seem to get a FILTER to work that checks if ?s is present in an array. Note that this is SPARQL 1.1 and I recall that ARC2 doesn't completely implement 1.1.

PREFIX dcterms:  <http://purl.org/dc/terms/> .
SELECT *
WHERE {
  ?s dcterms:type ?o . 
  FILTER (?s IN ("urn:scalar:version:27560","urn:scalar:version:27559"))
}

Errors: Array

(
    [0] => Incomplete FILTER in ARC2_SPARQLPlusParser
    [1] => Incomplete or invalid Group Graph pattern. Could not handle "                 FILTER (?s IN" in ARC2_SPARQLPlusParser
)

Curious if there's another way to do this or if my syntax is wrong? (Note that I could use a UNION but then I wouldn't be able to return ?s in the results, I don't think.) Thanks!

craigdietrich commented 4 years ago

Ah, figured it out! SPARQL 1.0 solution:

PREFIX dcterms:  <http://purl.org/dc/terms/> .
SELECT *
WHERE {
  { ?s dcterms:source ?o . }
  FILTER (?s = "urn:scalar:version:27560" || ?s = "urn:scalar:version:27559")
}