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

Samples

Efimster edited this page May 17, 2014 · 2 revisions
query.Prefix("dc", "http://purl.org/dc/elements/1.1/")
     .Prefix("ns", "http://example.org/ns#")
     .Match("?x ns:price ?price").And("dc:title ?title")
     .Select("?title ?price")
     .OrderBy("desc(?price)")
     .AsEnumerable()
     .ToList();
query.Match(s: "?x", p: "foaf:name", o: "?name")
     .Optional(s: "?x", p: "foaf:mbox", o: "?mbox")
     .Select("?name ?mbox")
     .Prefix("foaf", "http://xmlns.com/foaf/0.1/")
     .AsEnumerable()
     .ToList();
query.Match("?x foaf:name  ?name")
     .Optional("?x foaf:mbox ?mbox")
     .Optional("?x foaf:homepage ?hpage")
     .Select("?name ?mbox ?hpage")
     .Prefix("foaf", "http://xmlns.com/foaf/0.1/")
     .AsEnumerable()
     .ToList();
            
query.Match("?x ns:price ?price").And(p: "dc:title", o: "?title")
     .Select("?title ?price")
     .OrderBy("desc(?price)")
     .Limit(1)
     .Offset(1)
     .Prefix("dc", "http://purl.org/dc/elements/1.1/")
     .Prefix("ns", "http://example.org/ns#")
     .AsEnumerable()
     .ToList();
query.Either("?book dc10:title  ?title").Or("?book dc11:title  ?title")
     .Select("?title")
     .AsEnumerable()
     .ToList();
query.Match("?P foaf:givenName ?G")
     .And(p: "foaf:surname", o: "?S")
     .Bind("CONCAT(?G, \" \", ?S)").As("?name")
     .Select("?name")
     .Prefix("foaf:", "http://xmlns.com/foaf/0.1/")
     .AsEnumerable()
     .ToList();
query.Match("?x dc:title ?title")
     .Optional("?x ns:price ?price")
         .FilterBy("?price > 30")
     .End()
     .Select("?title ?price")
     .Prefix("dc:", "http://purl.org/dc/elements/1.1/")
     .Prefix("ns:", "http://example.org/ns#")
     .AsEnumerable()
     .ToList();

see other examles within unit tests.

Clone this wiki locally