SubResource class

Annotation for nested RDF resources within a root resource.

Sub-resources are identified using fragment IRIs derived from their parent resource. They inherit CRDT merge strategies from the parent's mapping and are not registered globally in the type index.

Example:

@SubResource(
  IriTerm('https://schema.org/Comment'),
  SubIriStrategy('#comment-{id}'),
)
class Comment {
  @RdfProperty(Schema.text)
  @CrdtLwwRegister()
  String? content;

  @RdfProperty(Schema.dateCreated)
  @CrdtImmutable()
  DateTime? createdAt;

  @RdfIriPart()
  String? id;  // Used in fragment template
}

The SubIriStrategy automatically uses the parent resource's IRI as base, removing any existing fragment before appending the new one.

Inheritance
Implemented types

Constructors

SubResource(AppVocab appVocab, SubIriStrategy iriStrategy, {String? comment, String? label, List<(IriTerm, RdfObject)> metadata = const [], IriTerm? subClassOf})
const
SubResource.externalVocab(IriTerm? classIri, SubIriStrategy iriStrategy)
const

Properties

classIri → IriTerm?
The RDF class IRI for this resource.
finalinherited
comment String?
Optional description for this class in define mode.
finalinherited
direction MapperDirection?
Specifies whether this mapper should handle serialization, deserialization, or both.
finalinherited
fragment String?
The fragment identifier for vocabulary generation mode.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
iri IriStrategy?
The IriStrategy annotation specifying how the IRI for this resource is constructed.
finalinherited
label String?
Optional human-readable label for this class in define mode.
finalinherited
mapper MapperRef<GlobalResourceMapper>?
Provides a MapperRef if a custom mapper is specified.
no setterinherited
metadata List<(IriTerm, RdfObject)>?
Optional additional metadata triples for this class in define mode.
finalinherited
registerGlobally bool
Controls whether the generated mapper should be registered globally in the initRdfMapper function.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subClassOf → IriTerm?
The superclass for this resource in define mode.
finalinherited
vocab AppVocab?
The vocabulary configuration for define mode.
finalinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited