SPARQLOptional[patt]
represents part of a pattern that does not need to match in order for the whole pattern to match.
SPARQLOptional
SPARQLOptional[patt]
represents part of a pattern that does not need to match in order for the whole pattern to match.
更多信息和选项
- In SPARQLOptional[patt], patt can take the same form as in SPARQLSelect[patt].
范例
基本范例 (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"]]
}];Find the color and optionally the shape of fruits:
fruitGraph//SPARQLSelect[{
RDFTriple[SPARQLVariable["fruit"], schema["color"], SPARQLVariable["color"]],
SPARQLOptional[RDFTriple[SPARQLVariable["fruit"], ex["shape"], SPARQLVariable["shape"]]]
}]文本
Wolfram Research (2019),SPARQLOptional,Wolfram 语言函数,https://reference.wolfram.com/language/GraphStore/ref/SPARQLOptional.html.
CMS
Wolfram 语言. 2019. "SPARQLOptional." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLOptional.html.
APA
Wolfram 语言. (2019). SPARQLOptional. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/GraphStore/ref/SPARQLOptional.html 年
BibTeX
@misc{reference.wolfram_2026_sparqloptional, author="Wolfram Research", title="{SPARQLOptional}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLOptional.html}", note=[Accessed: 19-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_sparqloptional, organization={Wolfram Research}, title={SPARQLOptional}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLOptional.html}, note=[Accessed: 19-August-2026]}