WOLFRAM

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

SPARQLOptional[patt]

represents part of a pattern that does not need to match in order for the whole pattern to match.

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

SPARQLOptional[patt]

represents part of a pattern that does not need to match in order for the whole pattern to match.

Details and Options

  • In SPARQLOptional[patt], patt can take the same form as in SPARQLSelect [patt].

Examples

Basic Examples  (1)

Wolfram Language code: Needs["GraphStore`"]

Data about fruits:

Wolfram Language code: schema[s_] := URL["http://schema.org/" <> s]; ex[s_] := URL["http://example.org/" <> s];
Wolfram Language code: 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:

Wolfram Language code: fruitGraph//SPARQLSelect[{ RDFTriple[SPARQLVariable["fruit"], schema["color"], SPARQLVariable["color"]], SPARQLOptional[RDFTriple[SPARQLVariable["fruit"], ex["shape"], SPARQLVariable["shape"]]] }]
Wolfram Research (2019), SPARQLOptional, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLOptional.html.

Text

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

CMS

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

APA

Wolfram Language. (2019). SPARQLOptional. Wolfram Language & System Documentation Center. Retrieved from 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]}

Top [フレーム]

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