【问题标题】:SPARQL 1.1 wildcard paths in Virtuoso 7.2Virtuoso 7.2 中的 SPARQL 1.1 通配符路径
【发布时间】:2015-10-16 16:00:57
【问题描述】:

我有a question regarding deletion of triples and their related subproperties with SPARQL that has been answered successfully here

带有通配符路径的解决方案非常好,并且完全符合我的需要,但它不适用于我的 Virtuoso 7.2 安装(它不会删除任何内容)。我有一个额外的 Jena/Fuseki 测试安装,其中成功执行了查询。现在我的问题是:有谁知道 Virtuoso 是否不支持这个带有通配符路径的查询,如果是这种情况,是否有任何替代解决方案?

在最后一个答案中,还有另一个链接示例来检查两个实体之间是否存在路径。这也适用于 Jena/Fuseki,但即使绝对没有关系,Virtuoso 也总是返回 true。

由于我没有找到任何关于 Virtuosos 能力的信息,并且我不允许在官方论坛上发帖,我希望我能找到可以回答我的问题的人。

编辑:

@prefix xy: <http://purl.oclc.org/NET/xy/xy#> .
@prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#> .
@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .

<http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> a xy:Point ;
    xy:value "10" ;
    ssn:observationResultTime <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> ;
    ssn:observationSamplingTime <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> ;
    ssn:observedBy <http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> .

<http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> a tl:Instant ;
    tl:at "2014-08-01T10:05:00" .

<http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> a ssn:Sensor .

<http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> a tl:Instant ;
    tl:at "2014-08-01T10:05:00" .


@prefix xy: <http://purl.oclc.org/NET/xy/xy#> .
@prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#> .
@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .

<http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> a xy:Point ;
    xy:value "10" ;
    ssn:observationResultTime <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> ;
    ssn:observationSamplingTime <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> ;
    ssn:observedBy <http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> .

<http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> a tl:Instant ;
    tl:at "2014-08-01T10:10:00" .

<http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> a ssn:Sensor .

<http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> a tl:Instant ;
    tl:at "2014-08-01T10:10:00" .

这是我的测试图。在 Virtuoso (Version: 07.20.3212, Build: Feb 23 2015) 和 Apache Jena Fuseki (Version 2.3.0) 中也是如此。

第一个查询:

ASK {GRAPH <http://ict-citypulse.eu/store/testGraph2>{
  <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> ((<>|!<>)|^(<>|!<>))* <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> . 
}}

在 Virtuoso 中,即使我将其中一个名称更改为不存在的名称,此查询每次都会返回“true”。在 Fuseki 中,它按预期工作,如果我更改名称,则返回“true/false”。

第二个查询,正是我需要的(如果我将其更改为删除):

select *
where {
  GRAPH <http://ict-citypulse.eu/store/testGraph2> {
    <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> (<>|!<>)* ?s . 
    ?s ?p ?o .
  }
}

在 Virtuoso 上,此查询不返回任何内容。在 Fuseki 中,它正好返回 10 个三元组,这是已提交的图之一。

我希望这有助于解释我的问题。感谢您的帮助!

编辑: 我现在已经尝试使用最新的 Virtuoso 构建 (Version: 07.20.3214, Build: Oct 20 2015) 进行查询。我尝试了稳定版和开发版。两者都有与上述相同的行为。以下是插入我的测试数据的查询,如果这有助于您重放问题:

INSERT DATA INTO GRAPH <http://ict-citypulse.eu/store/testGraph2> {<http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/xy/xy#Point> . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/ssnx/ssn#observationResultTime> <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/xy/xy#value> "10" . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/ssnx/ssn#observationSamplingTime> <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> . <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:05:00" . <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:05:00" . <http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/ssnx/ssn#Sensor> .   <http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/ssnx/ssn#Sensor> . <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:10:00" . <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:10:00" . <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/xy/xy#value> "10" . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/ssnx/ssn#observationSamplingTime> <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/xy/xy#Point> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/ssnx/ssn#observationResultTime> <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> .  }

我已经交换了上述查询中的 URI 以匹配插入查询。

【问题讨论】:

  • 您也可以尝试在通配符中使用“真实”IRI 而不是&lt;&gt;。例如,做(ex:foo|!ex:foo)*。另外,如果您可以保证某些属性,例如ex:neverUsedProperrty,您可以只做ex:neverUsedProperty*
  • 你读过relevant Virtuoso documentation吗?您正在运行最新的 Virtuoso 7.2.1 吗? (另外,商业或开源?)我不知道您所说的“不允许在官方论坛上发帖”是什么意思……您是指Virtuoso users mailing listpublic support forums 还是其他地方? (obDisclaimer:我为 OpenLink Software 工作。)
  • 另外——如果您在此处包含适用于 Jena/Fuseki 并且对 Virtuoso 无效的确切查询,它将帮助我们帮助您。如果您可以针对公共 Virtuoso 端点(例如,DBpediaURIburnerLOD Cloud Cache)证明问题,那通常非常有帮助。
  • 我还注意到——您同时引用了 Virtuoso 7.1 和 7.2——请更正不正确的地方。它通常有助于提供完整的版本字符串(来自virtuoso -? 命令),包括“截至”日期。

标签: sparql virtuoso


【解决方案1】:

我们研究团队的一名成员发现了一个有效的 Virtuoso 特定解决方案:

prefix : <http://test.com/>

select *
where {
  {
    <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> (!:)* ?s .
    ?s ?p ?o .
  }
}

也许这可能对其他人有所帮助。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-14
  • 1970-01-01
相关资源
最近更新 更多