WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

SPARQLConstruct[patterntemplate]

is a query operator that can be applied to an RDFStore , which returns an RDFStore generated from template, based on solutions of matching pattern.

SPARQLConstruct[pattern]

uses pattern as template.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
See Also
Related Guides
Cite this Page

SPARQLConstruct[patterntemplate]

is a query operator that can be applied to an RDFStore , which returns an RDFStore generated from template, based on solutions of matching pattern.

SPARQLConstruct[pattern]

uses pattern as template.

Details and Options

  • SPARQLConstruct can be used in SPARQLExecute to query a SPARQL endpoint.
  • The result of executing SPARQLConstruct[patterntemplate] is a RDFStore object containing for each solution the triples of template where variables have been replaced with values of this solution.
  • In SPARQLConstruct[pattern], pattern can take the same form as in SPARQLSelect [pattern].

Examples

open all close all

Basic Examples  (1)

Wolfram Language code: Needs["GraphStore`"]

Specify a graph of first and family names:

Wolfram Language code: foaf[s_] := URL["http://xmlns.com/foaf/0.1/" <> s]; ex[s_] := URL["http://example.org/" <> s];
Wolfram Language code: peopleGraph = RDFStore[{ RDFTriple[ex["tom"], foaf["firstName"], "Tom"], RDFTriple[ex["tom"], foaf["familyName"], "Smith"], RDFTriple[ex["alice"], foaf["firstName"], "Alice"], RDFTriple[ex["alice"], foaf["familyName"], "Meier"] }];

Construct a graph with only the family names:

Wolfram Language code: peopleGraph//SPARQLConstruct[RDFTriple[SPARQLVariable["person"], foaf["firstName"], SPARQLVariable["first"]]]

Scope  (1)

Wolfram Language code: Needs["GraphStore`"]

Retrieve a graph of cats and their names from Wikidata:

Wolfram Language code: rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s]; wikibase[s_] := URL["http://wikiba.se/ontology#" <> s]; bd[s_] := URL["http://www.bigdata.com/rdf#" <> s]; wd[s_] := URL["http://www.wikidata.org/entity/" <> s]; wdt[s_] := URL["http://www.wikidata.org/prop/direct/" <> s];
Wolfram Language code: SPARQLExecute[ "https://query.wikidata.org/sparql", SPARQLConstruct[{ RDFTriple[SPARQLVariable["item"], wdt["P31"], wd["Q146"]], SPARQLService[wikibase["label"], RDFTriple[bd["serviceParam"], wikibase["language"], "en"]] } -> RDFTriple[SPARQLVariable["item"], rdfs["label"], SPARQLVariable["itemLabel"]] ] ]
Wolfram Research (2019), SPARQLConstruct, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLConstruct.html.

Text

Wolfram Research (2019), SPARQLConstruct, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLConstruct.html.

CMS

Wolfram Language. 2019. "SPARQLConstruct." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLConstruct.html.

APA

Wolfram Language. (2019). SPARQLConstruct. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLConstruct.html

BibTeX

@misc{reference.wolfram_2026_sparqlconstruct, author="Wolfram Research", title="{SPARQLConstruct}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLConstruct.html}", note=[Accessed: 17-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_sparqlconstruct, organization={Wolfram Research}, title={SPARQLConstruct}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLConstruct.html}, note=[Accessed: 17-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /