rdfAlt top-level constant

CollectionMapping const rdfAlt

Maps Dart collections to RDF Alternative structures (first is preferred).

RDF Structure: Creates an alternative collection with rdf:Alt type Dart Type: Works with List<T> - will lead to compile errors in generated mappers if used with other types like Set<T> or Iterable<T>. Order: First item is considered the preferred/default choice Use Case: Representing alternative values where first is preferred

Example Usage

@RdfProperty(SchemaBook.availableFormats, collection: rdfAlt)
final List<String> formats; // ["PDF", "EPUB", "HTML"]

Generated RDF

<book> schema:availableFormats _:alt1 .
_:alt1 rdf:type rdf:Alt ;
       rdf:_1 "PDF" ;      # Preferred format
       rdf:_2 "EPUB" ;
       rdf:_3 "HTML" .

Underlying Mapper: RdfAltMapper<T> from rdf_mapper package

Implementation

const rdfAlt = CollectionMapping.withItemMappers(RdfAltMapper);