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

Merging

Efimster edited this page May 17, 2014 · 4 revisions

There is an ability to merge queries:

ISPARQLQueryable source = new SPARQLQuery(dyno);

var query = source
         .Match("?w1 ?w2 ?w3")
      .Insert()
         .Match("?i1 ?i2 ?i3")
      .Delete()
         .Match("?d1 ?d2 ?d3")
           .And("?d4 ?d5");
var query2 = source
         .Match("?w4 ?w5 ?w6")
           .And("?w7 ?w8")
         .Delete()
           .Match("?d6 ?d7 ?d8")
         .Insert()
           .Match("?i4 ?i5 ?i6");
 
ISPARQLQueryable<T> mergedQuery = query.Merge(query2);

The result of merging queries in the example above is the same as it would be with following single query counterpart:

ISPARQLQueryable source = new SPARQLQuery(dyno);
var mergedQueryCounterpart = source
         .Match("?w1 ?w2 ?w3")
         .Match("?w4 ?w5 ?w6")
           .And("?w7 ?w8")
      .Insert()
         .Match("?i1 ?i2 ?i3")
         .Match("?i4 ?i5 ?i6")
      .Delete()
         .Match("?d1 ?d2 ?d3")
           .And("?d4 ?d5")
         .Match("?d6 ?d7 ?d8");

Clone this wiki locally