Sparql Filter Issue using IN

6 views
Skip to first unread message

Mark James

unread,
Jun 28, 2016, 10:57:09 PM6/28/16
to Stardog
Hi Guys,
We've encountered an issue where one of our automatically constructed queries (in a webservice) is returning incomplete results. We're not using any inferencing. The query mixes the xsd type's in an IN filter.

A simplified version is below -

SELECT ?s ?p ?o 
?s ?p ?o .
?s ?p1 ?o1 .
FILTER (
&& ((?o1 in ("Ongoing"^^xsd:string, "false"^^xsd:boolean)))
)
}
}

The query will only return triples relating to the first value in the IN filter highlighted in red. So in the example above for values where o1 = Ongoing. Swapping the order only returns triples with an o1 value of boolean false.

I'm assuming this is a bug? I didn't think there was anything in the sparql spec that suggest every value in an IN must be of the same type?

We're producing this on 4.0.5.

cheers
Mark

Pavel Klinov

unread,
Jun 29, 2016, 3:30:33 AM6/29/16
to sta...@clarkparsia.com
Mark,

You are correct that IN doesn't impose any restrictions on types of the expressions.

Any chance you can send us the data so that we can verify that 4.1.1 doesn't have this problem? 

Also if your queries are of this form, you may gain some performance improvements if you re-write them using VALUES (for ?p1, ?o1) rather than IN or even UNIONs if the number of constants is low. Optimizer in the latest Stardog already converts some of IN filters into VALUES but not (yet) in the presence of boolean connectives.

Best,
Pavel

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Mark James

unread,
Jun 29, 2016, 6:13:56 AM6/29/16
to sta...@clarkparsia.com
Thanks Pavel,
I hadn't considered using the values filter in this way.

Replacing the filter IN's with the following works. And it is faster to.

values (?p1 ?o1)
  {
    ( <http://acme.com/ontology/event/AtomicDismissed> "Ongoing"^^xsd:string )
    ( <http://acme.com/ontology/event/AtomicDismissed> "false"^^xsd:boolean )
    ( <http://acme.com/ontology/event/SituationStatus> "Ongoing"^^xsd:string )
    ( <http:/acme.com/ontology/event/SituationStatus> "false"^^xsd:boolean )
  }

I'll send some data and the original query to you shortly. It will be good to know if it is indeed fixed for 4.1.1.

cheers
Mark

---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.



--
Mark James | Smarta Systems Pty Ltd
+61 433 922 944mja...@smarta.io | smarta.io
Reply all
Reply to author
Forward
0 new messages