使用AllegroGraph 6.4.6
我正在尝试针对定义的四边形生成一个SPARQL DELETE查询:
// Example of dataset used for generation of SPARQL
const quads = [
['<1>','<2>','<3>'], // Graph: DEFAULT
['<a>','<b>','<c>','<d>'], // Graph: <d>
['<w>','<x>','<y>','<z>'], // Graph: <z>
]
/* Example of triples being queried against
S P O G
--- --- --- ---
<1> <2> <3>
<a> <b> <c> <d>
<w> <x> <y> <z> If we delete <1> <2> <3>, we don't
<1> <2> <3> <4> <-- want to accidentally delete this quad
*/
我能够生成SELECT查询以确定所有四边形的存在:
# Returns all specified quads that exist
SELECT ?s ?p ?o ?g
FROM DEFAULT
FROM NAMED <d>
FROM NAMED <z>
WHERE {
{
?s ?p ?o.
VALUES (?s ?p ?o) {
( <1> <2> <3> )
}
}
UNION
{
GRAPH ?g {?s ?p ?o.}
VALUES (?s ?p ?o ?g) {
( <a> <b> <c> <d> )
( <w> <x> <y> <z> )
}
}
}
VALUES
中指定的所有四边形><1> <2> <3> <4>
未返回。下一个查询是尝试创建DELETE查询,但是有一些问题(请注意Option 1
# Should delete all quads specified in VALUES
DELETE {
GRAPH ?g {?s ?p ?o.}
?sD ?pD ?oD.
}
# USING DEFAULT # Option 1
# USING NAMED <d> # Option 2
# USING NAMED <z> # Option 2
WHERE {
{
?sD ?pD ?oD.
VALUES (?sD ?pD ?oD) {
( <1> <2> <3> )
}
}
UNION
{
GRAPH ?g {?s ?p ?o.}
VALUES (?s ?p ?o ?g) {
( <a> <b> <c> <d> )
( <w> <x> <y> <z> )
}
}
}
仅使用Option 1注释,将返回错误消息:
Found DEFAULT. Was expecting one of: NAMED, Q_IRI_REF, QNAME, QNAME_NS.
仅使用选项2
DELETED:
S P O G
--- --- --- ---
<a> <b> <c> <d>
<w> <x> <y> <z>
同时带有选项1
<1> <2> <3> <4>
。DELETED:
S P O G
--- --- --- ---
<1> <2> <3>
<a> <b> <c> <d>
<w> <x> <y> <z>
<1> <2> <3> <4>
使用AllegroGraph 6.4.6,我正在尝试针对定义的四边形生成一个SPARQL DELETE查询://用于生成SPARQL const quads = [['<1>','<2&。 。
[FROM DEFAULT
表示默认图形不是标准的SPARQL功能,因此其行为将取决于您使用的三元存储(并且许多SPARQL引擎只会给出语法错误)。