我尝试查询保存在 GraphDB Ontotext 中的本体中的数据。我使用 ARC2 作为远程存储端点,但我得到的结果是我的查询无法处理前缀。我使用 Codeigniter 实现了它,它可以很好地在本体中找到 Class。但在这里我试图找到两个班级之间的距离。错误显示如下:
查询 errorsArray ( [0] => 无法正确处理 " 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) "不能正确处理" PREFIX geo: array(0) { } [ "adjust_utf8"]=> int(0) ["max_errors"]=> int(25) ["has_pcre_unicode"]=> int(1) ["is_remote"]=> int(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);
}
有没有人可以帮助我?