%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}%
---+How Can I Use MODIFY to update triples?
The following queries are equivalent:
MODIFY
DELETE {?s ?p ?o}
INSERT {?s_new ?p ?o}
FROM
WHERE
{
{
SELECT iri(bif:replace(str(?s),"http://test.com/link","http://test.com/extra/link" ) )
AS ?s_new ?s ?p ?o
WHERE
{
?s ?p ?o FILTER (regex (str(?s), "http://test.com/link"))
}
}
}
MODIFY
DELETE {?s ?p ?o}
INSERT {`iri(?s_new)` ?p ?o}
FROM
WHERE
{
{
SELECT bif:replace(str(?s),"http://test.com/link","http://test.com/extra/link" )
AS ?s_new ?s ?p ?o
WHERE
{
?s ?p ?o FILTER (regex (str(?s), "http://test.com/link"))
}
}
}
MODIFY
DELETE {?s ?p ?o}
INSERT
{ `iri(bif:replace(str(?s),"http://test.com/link","http://test.com/extra/link" ))` ?p ?o }
FROM
WHERE
{
{
?s ?p ?o FILTER (regex (str(?s), "http://test.com/link"))
}
}
}
---++Related
* [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]
* [[http://docs.openlinksw.com/virtuoso/rdfsparql.html][Virtuoso Documentation]]