You will have problems if you do not have total order. But to have total order it means you will have to exclude some entries for comparison.
Using your example, here’s what I mean. If we want partial ordering, then we don’t have to say that every possible pair will form a meaningful order.So, we will have (where ~ denotes a relation - think of it as Less() function)
a ~ a
a ~ b
a ~ c
a ~ d
...
d ~ a
d ~ b
d ~ c
d ~ d
Clearly in this set, some pairs cannot form meaningful relationships:
b ~ c
c ~ b
c ~ d
...
This is because these nodes do not have the correct fields to compare data on. But since we’re only after a partial order, you might say, that’s OK, all the nodes that have fields that cannot be compared go to the back of the list, in random order.
Here, we might see a problem:In order to fulfil a partial order, we DO have to have the condition that every item is comparable to itself (i.e. it is reflexive).Now imagine another node in the dataset:
_:e <name> "deg".
_:e <age> "13".
What is the status of these:
d ~ e
e ~ d
Here we see we have some problems with reflexivity. d and e are not the same nodes, but somehow they are equal to one another.
Figuring this shit out takes plenty of brain cells (well, kinda, topsorts actually solve the problem, but are hairy for a whole other reason). So let’s opt for something simpler - total order.
With total order, we say that every pair in a set will have a meaningful relationship. If no meaningful relationship can be formed, they are excluded from the set of consideration.
In this case the behaviour that is idea is when you orderasc:class , all nodes without a class predicate gets filtered out before hand.
TL;DR: cheap easy solution - filter before sort. Expensive full-featured solution: topsort.