Skip to content

Support ordered rdf list for concept property#1863

Merged
osma merged 20 commits intoNatLibFi:mainfrom
jdfranel:feat/ordered-rdf-list
Feb 6, 2026
Merged

Support ordered rdf list for concept property#1863
osma merged 20 commits intoNatLibFi:mainfrom
jdfranel:feat/ordered-rdf-list

Conversation

@jdfranel
Copy link

@jdfranel jdfranel commented Dec 26, 2025

Reasons for creating this PR

I am working on setting up a vocabulary that needs to allow for an ordered list of related concepts but the skosmos UI does only show the blank node of the first element in the list instead of showing the as it does with the unordered list.

Link to relevant issue(s), if any

Closes #1864

Description of the changes in this PR

To support this ordered list I did the following changes:

  • Updated the ConceptPropertyValue model to parse and navigate through the ordered list (from rdf:first unti rdf:nil)
  • Added a config property skosmos:rdfListItemsLimit to limit the maximum number of element in the list (default to 1000
  • Updated the view/concept-card.inc.twig to handle the ordered list and also added some styles in the skosmos.css
  • Added tests for this feature. I created a test vocabulary test-rdf-list.ttl file, updated the testconfig.ttl, added tests in the ConceptPropertyValueTest.php

Also, while testing my changes I had tu edit the tests so they use the env SKOSMOS_SPARQL_ENDPOINT instead of the static 'http://localhost:9030/skosmos/sparql' in tests/ModelTest.php and tests/VocabularyTest.php

Known problems or uncertainties in this PR

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 3, 2026

@osma osma moved this to Under review in Skosmos 3.x Backlog Jan 20, 2026
@osma osma self-requested a review January 21, 2026 09:52
Copy link
Member

@osma osma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jdfranel , this is an excellent PR. You have covered various aspects really well and the contribution fits in to the existing code base. Kudos!

Although we don't currently have the need to support rdf:List values in concept properties at our institution, I see that you have this need and that this could be useful for other Skosmos users.

A couple of minor comments:

  1. You have made the truncation limit configurable (default to 1000, but set to 10 in the test configuration so that it can be tested). Are you thinking of this limit as a backstop to prevent damage in the case of extremely long or malformed (perhaps looping) lists? Or is this something that you would routinely expect to be set at a low value such as 10 or 50? I'm asking this because this is a bit similar to the way lists of values are currently truncated at 15 items (see #1825 and/or open the page http://localhost:9090/altlabel/en/page/c1 after running tests/init_containers.sh). In those cases a link is shown that can be clicked by the user to reveal the rest of the items. They already exist in the HTML DOM, they are just hidden by default. I'm wondering whether these two truncation features should be better aligned. But if your use case is to prevent damage in case of excessively long lists rather than improve the UX, then there is no need to align these features.

  2. Normally we require Cypress tests for UI layer features. Do you think you could provide these? They could be a part of tests/cypress/template/concept.cy.js and just verify that the page shows a) non-truncated b) truncated lists. Basically the same as the PHPUnit tests, but from the HTML DOM perspective i.e. checking the rendering but not necessarily all the underlying logic as the PHPUnit test already verifies that.

  3. Regarding the SonarCloud issue you had: yes, it's a bit unfortunate that SonarCloud flags HTTP URIs as suspicious. You found a good solution to that with the comment! We normally use the SonarCloud UI to mark these as "not a problem" but it's a bit of manual work every time new URIs are introduced and it requires access to the SonarCloud project so it can't be done by contributors like you.

@osma osma added this to the 3.x milestone Jan 28, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 4, 2026

@jdfranel
Copy link
Author

jdfranel commented Feb 4, 2026

Hi @osma ,
Thank you for reviewing my PR and for your feedback.

Alignment with existing truncation features:

I've updated the visual truncation script to handle RDF lists in the same way as other multi-valued properties. Lists are now shown with a "show all" link when they exceed the default display limit of 15 items, maintaining consistency with the existing UX patterns.

Regarding rdfListItemsLimit:

This configuration parameter serves as a backstop to prevent performance issues with excessively long or potentially malformed (looping) RDF lists. Since RDF list processing requires recursive SPARQL queries to traverse the list structure, very long lists could significantly impact server response time. The default value of 1000 should handle most legitimate use cases while protecting against more extreme cases. I considered using a default of 0 (unlimited), but opted for the conservative approach to avoid unexpected performance degradation on production systems. This is a different concern from the UI truncation - it's about query performance rather than user experience.

Cypress tests:

I've added Cypress tests in tests/cypress/template/rdf-list.cy.js that verify:

  • Non-truncated RDF lists are displayed correctly in the HTML DOM
  • Truncated RDF lists show the appropriate "show all" UI element
  • The "show all" functionality works as expected for RDF lists

Let me know if there is other changes you want me to make.

Copy link
Member

@osma osma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is excellent. I spotted a little typo ("Trucated") but I will fix it myself, then merge this.

@osma osma merged commit 02bfbb3 into NatLibFi:main Feb 6, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from Under review to Issue/PR closed in Skosmos 3.x Backlog Feb 6, 2026
@osma osma self-assigned this Feb 6, 2026
@osma osma modified the milestones: 3.x, 3.1 Feb 6, 2026
@jdfranel jdfranel deleted the feat/ordered-rdf-list branch February 10, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ordered rdf list for concept property

2 participants