On 14/09/16 11:32, Rob Vesse wrote:
Andy

I am a little surprised at the filter equality transformation being
applied to this query. Variables in question are only used in the
object position so shouldn’t be safe to assume that value equality is
equivalent to term equality here. Or is this a special case because
of the change in handling of plain literals in RDF 1.1?

Yes, this is a case that is enabled by RDF 1.1,

FILTER (?object = "abc") can used to be a pattern match and term and value equality are equivalent.

sameTerm("abc", "abc"^^xsd:string) was false (RDF 1.0), and is now true (RDF 1.1).

    Andy


Rob

 14/09/2016 10:57, "Andy Seaborne" <a...@apache.org> wrote:

    Hi Paul,

    It's difficult to tell what's going on from your report. Plain strings
    are not quite identical in RDF 1.0 and RDF 1.1 so I hope you have
    related the data for running Jena 3.x.

    On less data, does either case produce the wrong answers?

    The regex is not being pushed inwards in the same way which may be an
    issue - it "all depends" on the data.

    A smaller query exhibiting a timing difference would be very helpful.
    Are all parts of the FILTER necessary for the effect?

        Andy

    Unrelated:

    {
    ?var1 :p3 ?var4 .
    } UNION {
    ?var1 :p4 ?var4 .
    }

    can be written

    ?var1 (:p3|:p4) ?var4


    On 14/09/16 02:01, Paul Tyson wrote:
    > I have some queries that worked fine in jena-2.13.0 but not in
    > jena-3.1.0, using the same data.
    >
    > For a long time I've been running a couple dozen queries regularly over
    > a large (900M triples) TDB, using jena-2.13.0. When I recently upgraded
    > to jena-3.1.0, I found that 5 of these queries would not return (ran
    > forever). qparse revealed that the sparql algebra is quite different in
    > 2.13.0 and 3.1.0 (or apparently any 3.n.n version).
    >
    > Here is a sample query that worked in 2.13.0 but not in 3.1.0, along
    > with the algebra given by qparse --explain for 2.13.0 and 3.1.0:
    >
    > prefix : <http://example.org>
    > CONSTRUCT {
    > ?var1 <http://www.w3.org/2004/02/skos/core#exactMatch> ?var2 .
    > }
    > WHERE {
    > FILTER (((?var3 = "str1" || ?var3 = "str2") && !(?var4 = "" || ?var4 =
    > "str3" || regex(?var4,"pat1"))))
    > ?var2 :p1 ?var4 ; :p2 ?var3 .
    > {{
    > ?var1 :p3 ?var4 .
    > } UNION {
    > ?var1 :p4 ?var4 .
    > }}
    > }
    >
    > Jena-2.13.0 produces algebra:
    > (prefix ((: <http://example.org>))
    >   (sequence
    >     (filter (|| (= ?var3 "str1") (= ?var3 "str2"))
    >       (sequence
    >         (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
    > "pat1")))
    >           (bgp (triple ?var2 :p1 ?var4)))
    >         (bgp (triple ?var2 :p2 ?var3))))
    >     (union
    >       (bgp (triple ?var1 :p3 ?var4))
    >       (bgp (triple ?var1 :p4 ?var4)))))
    >
    > Jena-3.1.0 produces algebra:
    > (prefix ((: <http://example.org>))
    >   (filter (! (|| (|| (= ?var4 "") (= ?var4 "str3")) (regex ?var4
    > "pat1")))
    >     (disjunction
    >       (assign ((?var3 "str1"))
    >         (sequence
    >           (bgp
    >             (triple ?var2 :p1 ?var4)
    >             (triple ?var2 :p2 "str1")
    >           )
    >           (union
    >             (bgp (triple ?var1 :p3 ?var4))
    >             (bgp (triple ?var1 :p4 ?var4)))))
    >       (assign ((?var3 "str2"))
    >         (sequence
    >           (bgp
    >             (triple ?var2 :p1 ?var4)
    >             (triple ?var2 :p2 "str2")
    >           )
    >           (union
    >             (bgp (triple ?var1 :p3 ?var4))
    >             (bgp (triple ?var1 :p4 ?var4))))))))
    >
    > Thanks for any insight or assistance into this problem.
    >
    > Regards,
    > --Paul
    >





Reply via email to