The reason I didn't realize this simple solution was that I was unaware of the procesing model of SPARQL, which in fact involves "involves generating every possible combination of bindings of values in the data to variables in the query, where the bindings match the query pattern" ... and "Each set of bindings then being evaluated against each FILTER expression and those sets that don't evaluate to true are discarded.", citing Brandon's discarded." according to a clarifying explanation by Brandon on the mailing list.
So far so good. Unfortunately though, this query scales very bad - exponentially with the number of variables / shift values tested for.
To verify this, I tried going from # = 1 as documented in this blog post. (where # denotes numbers of Using six similar shift values & variables) to # = 6. As exemplified with code (with prefixes omitted):
With # = 1:
SELECT ?s ?s1WHERE {\ ?s nmr:hasPeak [ nmr:hasShift ?s1 ] .FILTER ( fn:abs(?s1 - 17.6) < 0.3 ).} LIMIT 1...To # = 2:
SELECT ?s ?s1 ?s2WHERE {\ ?s nmr:hasPeak [ nmr:hasShift ?s1 ] , [ nmr:hasShift ?s2 ] .FILTER ( fn:abs(?s1 - 17.6) < 0.3 && fn:abs(?s2 - 18.3) < 0.3 ).} LIMIT 1... etc, up to # = 6. The results from timing the queries follow below:
# | Reasoning time (s) | log10(Reasoning time)1 | 0.043 | -1.372 | 0.058 | -1.243 | 0.295 | -0.534 | 3.332 | 0.525 | 44.183 | 1.656 | 488.612 | 2.69The log10(reasoning time) results in a straight line when plotting (except in the very beginning).
(I'm using Pellet 2.0.0 in Bioclipsesearch, takes some 488 seconds, on a 1.3 GHz Intel Su7300 Dual Core laptop (ASUS UL30A))dataset with 1 spectrum!)