Say I have the following results that comes from two variables in my SPARQL query:
When I use ORDER BY ASC(?ID) I get the following:
Since I think it only looks for the next item in the string (i.e. 1, 2, 21, 3), but is there a way to treat it as an integer or make it look at the full number?
You’ll probably need to take the integer suffix of ?ID bindings to a separate variable (using xsd:integer for casting), then order by that one. Strings are sorted lexicographically.
Is there any way to define a custom sort order for a user defined datatype? Plugin perhaps? Just curious.
Not directly, but one can have a user-defined function which maps values of custom datatypes to integers… That’d be another way to solve the topic starter’s problem but perhaps an overkill here.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.