NatLibFi / Skosmos

Thesaurus and controlled vocabulary browser using SKOS and SPARQL
Other
219 stars 94 forks source link

Support for skos:OrderedCollection #1268

Open mielvds opened 2 years ago

mielvds commented 2 years ago

I was wondering whether supporting skos:OrderedCollection is something that is being considered? Visually, I don't think there are much changes to how skos:Collection is displayed, with the exception of the ordering of the concepts.

The most annoying part is probably dealing with the list in skos:memberList, but you could get there with a query like

PREFIX : <https://stackoverflow.com/q/17523804/1281433/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?concept (count(?mid)-1 as ?position) 
WHERE {
  ?collection a skos:OrderedCollection.
  ?collection skos:memberList/rdf:rest* ?mid . 
  ?mid rdf:rest* ?node .
  ?node rdf:first ?concept .
  ?concept a skos:Concept.
}
GROUP BY ?node ?id ?label ?definition
ORDER BY ?position

If anything I missed, let me know

osma commented 2 years ago

Thanks for proposing this, and for the SPARQL example. Do you have an example of a SKOS vocabulary where skos:OrderedCollection is used?

We don't have a need for this at the moment in Finto, but contributions are welcome.

mielvds commented 2 years ago

We have this list of courses (sorry, just dutch labels) here: https://ilearn.ilabt.imec.be/Skosmos/exp-vakken/en/ and source: https://github.com/i-Learn-SKOS/common-conceptschemes/blob/main/common/schemes/vak-norelated-final.skos.ttl

Our use case is the following: the order of concepts was manually curated to visually co-locate related courses in applications. It's confusing for the creators to not see that order maintained on skosmos.

osma commented 2 years ago

Thank you for the example!

One possible workaround is to assign notation codes to the courses (using skos:notation), so that the order of the notations corresponds to the intended visual order. Then you can use the skosmos:showNotation and skosmos:sortByNotation configuration settings to make the notations visible and the courses ordered by notation code in either lexical or decimal sort order.