简体   繁体   English

如何使用模式过滤sparql查询结果?

[英]How to filter sparql query result with a pattern?

When trying to filter a sparql result in MarkLogic with the following pattern, 当尝试使用以下模式在MarkLogic中过滤sparql结果时,

SELECT ...
WHERE
{
    ...
    FILTER ( EXISTS { ?parent <http://www.w3.org/2004/02/skos/core#broader>+ ?root } )
}

I get the following error: 我收到以下错误:

[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected {, expecting (
Stack Trace

At line 17 column 19:
In xxxx
17. FILTER ( EXISTS { ?parent <http://www.w3.org/2004/02/skos/core#broader>+ ?root } )

Does MarkLogic not support Sparql 1.1 syntax or is my query incorrect? MarkLogic不支持Sparql 1.1语法还是我的查询不正确?

I tried the following as well: 我也尝试了以下方法:

FILTER EXISTS { ?parent <http://www.w3.org/2004/02/skos/core#broader>+ ?root } 

And the error message is: 错误消息是:

[1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, unexpected {, expecting (

There is currently a request for enhancement for this specific case at MarkLogic. 当前,MarkLogic要求对此特定情况进行增强。 An updated version of MarkLogic is forthcoming that has it corrected in it. MarkLogic的更新版本即将发布,并且已对其进行了更正。 Contact your MarkLogic SE or AE, they can point you further to the timeframe and other information. 请与您的MarkLogic SE或AE联系,他们可以为您提供进一步的时间表和其他信息。

You can use a regex expression if you for specific patterns 如果您要使用特定模式,则可以使用正则表达式

Example if your query is something like this: 例如,如果您的查询是这样的:

 SELECT ?subject ?term
 WHERE {
 ?subject <http://www.smartlogic.com/schemas/docinfo.rdf#tagged_with> ?term 
 FILTER regex(?term, "red", "i" )
 }

where "i" is for case insensitivity. 其中“ i”表示不区分大小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM