SPARQLService[url,patt]
represents a pattern that is matched on a SPARQL endpoint located at url.
SPARQLService
SPARQLService[url,patt]
represents a pattern that is matched on a SPARQL endpoint located at url.
Examples
Basic Examples (1)
Needs["GraphStore`"]rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s];
owl[s_] := URL["http://www.w3.org/2002/07/owl#" <> s];
wd[s_] := URL["http://www.wikidata.org/entity/" <> s];
wdt[s_] := URL["http://www.wikidata.org/prop/direct/" <> s];
ex[s_] := URL["http://example.org/" <> s];countryData = RDFStore[{
RDFTriple[ex["spain"], rdfs["label"], "Spain"],
RDFTriple[ex["spain"], owl["sameAs"], wd["Q29"]]
}];For all countries in the dataset look up the top-level domain (P78) in Wikidata:
countryData//SPARQLSelect[{
RDFTriple[SPARQLVariable["country"], rdfs["label"], SPARQLVariable["label"]],
RDFTriple[SPARQLVariable["country"], owl["sameAs"], SPARQLVariable["wditem"]],
SPARQLService["https://query.wikidata.org/sparql", {
RDFTriple[SPARQLVariable["wditem"], wdt["P78"], SPARQLVariable["tld"]]
}]
} -> {"label", "tld"}]Related Guides
Text
Wolfram Research (2019), SPARQLService, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLService.html.
CMS
Wolfram Language. 2019. "SPARQLService." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLService.html.
APA
Wolfram Language. (2019). SPARQLService. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLService.html
BibTeX
@misc{reference.wolfram_2026_sparqlservice, author="Wolfram Research", title="{SPARQLService}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLService.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sparqlservice, organization={Wolfram Research}, title={SPARQLService}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLService.html}, note=[Accessed: 13-June-2026]}