SPARQLSelect
SPARQLSelect[pattern]
is a query operator that can be applied to an RDFStore, which returns a list of associations of variables to corresponding values in subgraphs that match pattern.
SPARQLSelect[patternvars]
returns values only for the variables vars.
Details and Options
- SPARQLSelect can be used in SPARQLExecute to query a SPARQL endpoint.
- The result of executing SPARQLSelect[pattern] is a list of associations {<"var1"val1,1,… >,…} where each "vari" is the name of a SPARQLVariable appearing in pattern and each vali,j is the value appearing in the corresponding position of a matching subgraph.
- In SPARQLSelect[pattern], pattern can be any of the following forms:
-
RDFTriple[s,p,o] triple pattern {RDFTriple[…],RDFTriple[…],…} basic graph pattern {patt1,patt2,…} group graph pattern SPARQLFilter[expr] filter solutions of surrounding patterns by expr patt/;expr filter solutions by expr SPARQLOptional[patt] optional pattern patt1patt2 ... union pattern Except[patt] eliminate solutions which are compatible with patt SPARQLPropertyPath[…] property path pattern "var"expr bind expression expr to a variable with name "var" SPARQLValues[vars, values] specify values for variables SPARQLSelect[patt] subquery SPARQLGraph[g,patt] match patt agains the graph with name g SPARQLService[url,patt] federate matching patt to the SPARQL endpoint located at url - In a triple pattern RDFTriple[s,p,o] a SPARQLVariable stands for any expression.
- The following options can be given:
-
"Distinct" False whether duplicate solutions are deleted "Limit" Infinity maximum numer of solutions to return "Offset" 0 number of solutions to skip "OrderBy" None expression by which solutions are ordered "Reduced" False whether duplicate solutions can be deleted
Examples
open allclose allBasic Examples (2)
Scope (9)
Triple Pattern (1)
Basic Graph Pattern (1)
A basic graph pattern is a list of triple patterns. Retrieve "title" and "created" of all articles:
Variables and literals can appear in any position. Find authors of articles created in 2018:
Different triple patterns in a basic graph pattern are not required to match different triples in a graph. The following contains solutions binding "art1" and "art2" to the same article:
To find authors that have published more than one article filter the solution by requiring "art1" and "art2" to be different:
Optional (1)
Find the name and optionally the e-mail address of all people:
When the SPARQLOptional wrapper is omitted the solution for "Bob" is missing:
Union (1)
Negation (1)
Assignment (1)
Neat Examples (1)
Make a Graph of parent taxons (P171) of the Whale (Q42196) using Wikidata:
Text
Wolfram Research (2019), SPARQLSelect, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLSelect.html.
CMS
Wolfram Language. 2019. "SPARQLSelect." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLSelect.html.
APA
Wolfram Language. (2019). SPARQLSelect. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLSelect.html