Skip to content

Ordered Multiple/Collection field does not serialize as proper RDF list #737

@SharonStrats

Description

@SharonStrats

What is the problem?

When using a form with ui:Multiple and ui:ordered true (e.g. for schema:knowsLanguage or similar), the data saved in the store does not serialize as a single, proper RDF List. Instead, the resulting triples create multiple disconnected blank nodes for the property, each starting a partial list. This leads to incorrect Turtle/N3 output such as:

:this schema:knowsLanguage _:b1, _:b2, _:b3.
_:b1 rdf:first <#id1>; rdf:rest _:b2.
_:b2 rdf:first <#id1>; rdf:rest rdf:nil.
_:b3 rdf:first <#id1>; rdf:rest _:b4.

Or (as seen):

:this schema:knowsLanguage _:b15671_b15483_n3-11289, _:b15671_b15483_n3-11292, _:b15671_b15483_n3-11293 ;
# ...

But the expected RDF list serialization is:

:this schema:knowsLanguage (
    _:lang1
    _:lang2
    _:lang3
) .

_:lang1 solid:publicId "en" .
_:lang2 solid:publicId "fr" .
_:lang3 solid:publicId "de" .

Which as triples is:

:this schema:knowsLanguage _:list1 .
_:list1 rdf:first _:lang1 ; rdf:rest _:list2 .
_:list2 rdf:first _:lang2 ; rdf:rest _:list3 .
_:list3 rdf:first _:lang3 ; rdf:rest rdf:nil .
_:lang1 solid:publicId "en" .
_:lang2 solid:publicId "fr" .
_:lang3 solid:publicId "de" .

Steps to reproduce

  1. Use a ui:Multiple field with ui:ordered true and ui:property (e.g. schema:knowsLanguage)
  2. Add 3+ entries via the UI
  3. Save/store
  4. Inspect the generated Turtle/N3

Expected behavior

  • The property should link to a single RDF List (one head node)
  • The list's nodes are chained with rdf:first and rdf:rest, and the actual objects are in the rdf:first slots
  • Each language or value node should have their own data (such as solid:publicId)
  • Serialization should use list syntax when possible

Actual behavior

  • Multiple list nodes are created, each with duplicate or broken chains
  • The property appears to have multiple list heads
  • The actual language values may all be the same or missing

Impact

  • Consumers expecting an RDF list (such as shape validators, list-aware code, or N3 processors) will fail to read the correct data
  • UI add/move/remove may duplicate or drop data unexpectedly

Proposed fix

  • When serializing a Multiple/ordered field, ensure only one list head is attached to the property, and list.elements produces a proper, single RDF list for serialization.
  • Test with forms like the language selector in Profile/Edit.

If you would like a draft PR description as well, let me know.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions