VALUES, and FILTER acting odly on sesame native store 2.7.3 and OWLIM 5.3/4

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

VALUES, and FILTER acting odly on sesame native store 2.7.3 and OWLIM 5.3/4

Jerven Bolleman
Hi All,

I was trying something out with VALUES today and that did not work as I
expected.

I run this query
PREFIX up:<http://purl.uniprot.org/core/>
SELECT ?protein ?db ?method ?chain ?chainId
WHERE
{
?protein up:mnemonic 'PNP_ECOLI' .
?protein rdfs:seeAlso ?db .
?db up:method ?method .
?r rdf:subject ?protein .
?r rdf:predicate rdfs:seeAlso .
?r rdf:object ?db .
?r up:chain ?chain .
#BIND("A" AS ?chainId)
FILTER(regex(?chain, ?chainId))
}
VALUES (?chainId) {("A") ("B")}

I often get no answer :(

If I comment out the VALUES and comment in the earlier BIND I get a
correct answer.

If I put the VALUES where the BIND is I never get an answer.

Its a bit of a heisenbug. This record should be enough
to reproduce the problem
http://www.uniprot.org/uniprot/P05055.rdf

Could someone try to reproduce it for me to make sure I am not going
insane or missing some important part of the sparql standard.

Thanks,
Jerven

PS. enjoy ISWC2013








--
-------------------------------------------------------------------
  Jerven Bolleman                        [hidden email]
  SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
  CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
  1211 Geneve 4,
  Switzerland     www.isb-sib.ch - www.uniprot.org
  Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Sesame-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sesame-general
Reply | Threaded
Open this post in threaded view
|

Re: VALUES, and FILTER acting odly on sesame native store 2.7.3 and OWLIM 5.3/4

Jeen Broekstra
On 23/10/13 1:21 am, Jerven Bolleman wrote:

> I was trying something out with VALUES today and that did not work as I
> expected.
>
> I run this query
> PREFIX up:<http://purl.uniprot.org/core/>
> SELECT ?protein ?db ?method ?chain ?chainId
> WHERE
> {
> ?protein up:mnemonic 'PNP_ECOLI' .
> ?protein rdfs:seeAlso ?db .
> ?db up:method ?method .
> ?r rdf:subject ?protein .
> ?r rdf:predicate rdfs:seeAlso .
> ?r rdf:object ?db .
> ?r up:chain ?chain .
> #BIND("A" AS ?chainId)
> FILTER(regex(?chain, ?chainId))
> }
> VALUES (?chainId) {("A") ("B")}
>
> I often get no answer :(
>
> If I comment out the VALUES and comment in the earlier BIND I get a
> correct answer.
>
> If I put the VALUES where the BIND is I never get an answer.
>
> Its a bit of a heisenbug. This record should be enough
> to reproduce the problem
> http://www.uniprot.org/uniprot/P05055.rdf
>
> Could someone try to reproduce it for me to make sure I am not going
> insane or missing some important part of the sparql standard.

As far as I can tell this is a scoping issue. I just tested the
following two variants (on Sesame 2.7.6 with your data):

PREFIX up:<http://purl.uniprot.org/core/>
SELECT ?protein ?db ?method ?chain ?chainId
WHERE
{
    ?protein up:mnemonic 'PNP_ECOLI' .
    ?protein rdfs:seeAlso ?db .
    ?db up:method ?method .
    ?r rdf:subject ?protein .
    ?r rdf:predicate rdfs:seeAlso .
    ?r rdf:object ?db .
    ?r up:chain ?chain .
    FILTER(regex(?chain, ?chainId))
    VALUES (?chainId) {("A") ("B") }
}

And:

PREFIX up:<http://purl.uniprot.org/core/>
SELECT ?protein ?db ?method ?chain ?chainId
WHERE
{
    ?protein up:mnemonic 'PNP_ECOLI' .
    ?protein rdfs:seeAlso ?db .
    ?db up:method ?method .
    ?r rdf:subject ?protein .
    ?r rdf:predicate rdfs:seeAlso .
    ?r rdf:object ?db .
    ?r up:chain ?chain .
    VALUES (?chainId) {("A") ("B") }
    FILTER(regex(?chain, ?chainId))
}

Both gave me the expected result.

The problem with your original query is, as far as I can see, that you
are applying the VALUES clause outside the scope of the query pattern.

In SPARQL algebra, this constitutes a join on the result of the query
pattern and the data supplied by the VALUES clause. However, since
evaluation of the query pattern (notably, its filter clause) requires
that ?chainId has a value, and that value is not actually assigned until
after the join is executed, the query pattern fails.

HTH,

Jeen


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Sesame-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/sesame-general