A month ago I alluded to “Figuring out best-practices for representing ordered lists in RDF” which I need to revisit. Triples have no order; if you want resources to be ordered you have to give them a sequence via other triples. There’s
rdf:first and there’s a whole paper on the subject and there’s
rel:next and there’s
schema:position and probably any number of other thoughts and definitions, so it’s just a matter of settling on one.
rdf:first requires a little bit of care to make sure that any
rdf:rest links stay synchronized and non-circular. It has the added advantage of being chainable in SPARQL queries.
Schema:position and other explicit position-number fields have some advantages (I’m partial to .newsrc-style run list management) but that doesn’t allow inserting items anywhere but the end of the list. There’s some internal advantage to that (keeping the sequence in which items were added to the inbox, and providing a unique identifier for each inbox item) even if it’s not the eventual display order. I’m using both methods, and absent any better standard I’ll start with the
Inserting items mid-list gets fun, but luckily for me Bob duCharme (of Learning SPARQL in the sidebar there) has written a blog post about RDF lists where he walks through it. And ends with
I won’t remember the syntax of these queries without reviewing them as written here, but I know that I can copy them from here and paste them elsewhere with minor modifications to perform these basic list manipulation goals.
which, I have to admit, is about 98% of the reason I blog about technical stuff.