SPARQL查询,它在DBpedia端点中工作,但不在ARC2中工作(A SPARQL query that works in the DBpedia endpoint but not with AR

编程入门 行业动态 更新时间:2024-10-22 12:24:10
SPARQL查询,它在DBpedia端点中工作,但不在ARC2中工作(A SPARQL query that works in the DBpedia endpoint but not with ARC2)

查询如下:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT distinct ?value from <http://fr.dbpedia.org> WHERE{ ?sub rdfs:label ?value. FILTER (CONTAINS(LCASE(?value), 'data')). } limit 10

它使用DBpedia端点工作得非常好但是当我尝试使用ARC2从PHP使用它时,我收到以下错误:

查询errorsArray([0] => ARC2_SPARQLPlusParser中的不完整FILTER [1] =>组图模式不完整或无效。无法处理ARC2_SPARQLPlusParser中的“”)

任何想法可能是什么问题? 谢谢!

the query is the following :

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT distinct ?value from <http://fr.dbpedia.org> WHERE{ ?sub rdfs:label ?value. FILTER (CONTAINS(LCASE(?value), 'data')). } limit 10

it works perfectly fine using the DBpedia endpoint but when I try to use it from PHP using ARC2 I get the following error :

Query errorsArray ( [0] => Incomplete FILTER in ARC2_SPARQLPlusParser [ 1] => Incomplete or invalid Group Graph pattern. Could not handle " " in ARC2_SPARQLPlusParser )

Any ideas what could be the problem ? thank's!

最满意答案

ARC2不支持完整的SPARQL 1.1(请参阅源代码 ),因此不支持CONTAINS 。 您可以尝试使用REGEX :

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

SELECT distinct ?value
    from <http://fr.dbpedia.org>
    WHERE{                                          

        ?sub rdfs:label ?value.                     
                    FILTER (REGEX(STR(?value), 'data', 'i')).                                                           
        }

limit 10  

ARC2 does not support full SPARQL 1.1 (see the source code), thus, CONTAINS is not supported. You can try to use REGEX instead:

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

SELECT distinct ?value
    from <http://fr.dbpedia.org>
    WHERE{                                          

        ?sub rdfs:label ?value.                     
                    FILTER (REGEX(STR(?value), 'data', 'i')).                                                           
        }

limit 10  

                    
                     
          

更多推荐

本文发布于:2023-08-04 14:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417684.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   它在   DBpedia   SPARQL   endpoint

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!