How to model ordered lists in Grakn


#1

What is the best way to model an ordered list in Grakn (e.g. a wishlist such as in the example code, but ranking list items from most preferred to least preferred)? The list items should be entities in the database. The order of the items should be specific to the particular list and not related to attributes of the items in the list. In fact it would be very useful to be able to store sets of alternative orderings.

define
 gift sub entity has title;
 wishlist sub entity has title;
 title sub attribute datatype string;

 wants sub relationship has title,
 relates list,
 relates desired;

 wishlist plays list;
 gift plays desired;

insert $x isa wishlist has title "Wishlist";
insert $x isa gift has title "Peace";
insert $x isa gift has title "Love";
insert $x isa gift has title "Understanding";
insert $x isa gift has title "Money";
insert $x isa wants has title "My wishlist";

match $x isa wants has title "My wishlist"; $a has title "Peace"; $b has title "Wishlist"; insert $x (desired: $a, list:  $b);
match $x isa wants has title "My wishlist"; $a has title "Love"; $b has title "Wishlist"; insert $x (desired: $a, list: $b);
match $x isa wants has title "My wishlist"; $a has title "Understanding"; $b has title "Wishlist"; insert $x (desired: $a, list: $b);
match $x isa wants has title "My wishlist"; $a has title "Money"; $b has title "Wishlist"; insert $x (desired: $a, list: $b);

Are there any alternative ways - e.g. modelling the sequential order of each item relative to the other items versus an absolute value for each item that can then be sorted through a query?

More generally, is it possible to assign attributes to instances of roles being played (i.e. are they full ‘first class items’)? For example, a range of dates to represent when the role player played the role, or the source/provenance of the instance of the role being played?

Finally, is there a preferred way to model tables/matrices in Grakn where the elements are entities?

Thanks!