Sparql query delete all statements

喜你入骨 提交于 2019-12-14 02:15:33

问题


I would like to delete all statements related to an object that contains certain characters in the label. I am using the query:

DELETE
{?term ?p ?o}
WHERE
{
?term rdfs:label ?label.
FILTER(regex(?label, "xx", "i"))
?term ?p ?o.
}

However, this query seems to fail to delete all the statements that contain the subject of this statement as object. Then I seem to need another query.

DELETE
{?s ?p ?term}
WHERE
{
?term rdfs:label ?label.
FILTER(regex(?label, "xx", "i"))
?s ?p ?term.
}

The SELECT * does not seem to work for DELETE, and I have also tried to model a UNION within DELETE with no success. Could you please point me to the solution? Many thanks.


回答1:


try this. it worked for me both for insert and delete

DELETE
{?term ?p ?o}
WHERE
{
 SELECT ?term ?p ?o
 WHERE{
   ?term rdfs:label ?label.
   FILTER(regex(?label, "xx", "i"))
 }
}


来源:https://stackoverflow.com/questions/11456102/sparql-query-delete-all-statements

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!