SPARQLOrderBy[expr]
is a query operator that sorts solutions by the value of expr.
SPARQLOrderBy[expr"order"]
sorts in ascending or descending order.
SPARQLOrderBy[{spec1,spec2,…}]
breaks ties by successively using the speci.
SPARQLOrderBy
SPARQLOrderBy[expr]
is a query operator that sorts solutions by the value of expr.
SPARQLOrderBy[expr"order"]
sorts in ascending or descending order.
SPARQLOrderBy[{spec1,spec2,…}]
breaks ties by successively using the speci.
Details and Options
- A RightComposition of operators SPARQLSelect[…]/*…/*SPARQLOrderBy[…]/*... can be used in SPARQLExecute to query a SPARQL endpoint. Composition is also supported.
- SPARQLOrderBy[…] can be applied to the result of a SPARQLSelect query.
- "order" can be "Ascending" or "Descending". The default is "Ascending".
Examples
Basic Examples (1)
Needs["GraphStore`"]books = GraphStore`RDFStore[{GraphStore`RDFTriple[URL["http://example.org/gravitation"],
URL["https://schema.org/datePublished"], DateObject[{1973}, "Year", "Gregorian", 2.]],
GraphStore`RDFTriple[URL["http://example.org/faust"], URL["https://schema.org/datePublished"],
DateObject[{1808}, "Year", "Gregorian", 2.]]}, Association[]];Find books ordered by publication date, with the newest first:
books//SPARQLQuery[
SPARQLSelect[RDFTriple[SPARQLVariable["book"], URL["https://schema.org/datePublished"], SPARQLVariable["date"]]] /*
SPARQLOrderBy[SPARQLVariable["date"] -> "Descending"]
]Related Guides
Text
Wolfram Research (2020), SPARQLOrderBy, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLOrderBy.html.
CMS
Wolfram Language. 2020. "SPARQLOrderBy." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLOrderBy.html.
APA
Wolfram Language. (2020). SPARQLOrderBy. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLOrderBy.html
BibTeX
@misc{reference.wolfram_2026_sparqlorderby, author="Wolfram Research", title="{SPARQLOrderBy}", year="2020", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLOrderBy.html}", note=[Accessed: 15-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_sparqlorderby, organization={Wolfram Research}, title={SPARQLOrderBy}, year={2020}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLOrderBy.html}, note=[Accessed: 15-June-2026]}