php – Could not properly handle " PREFIX in ARC2-ThrowExceptions

Exception or error:

I try to query data in the ontology which is saved in the GraphDB Ontotext. I use ARC2 as remote store end point, but I got the result that my query can’t handle Prefix. I implement it using Codeigniter and it worked fine to find Class inside ontology. But here I try to find the distance between 2 classes. The error shows below:

Query errorsArray ( [0] => Could not properly handle " PREFIX geo: NULL ["a"]=> array(1) { ["remote_store_endpoint"]=> string(46) "http://192.168.111.13:7200/repositories/GeoWeb" } ["caller"]=> object(stdClass)#21 (0) { } ["inc_path"]=> string(58) "C:\xampp\htdocs\SearchEngine\application\third_party\arc2/" ["ns_count"]=> int(0) ["nsp"]=> array(1) { ["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=> string(3) "rdf" } ["used_ns"]=> array(1) { [0]=> string(43) "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } ["ns"]=> array(1) { ["rdf"]=> string(43) "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } ["base"]=> string(55) "http://localhost/SearchEngine/testcontroller/find/tutu/" ["errors"]=> array(1) { [0]=> string(83) "Could not properly handle " PREFIX geo: array(0) { } ["adjust_utf8"]=> int(0) ["max_errors"]=> int(25) ["has_pcre_unicode"]=> int(1) ["is_remote"]=> int(1) }

This is my code:

    $coba = new ARC2();
    $config = array('remote_store_endpoint' => 'http://192.168.111.13:7200/repositories/GeoWeb');
    $store=$coba->getRemoteStore($config);
    $r = "  PREFIX geo:<http://www.semanticweb.org/user/ontologies/2019/6/GeoWeb-Ontology#>
    PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
    PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX owl:<http://www.w3.org/2002/07/owl#> 
    SELECT  ?individual ?ancestor
            ( count(distinct ?mid) as ?closest)
    WHERE {
            values ?individual {geo:$tokenizeword[$x]}
            values ?ancestor {geo:$values[6]}
            ?individual rdf:type+ ?mid.
            ?mid rdf:type* ?ancestor.
            }
            group by ?individual ?ancestor
            order by ?individual ?closest
    ";
    $rowr[] = $store->query($r, 'rowsr');
    if ($errs = $store->getErrors()) {
        echo "Query errors" ;
        print_r($errs);
    }

Is there anyone can help me?

How to solve:

I have gotten the answer. So, there is problem of SPARQL remote store on ARC2 because it can’t handle SPARQL 1.1 query, thus we need to add some library to it. FYI – The following forks seem to add SPARQL 1.1. remote endpoint feature.

file: store/ARC2_SPARQL11RemoteStore.php
forked from https://github.com/stuartraetaylor/arc2-sparql11

Leave a Reply

Your email address will not be published. Required fields are marked *