SPARQLAsk
詳細とオプション
- SPARQLExecuteでSPARQLAskを使ってSPARQL Endpointのクエリを行うことができる.
- SPARQLAsk[pattern]を実行した結果は,pattern にマッチする部分グラフがある場合はTrueでそれ以外の場合はFalseある.
- SPARQLAsk[pattern]の pattern はSPARQLSelect[pattern]内におけるのと同じ形を取ることができる.
例題
すべて開く すべて閉じる例 (1)
Needs["GraphStore`"]schema[s_] := URL["http://schema.org/" <> s];
ex[s_] := URL["http://example.org/" <> s];fruitGraph = RDFStore[{
RDFTriple[ex["banana"], schema["color"], "yellow"],
RDFTriple[ex["strawberry"], schema["color"], "red"],
RDFTriple[ex["strawberry"], ex["shape"], ex["round"]]
}];fruitGraph//SPARQLAsk[{
RDFTriple[SPARQLVariable["fruit"], schema["color"], "red"],
RDFTriple[SPARQLVariable["fruit"], ex["shape"], ex["rectangular"]]
}]fruitGraph//SPARQLAsk[{
RDFTriple[SPARQLVariable["fruit"], schema["color"], "red"],
RDFTriple[SPARQLVariable["fruit"], ex["shape"], ex["round"]]
}]スコープ (1)
Needs["GraphStore`"]"Albert Einstein"というドイツ語のラベルがついた人間 (Q5) がいるかどうかWikidataに尋ねる:
rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s];
wd[s_] := URL["http://www.wikidata.org/entity/" <> s];
wdt[s_] := URL["http://www.wikidata.org/prop/direct/" <> s];SPARQLExecute[
"https://query.wikidata.org/sparql",
SPARQLAsk[{
RDFTriple[SPARQLVariable["human"], wdt["P31"], wd["Q5"]],
RDFTriple[SPARQLVariable["human"], rdfs["label"], RDFString["Albert Einstein", "de"]]
}]
]関連するガイド
テキスト
Wolfram Research (2019), SPARQLAsk, Wolfram言語関数, https://reference.wolfram.com/language/GraphStore/ref/SPARQLAsk.html.
CMS
Wolfram Language. 2019. "SPARQLAsk." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLAsk.html.
APA
Wolfram Language. (2019). SPARQLAsk. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLAsk.html
BibTeX
@misc{reference.wolfram_2026_sparqlask, author="Wolfram Research", title="{SPARQLAsk}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLAsk.html}", note=[Accessed: 17-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_sparqlask, organization={Wolfram Research}, title={SPARQLAsk}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLAsk.html}, note=[Accessed: 17-August-2026]}