使用 sqarql 更新具有空白节点的三元组时出现问题
这是我的查询,此查询适用于没有空白节点的节点 但是在使用空白节点更新时出现了问题
这些节点在更新后会重复 100 次
DELETE {
it:4D9AT21jAasfL9ah schema:description ?o_0 .
it:4D9AT21jAasfL9ah it:hasArea ?o_1 .
?o_1 rdf:type ?o_1_0 . ?o_1 schema:unitCode ?o_1_1 .
?o_1 schema:value ?o_1_2 . ?o_1 schema:unitText ?o_1_3 .
it:4D9AT21jAasfL9ah it:unresolvedWikidataType ?o_2 .
it:4D9AT21jAasfL9ah schema:longitude ?o_3 .
it:4D9AT21jAasfL9ah schema:addressCountry ?o_4 .
it:4D9AT21jAasfL9ah rdfs:label ?o_5 .
it:4D9AT21jAasfL9ah rdf:type ?o_6 .
it:4D9AT21jAasfL9ah schema:url ?o_7 .
it:4D9AT21jAasfL9ah it:wikiLink ?o_8 .
}
INSERT {
it:4D9AT21jAasfL9ah schema:description 'city and capital of Bali, Indonesia' .
it:4D9AT21jAasfL9ah it:hasArea _:bQRrRFzX1zv9qUGWy .
_:bQRrRFzX1zv9qUGWy rdf:type schema:QuantitativeValue;
schema:unitCode 'KMK';
schema:value '123.98';
schema:unitText 'km²' .
it:4D9AT21jAasfL9ah it:unresolvedWikidataType 'Q3199141', 'Q13220204' .
it:4D9AT21jAasfL9ah schema:longitude '115.21666666667' .
it:4D9AT21jAasfL9ah schema:addressCountry it:WtC49aYLe8s0lsFC .
it:4D9AT21jAasfL9ah rdfs:label 'Denpasar' .
it:4D9AT21jAasfL9ah rdf:type schema:City .
it:4D9AT21jAasfL9ah schema:url <http://www.denpasarkota.go.id/> .
it:4D9AT21jAasfL9ah it:wikiLink <https://en.wikipedia.org/wiki/Denpasar> .
}
WHERE {
it:4D9AT21jAasfL9ah ?p ?o .
OPTIONAL { it:4D9AT21jAasfL9ah schema:description ?o_0 }
OPTIONAL { it:4D9AT21jAasfL9ah it:hasArea ?o_1 }
OPTIONAL { ?o_1 rdf:type ?o_1_0 }
OPTIONAL { ?o_1 schema:unitCode ?o_1_1 }
OPTIONAL { ?o_1 schema:value ?o_1_2 }
OPTIONAL { ?o_1 schema:unitText ?o_1_3 }
OPTIONAL { it:4D9AT21jAasfL9ah it:unresolvedWikidataType ?o_2 }
OPTIONAL { it:4D9AT21jAasfL9ah schema:longitude ?o_3 }
OPTIONAL { it:4D9AT21jAasfL9ah schema:addressCountry ?o_4 }
OPTIONAL { it:4D9AT21jAasfL9ah rdfs:label ?o_5 }
OPTIONAL { it:4D9AT21jAasfL9ah rdf:type ?o_6 }
OPTIONAL { it:4D9AT21jAasfL9ah schema:url ?o_7 }
OPTIONAL { it:4D9AT21jAasfL9ah it:wikiLink ?o_8 }
}
这是json格式的输出, 并且只有具有空白节点值的 hasArea 被重复多次
"schema:latitude": [
"-7.164444444444444"
],
"it:hasArea": [
{
"rdf:type": [
"schema:QuantitativeValue"
],
"schema:unitCode": [
"KMK"
],
"schema:value": [
"392.47"
],
"schema:unitText": [
"km²"
]
},
{
"rdf:type": [
"schema:QuantitativeValue"
],
"schema:unitCode": [
"KMK"
],
"schema:value": [
"392.47"
],
"schema:unitText": [
"km²"
]
},
{
"rdf:type": [
"schema:QuantitativeValue"
],
"schema:unitCode": [
"KMK"
],
"schema:value": [
"392.47"
],
"schema:unitText": [
"km²"
]
},...
],
"rdfs:label": [
"Denpasar"
],
...
提前致谢
This is my query, this query works fine for nodes with no blank node
but the issue with arrives while updating with blank nodehere those nodes get repeated 100 times after updating
DELETE {
it:4D9AT21jAasfL9ah schema:description ?o_0 .
it:4D9AT21jAasfL9ah it:hasArea ?o_1 .
?o_1 rdf:type ?o_1_0 . ?o_1 schema:unitCode ?o_1_1 .
?o_1 schema:value ?o_1_2 . ?o_1 schema:unitText ?o_1_3 .
it:4D9AT21jAasfL9ah it:unresolvedWikidataType ?o_2 .
it:4D9AT21jAasfL9ah schema:longitude ?o_3 .
it:4D9AT21jAasfL9ah schema:addressCountry ?o_4 .
it:4D9AT21jAasfL9ah rdfs:label ?o_5 .
it:4D9AT21jAasfL9ah rdf:type ?o_6 .
it:4D9AT21jAasfL9ah schema:url ?o_7 .
it:4D9AT21jAasfL9ah it:wikiLink ?o_8 .
}
INSERT {
it:4D9AT21jAasfL9ah schema:description 'city and capital of Bali, Indonesia' .
it:4D9AT21jAasfL9ah it:hasArea _:bQRrRFzX1zv9qUGWy .
_:bQRrRFzX1zv9qUGWy rdf:type schema:QuantitativeValue;
schema:unitCode 'KMK';
schema:value '123.98';
schema:unitText 'km²' .
it:4D9AT21jAasfL9ah it:unresolvedWikidataType 'Q3199141', 'Q13220204' .
it:4D9AT21jAasfL9ah schema:longitude '115.21666666667' .
it:4D9AT21jAasfL9ah schema:addressCountry it:WtC49aYLe8s0lsFC .
it:4D9AT21jAasfL9ah rdfs:label 'Denpasar' .
it:4D9AT21jAasfL9ah rdf:type schema:City .
it:4D9AT21jAasfL9ah schema:url <http://www.denpasarkota.go.id/> .
it:4D9AT21jAasfL9ah it:wikiLink <https://en.wikipedia.org/wiki/Denpasar> .
}
WHERE {
it:4D9AT21jAasfL9ah ?p ?o .
OPTIONAL { it:4D9AT21jAasfL9ah schema:description ?o_0 }
OPTIONAL { it:4D9AT21jAasfL9ah it:hasArea ?o_1 }
OPTIONAL { ?o_1 rdf:type ?o_1_0 }
OPTIONAL { ?o_1 schema:unitCode ?o_1_1 }
OPTIONAL { ?o_1 schema:value ?o_1_2 }
OPTIONAL { ?o_1 schema:unitText ?o_1_3 }
OPTIONAL { it:4D9AT21jAasfL9ah it:unresolvedWikidataType ?o_2 }
OPTIONAL { it:4D9AT21jAasfL9ah schema:longitude ?o_3 }
OPTIONAL { it:4D9AT21jAasfL9ah schema:addressCountry ?o_4 }
OPTIONAL { it:4D9AT21jAasfL9ah rdfs:label ?o_5 }
OPTIONAL { it:4D9AT21jAasfL9ah rdf:type ?o_6 }
OPTIONAL { it:4D9AT21jAasfL9ah schema:url ?o_7 }
OPTIONAL { it:4D9AT21jAasfL9ah it:wikiLink ?o_8 }
}
This is the output in json format,
and only hasArea which has blank node values is being repeated many times
"schema:latitude": [
"-7.164444444444444"
],
"it:hasArea": [
{
"rdf:type": [
"schema:QuantitativeValue"
],
"schema:unitCode": [
"KMK"
],
"schema:value": [
"392.47"
],
"schema:unitText": [
"km²"
]
},
{
"rdf:type": [
"schema:QuantitativeValue"
],
"schema:unitCode": [
"KMK"
],
"schema:value": [
"392.47"
],
"schema:unitText": [
"km²"
]
},
{
"rdf:type": [
"schema:QuantitativeValue"
],
"schema:unitCode": [
"KMK"
],
"schema:value": [
"392.47"
],
"schema:unitText": [
"km²"
]
},...
],
"rdfs:label": [
"Denpasar"
],
...
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论