How to best represent the order of nodes on an edge?

Short story collections contain stories in an order, which is naturally discoverable when in XML format, that is I can ask what stor(ies) proceed N and what stor(ies) follow N.

I’m new to TypeDB and it isn’t clear how to create an order of story (and by indirection their authors) entities that share an appears-in relationship to the collection as an entity. Bearing in mind that such stories appear in other collections, which likely don’t share the same ordering. (That being part of what I want to capture, the editorial decisions on the ordering of stories.) Suggestions? Thanks!

Assuming we have a simple schema with stories, collections and an appears-in relation, you could add an order attribute to your appears-in relation. At the point at which an appears-in relation is inserted, you add the order attribute to that relation.

Taking the examples two collections of short stories, ‘Labyrinths’ and ‘Fictions’ with a mutual story “The Garden of Forking Paths”, we would insert our short story, then our collections, then our relations. In ‘Labyrinths’, the story is second, so our insertion would look like:

insert $garden_in_labyrinths (story: $garden, collection: $labyrinths) isa appears-in, has order 2;

Thanks! I think you’re right about using an attribute for “order,” although I’m forgetful so would likely say collection-order, to remind myself its not publication order (in different collections), story order (where they appear in parts), etc.

More questions are likely! Thanks again!