无法正确处理 ARC2 中的 " PREFIX

Could not properly handle " PREFIX in ARC2

我尝试查询 ontology 中保存在 GraphDB Ontotext 中的数据。我使用 ARC2 作为远程存储端点,但得到的结果是我的查询无法处理前缀。我使用 Codeigniter 实现了它,在 ontology 中找到 Class 效果很好。但是这里我试图找到 2类 之间的距离。错误如下所示:

查询 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"]=> 对象(stdClass)#21 (0) { } ["inc_path"]=> 字符串(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]=> 字符串(43) "http://www.w3.org/1999/02/22-rdf-syntax-ns#" } ["ns"]=> 数组(1) { ["rdf"]=> 字符串(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 " 前缀地理: array(0) { } ["adjust_utf8"]=> int(0) ["max_errors"]=> int(25) ["has_pcre_unicode"]=> int(1) ["is_remote"]=> 整数(1) }

这是我的代码:

    $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);
    }

有没有人可以帮助我?

我得到了答案。因此,ARC2 上的 SPARQL 远程存储存在问题,因为它无法处理 SPARQL 1.1 查询,因此我们需要向其添加一些库。仅供参考 - 以下分支似乎添加了 SPARQL 1.1。远程端点功能。

文件:store/ARC2_SPARQL11RemoteStore.php 分叉自 https://github.com/stuartraetaylor/arc2-sparql11