Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting by notation does not work in groups tab if showNotation is false #1390

Open
kouralex opened this issue Nov 24, 2022 · 2 comments · May be fixed by #1391
Open

Sorting by notation does not work in groups tab if showNotation is false #1390

kouralex opened this issue Nov 24, 2022 · 2 comments · May be fixed by #1391

Comments

@kouralex
Copy link
Contributor

At which URL did you encounter the problem?

At my local installation using a vocabulary with notated groups.

What steps will reproduce the problem?

  1. Set skosmos:showNotation "false"; skosmos:sortByNotation "true"; for the locally installed vocabulary in question (similarly to https://finto.fi/yso-aika/fi/ where these configuration settings are applied and working)
  2. Observe the Groups tab

What is the expected output? What do you see instead?

I expect to see the values ordered by notation codes. For YSO-aika, this is working in the Hierarchy tab. Looking at the code, it seems like sorting is done differently:

'sort' : function (a,b) { return naturalCompare(this.get_text(a).toLowerCase(), this.get_text(b).toLowerCase()); },
'sort' : function (a,b) {
var aNode = this.get_node(a);
var bNode = this.get_node(b);
// sort on notation if requested, and notations exist
if (window.sortByNotation) {
var aNotation = aNode.original.notation;
var bNotation = bNode.original.notation;
if (aNotation) {
if (bNotation) {
if (window.sortByNotation == "lexical") {
if (aNotation < bNotation) {
return -1;
}
else if (aNotation > bNotation) {
return 1;
}
} else { // natural
return naturalCompare(aNotation, bNotation);
}
}
else return -1;
}
else if (bNotation) return 1;
// NOTE: if no notations found, fall back on label comparison below
}
// no sorting on notation requested, or notations don't exist
return naturalCompare(nodeLabelSortKey(aNode), nodeLabelSortKey(bNode));
}

I would assume that refactoring so that both codes use the same approach would yield identical behavior between the tabs in question.

@kouralex kouralex added this to the Next Tasks milestone Nov 24, 2022
@kouralex kouralex linked a pull request Nov 24, 2022 that will close this issue
4 tasks
@joelit
Copy link
Contributor

joelit commented Feb 9, 2023

I'd like to understand this situation a bit better -- which vocabularies would this affect, and why is this enhancement important? We could prioritize our work better once these are clear. :)

@kouralex
Copy link
Contributor Author

kouralex commented Feb 9, 2023

The vocabulary in question is Metatietosanasto (https://finto.fi/mts/fi/) for which I am the technical maintainer. Metatietosanasto has its hierarchy based on groups. The problem arises from the fact that users would like to have (some) groups in groups tab to be sorted in a fixed way but this is not possible at the moment due to the issue described above. See, e.g., http://urn.fi/URN:NBN:fi:au:mts:m4979 where a more appropriate ordering would be non-alphabetical "Teos, Ekspressio, Manifestaatio, Kappale, Toimija, Suhteet, Ajanjakso, Paikka" listing in Finnish and likewise in Swedish (i.e., one must have a language-agnostic way to set the ordering of identifiers - hence the skos:notation approach could work).

In case you are wondering on what else to prioritize I would heavily suggest #810 to be tackled ASAP as solving that would allow Metatietosanasto (and propably other vocabularies, too) to prosper big time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants