This repository was archived by the owner on Feb 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Efimster edited this page Jan 22, 2014
·
3 revisions
IEnumerable<dynamic> list = dyno.Select(
projection: "?s ?o",
where: SPARQL.Triple(s: "?s", p: "cp:boolean", o: "?o")
);
IEnumerable<dynamic> list = dyno.Select(
prefixes: new[] {
SPARQL.Prefix("dc:", "http://purl.org/dc/elements/1.1/"),//prefix could be used with colon
SPARQL.Prefix("ns", "http://example.org/ns#")//or without colon
},
projection: "?title ?price",
where: SPARQL.Group(
SPARQL.Triple("?x dc:title ?title"),
SPARQL.Optional(
SPARQL.Triple("?x ns:price ?price"),
SPARQL.Filter("?price < 30"))
)
);
IEnumerable<dynamic> list = dyno.Select(
prefixes: new[] {
SPARQL.Prefix("foaf:", "http://xmlns.com/foaf/0.1/"),
SPARQL.Prefix("rdf:","http://www.w3.org/1999/02/22-rdf-syntax-ns#")
},
projection: "?person",
where: SPARQL.Group(
SPARQL.Triple("?person rdf:type foaf:Person"),
SPARQL.Exists("?person foaf:name ?name")
)
);
IEnumerable<dynamic> list = dyno.Select(
prefixes: new[] {
SPARQL.Prefix("dc10", "http://purl.org/dc/elements/1.0/"),
SPARQL.Prefix("dc11", "http://purl.org/dc/elements/1.1/")
},
projection: "?title",
where: SPARQL.Group(
SPARQL.Union(left: SPARQL.Triple("?book dc10:title ?title"), right: SPARQL.Triple("?book dc11:title ?title"))
)
);
IEnumerable<dynamic> list = dyno.Select(
prefixes: new[] {
SPARQL.Prefix("dc10", "http://purl.org/dc/elements/1.0/"),
SPARQL.Prefix("dc11", "http://purl.org/dc/elements/1.1/")
},
projection: "?title ?author",
where: SPARQL.Group(
SPARQL.Union(
left: SPARQL.Group(SPARQL.Triple("?book dc10:title ?title"), SPARQL.Triple("?book dc10:creator ?author")),
right: SPARQL.Group(SPARQL.Triple("?book dc11:title ?title"), SPARQL.Triple("?book dc11:creator ?author"))
)
)
);
see other examples in source code unit tests.