问题描述
我在 OpenLink Virtuoso 上创建了一个端点 SPAQL.一切正常,但我必须访问容器中的数据,尤其是 rdf:Seq.
I have create an endpoint SPAQL on OpenLink Virtuoso.All work well, but i have to access on the data in a Container, in particular a rdf:Seq.
我有一个这样的序列:
<myrdf:has_stoptimes>
<rdf:Seq rdf:about="http://test.com/343">
<rdf:li>
<myrdf:StopTime rdf:about="http://test.com/StopTime/434">
...
</ns0:StopTime>
</rdf:li>
<rdf:li>
<myrdf:StopTime rdf:about="http://test.com/StopTime/435">
...
</ns0:StopTime>
</rdf:li>
</rdf:Seq>
现在我看到要访问容器中的数据,我可以使用 rdfs:member
或 FILTER (strstarts(str(?prop), str(rdf:_))
如何解释这里
Now i see that to access data in a container i can use rdfs:member
or FILTER (strstarts(str(?prop), str(rdf:_))
how is explained here
但是对于我的项目,我必须采用第一个解决方案,因为我正在使用 Silk 并且我将使用像 ?a/myrdf:has_stoptimes/rdfs:member
这样的代码语法,而不使用复杂"过滤器.
But for my project i have to adopt the first solution because i'm working with Silk and i will use the code syntax like ?a/myrdf:has_stoptimes/rdfs:member
without use of "complex" filter.
我试图遵循这个 guide 但查询端点没有任何作用我希望.
I have tried to follow this guide but querying the endpoint nothing work how i hoped.
所以我的问题是:如何在 Virtuoso 端点 SPARQL 上查询 ?a/myrdf:has_stoptimes/rdfs:member
?我必须在端点 SPARQL 中添加哪个推理规则?
So my question is: how can i query ?a/myrdf:has_stoptimes/rdfs:member
on a Virtuoso endpoint SPARQL?Which inference rule i have to add in endpoint SPARQL?
提前致谢
更新
我在 Virtuoso 中创建了以下推理规则:
I have created the following inference rules in Virtuoso:
ttlp (' @prefix rdfs: .
@prefix rdf: .
rdfs:Container rdf:type rdfs:Class ; rdfs:subClassOf rdfs:Resource .
rdfs:ContainerMembershipProperty a rdfs:Class ; rdfs:subClassOf rdf:Property .
rdf:Seq rdf:type rdfs:Class ; rdfs:subClassOf rdfs:Container .
rdfs:member rdf:type rdf:Property ; rdfs:domain rdfs:Resource ; rdfs:range rdfs:Resource .
', '', 'http://localhost:8890/schema/test') ;
查询 SPARQL 端点没有任何效果,例如:
Nothing work querying the SPARQL endpoint like:
define input:inference "http://localhost:8890/schema/property_rules1"
SELECT *
FROM
WHERE {?sep a rdf:Seq.
?seq rdfs:member ?p}
在我尝试将以下行添加到 ttl 文件后: rdf:_1 rdfs:subPropertyOf rdfs:member
.通过这种方式它可以工作,但显然结果仅适用于容器的第一个元素.所以为所有rdf:_n
添加一行是非常不方便的,我认为这只是一个临时解决方案,这是不正确的.
After i tried adding the follow line to the ttl file: rdf:_1 rdfs:subPropertyOf rdfs:member
. In this way it work but obviously the results are only for the first element of the container. So is very unconvenient add a line for all of rdf:_n
, and i think this is only a temporary solution, it is not correct.
如果我运行查询,我尝试在 SILK 2.6.1 和数据源的 SPARQL 部分添加 RDF 转储:
I have tried to add an RDF dump on SILK 2.6.1, and on the section SPARQL of the data source if i run the query:
SELECT *
FROM
WHERE {?sep a rdf:Seq.
?seq rdfs:member ?p}
我得到了正确的结果,没有指定任何推理规则.所以我认为在 SILK 的这个功能中,我的端点 SPARQL 中缺少一些东西,还是我在说废话?
I obtain the correct result, without specify any inference rules. So i think that in this functionality of SILK there is something that i’m missing in my endpoint SPARQL or am i saying nonsense things?
推荐答案
你不能在属性路径中使用变量,所以你实际上不能这样做
You can't use variables in property paths, so you can't actually do
?x ?a/has_stoptimes/rdfs:member ?y
相反,您必须在两者之间使用另一个变量或空白节点:
Instead, you have to use another variable or blank node in between:
?x ?a ?z . ?z has_stoptimes/rdfs:member ?y
?x ?a [ has_stoptimes/rdfs:member ?y ] .
这篇关于在端点 SPARQL 中添加 RDFS 推理规则支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!