Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Update Datasets

Efimster edited this page Mar 24, 2014 · 1 revision

The INSERT/DELETE command in SPARQL Update allows the dataset to be specified in several ways: The WITH clause specifies a default graph for the INSERT and DELETE portions of the query The USING clauses specifies the graphs that form the default graph for the WHERE portion of the update. If there are no USING clauses the WITH clause specifies the default graph, if there is no WITH then the default graph is dataset specific. The USING NAMED clause specifies the named graphs for the WHERE portion of the update and may be accessed using a GRAPH clause in your query.

Samples:

var res = query.Using("ns:g1")
         .Match("?person foaf:givenName Bill")
         .With("ns:g1")
            .Delete().Match("?person foaf:givenName Bill")
            .Insert().Match("?person foaf:givenName William")
         .Prefix("foaf", "http://xmlns.com/foaf/0.1/")
         .Prefix("ns", "http://example.org/ns#")
         .ExecuteUpdate();
res = query.UsingNamed("ns:g2")
      .Graph("?g")
          .Match("?person foaf:givenName Bill")
      .End()
      .With("ns:g2")
        .Delete().Match("?person foaf:givenName Bill")
        .Insert().Match("?person foaf:givenName Ben")
      .Prefix("foaf", "http://xmlns.com/foaf/0.1/")
      .Prefix("ns", "http://example.org/ns#")
      .ExecuteUpdate();

Clone this wiki locally