是否可以将这 2 个 SPARQL 更新查询合并为一个?
我想要执行更新以删除 RDF 存储中两个节点之间的链接(谓词)。该链接是双向的(skos:narrower 和 skos:broader)。我想进行一个唯一的查询,以确保在唯一的操作中删除两个链接。
目前,我正在使用这两个查询( ?term 和 ?parentTerm 都将在执行时与特定的 URI 绑定):
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
DELETE
WHERE{
GRAPH ?graph {
?term skos:broader ?parentTerm
}
}
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
DELETE
WHERE{
GRAPH ?graph {
?parentTerm skos:narrower ?term
}
}
有没有办法进行唯一的查询,而不改变其他链接(又名:谓词)谓词之间存在吗?
我厌倦了使用 ;分离查询,并将其作为单个命令发送到芝麻存储(就像您有时在 SQL 中所做的那样),但它不起作用。
I want to perform an update to remove the link (predicate) between two nodes in my RDF Store. The link is bidirectional (skos:narrower, and skos:broader). I would like to make a unique query, to insure both links are removed in a unique operation.
Currently, I'm using those 2 queries (both ?term and ?parentTerm will be bound with specific URIs at time of execution):
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
DELETE
WHERE{
GRAPH ?graph {
?term skos:broader ?parentTerm
}
}
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
DELETE
WHERE{
GRAPH ?graph {
?parentTerm skos:narrower ?term
}
}
Is there a way to make a unique query, and not alter other links (aka: predicates) that could exist between the predicates?
I tired using a ; to separate the queries, and sent it as a single command to the sesame store (as you sometimes do in SQL), but it did not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
遗憾的是,无法将其写为对上一个答案的评论...
您可以写
它更加冗长,因为您不能将 OPTIONAL 与 DELETE WHERE 一起使用,但它不应该显着降低效率。
请注意,您还可以使用 ; 分隔 SPARQL 更新操作。并在单个请求中发送它们,这应该会让您得到相同的行为。
Couldn't write this as a comment to the previous answer sadly...
You can write
It's a lot more verbose as you can't use OPTIONAL with DELETE WHERE, but it shouldn't be significantly less efficient.
Note, you can also separate SPARQL Update operations with a ; and send them in a single request, which should get you the same behaviour.
您可以将这两个三重模式合并到一个查询中:
请注意,这只会删除两者都存在的情况,但听起来您的数据就是这种情况。
You can combine both triple patterns into a single query:
Note that this will only delete these where both exist, but it sounds like that's the case in your data.