SPARQL queries with functions "contains" and "regex" don't work

462 views
Skip to first unread message

Christian Schwaderer

unread,
Apr 14, 2015, 10:46:27 AM4/14/15
to arc...@googlegroups.com
Hi there!

I've encountered a strange behaviour of ARC2.

I run a fuseki server and want to run sparql queries from a PHP application. I start the query the way the documentation demonstrates:

include_once("arc2/ARC2.php");
 $config
= array(
'remote_store_endpoint' => 'http://localhost:3030/my_dataset/query',
);
$store
= ARC2::getRemoteStore($config);
$results_as_array
= $store->query($query_string, 'rows');


So far, everything is alright. The problem starts when I use the SPARQL functions "contains" or "rand". For example this simple query:

PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#>

SELECT
?name

WHERE
{
 
?s rdfs:label ?name .
 FILTER
(contains(?name,"Richard"))
}

It doesn't work at all.

var_dump($results_as_array);

only results in "array(0) { } ".

The very same query works in the Fuseki webinterface and with the PHP libraries Easy RDF and RAP (RDF API for PHP).

It works again with ARC, as soon as I remove "contains" or replace it with "regex" or something else.

So, I'm quite sure this is a bug in ARC2.


Ryfa

unread,
Apr 14, 2015, 4:36:43 PM4/14/15
to arc...@googlegroups.com
Hi,

Contains is a primitive of sparql 1.1 and arc doesn't implemented it.

Christian Schwaderer

unread,
Apr 16, 2015, 7:15:18 AM4/16/15
to arc...@googlegroups.com
Just as an addition: As I said, the query with "contains" works with RAP (RDF API for PHP). I use version 0.9.6 which dates back from 2008-02-29, while SPARQL 1.1 became a W3C recommendation in March 2013. That means at least, that the SPARQL 1.1 elements do not necessarily cause problems if they are not supported by the API.

Christian Schwaderer

unread,
Apr 16, 2015, 7:15:18 AM4/16/15
to arc...@googlegroups.com
Thanks for the information.

But why are SPARQL 1.1 functions a problem here?
Maybe, I don't understand, what arc does. I thought, arc works just as a wrapper here and Fuseki (resp. ARQ) interprets the SPARQL query. So, I assumed, it doesn't matter whether arc has implemented SPARQL 1.1 or not.
Reply all
Reply to author
Forward
0 new messages