Virtuoso Open-Source Edition

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksGuideModifyUsageAsInsert(Last) -- DAVWikiAdmin? , 2017-06-13 05:49:04 Edit WebDAV System Administrator 2017-06-13 05:49:04

    How Can I Use MODIFY to update triples?

    The following queries are equivalent:

    MODIFY <http://test.com/>
    DELETE {?s ?p ?o}
    INSERT {?s_new ?p ?o}
    FROM <http://test.com/>
    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 <http://test.com/>
    DELETE {?s ?p ?o}
    INSERT {`iri(?s_new)` ?p ?o}
    FROM <http://test.com/>
    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 <http://test.com/>
    DELETE {?s ?p ?o}
    INSERT
      { `iri(bif:replace(str(?s),"http://test.com/link","http://test.com/extra/link" ))`  ?p ?o }
    FROM <http://test.com/>  
    WHERE
      {
        {
          ?s ?p ?o FILTER (regex (str(?s), "http://test.com/link"))
        }
      }
    }
    

    Related