在不使用属性路径序列sparql的地方删除

问题描述 投票:1回答:2

这些是已经存在的三胞胎。

<http:o1>   <http:name>   "name"^^xsd:string
<http:o1>   <http:place>   "place"^^xsd:string
<http:o1>   <http:hasContained>   <http:o2>
<http:o2>   <http:name>   "name1"^^xsd:string
<http:o2>   <http:place>   "place2"^^xsd:string
<http:o2>   <http:hasContained>   <http:o3>
<http:o3>   <http:name>   "name3"^^xsd:string
<http:o3>   <http:place>   "place3"^^xsd:string

我要删除距离o1节点2个节点的节点属性。

delete where { <http:o1> <http:hasContained>/<http:hasContained> ?s. ?s ?p ?o}

我想出了这个查询来删除与o3节点相关的三元组。但是,当我运行此查询时,出现了一些错误。

Malformed query: Encountered " "/" "/ "" at line 1, column 731.
Was expecting one of:
    "(" ...
    "[" ...
    <NIL> ...
    <ANON> ...
    "true" ...
    "false" ...
    <Q_IRI_REF> ...
    <PNAME_NS> ...
    <PNAME_LN> ...
    <BLANK_NODE_LABEL> ...
    <VAR1> ...
    <VAR2> ...
    <INTEGER> ...
    <INTEGER_POSITIVE> ...
    <INTEGER_NEGATIVE> ...
    <DECIMAL> ...
    <DECIMAL_POSITIVE> ...
    <DECIMAL_NEGATIVE> ...
    <DOUBLE> ...
    <DOUBLE_POSITIVE> ...
    <DOUBLE_NEGATIVE> ...
    <STRING_LITERAL1> ...
    <STRING_LITERAL2> ...
    <STRING_LITERAL_LONG1> ...
    <STRING_LITERAL_LONG2> ... 

[通过一些替代查询,我可以完成这项工作。

但是上述查询有什么错误?

为什么路径属性查询不能在哪里删除?

对于相同的三元组数据,删除所有使用的三元组的查询是

delete {?s ?p ?o} where { <http:o1> (<http:hasContained>/<http:hasContained>?)? ?s. ?s ?p ?o}

这不会从三元组存储中删除任何数据。而通过使用构造,我能够使用相同的where子句检索数据。

construct {?s ?p ?o} where { <http:o1> (<http:hasContained>/<http:hasContained>?)? ?s. ?s ?p ?o}

这些查询中的问题是什么,我缺少什么吗?

sparql amazon-neptune rdf4j
2个回答
0
投票

我们一直在审查此SPARQL Spec.。您可以验证以下版本是否适合您吗?

  delete { <http:o1> <http:hasContained>/<http:hasContained> ?s. ?s ?p ?o} where { <http:o1> <http:hasContained>/<http:hasContained> ?s. ?s ?p ?o}

0
投票

根据我对SPARQL语法的理解,DELETE WHERE ...速记不允许属性路径。但是,完整形式的DELETE ... WHERE ...可以工作,因此您可以执行以下操作:

© www.soinside.com 2019 - 2024. All rights reserved.