globalResource property
Specifies how to treat the property's value as an RDF resource with its own IRI.
Use this when the property represents a nested resource that should have its own globally unique IRI, or to override default mapping behavior for this relationship.
Only needed when there is no GlobalResourceMapper already registered globally for the property value's type, or when you need a specific mapper for this relationship that differs from the standard global resource mapping.
This parameter can override globally registered mappers for the same type, allowing relationship-specific mapping while maintaining standard mapping elsewhere:
class Book {
// Uses custom mapper for this specific relationship
@RdfProperty(
SchemaBook.publisher,
globalResource: GlobalResourceMapping.namedMapper('customPublisherMapper')
)
final Publisher publisher;
// Uses the globally registered mapper for Publisher
@RdfProperty(SchemaBook.recommendedBy)
final Publisher recommendedBy;
}
Available GlobalResourceMapping constructor variants:
.namedMapper()- references a mapper provided toinitRdfMapper.mapper()- uses a mapper type that will be instantiated.mapperInstance()- uses a specific mapper instance
Implementation
final GlobalResourceMapping? globalResource;