RdfGlobalResource.deserializeOnly constructor

const RdfGlobalResource.deserializeOnly(
  1. IriTerm? classIri, {
  2. bool registerGlobally = true,
  3. IriStrategy? iri,
})

Creates an annotation for deserialization-only mapping.

Use this constructor when you only need to read RDF data and construct objects, but never need to serialize objects back to RDF. Since serialization is not supported, an IRI strategy is not required.

This is particularly useful when:

  • You're consuming RDF data from external sources
  • The IRI construction logic is complex or context-dependent
  • You only need read-only access to RDF data

A deserializer-only mapper is automatically generated based on the property annotations in your class and registered within initRdfMapper when registerGlobally is true.

Example:

@RdfGlobalResource.deserializeOnly(SchemaBook.classIri)
class Book {
  @RdfProperty(SchemaBook.name)
  final String title;
  // No @RdfIriPart needed since we don't serialize
  // ...
}

Implementation

const RdfGlobalResource.deserializeOnly(this.classIri,
    {super.registerGlobally = true, this.iri})
    : vocab = null,
      subClassOf = null,
      metadata = null,
      label = null,
      comment = null,
      fragment = null,
      super(direction: MapperDirection.deserializeOnly);