RdfMapKey class
Designates a property as the key in a mapped Map<K,V> collection.
This annotation must be used together with @RdfMapEntry when mapping to a Dart Map.
Within the item class specified by @RdfMapEntry, the property annotated with @RdfMapKey
will be used as the key in the resulting Map. Unlike @RdfMapValue, this annotation
must always be applied to a property, not a class.
This annotation is an essential part of the RDF Map mapping system, enabling the mapper to correctly serialize and deserialize complex data structures like Maps. Each map entry is serialized as a distinct resource in the RDF graph, with the annotated property serving as the key. This establishes the necessary key-value relationships between Dart Map types and their RDF graph representation.
Example:
@RdfProperty(VocabTerm.vectorClock)
@RdfMapEntry(VectorClockEntry) // Item class with key and value annotations
late Map<String, int> vectorClock;
// The item class that defines the structure of map entries:
@RdfLocalResource(IriTerm('http://example.org/vocab/VectorClockEntry'))
class VectorClockEntry {
@RdfProperty(IriTerm('http://example.org/vocab/clientId'))
@RdfMapKey() // This property becomes the map key
final String clientId;
@RdfProperty(IriTerm('http://example.org/vocab/clockValue'))
@RdfMapValue() // This property becomes the map value
final int clockValue;
VectorClockEntry(this.clientId, this.clockValue);
}
- Inheritance
-
- Object
- RdfAnnotation
- RdfMapKey
Constructors
- RdfMapKey()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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