Skip to main content

Module attribute

Module attribute 

Source
Expand description

Attribute definition and usage metadata. Typed attribute references with carried identity-determining facts.

An [Attribute<S>] is a rooted [Fragment] plus a phantom value- schema marker. The fragment’s root() IS the attribute id; its facts are the identity-determining data (e.g. metadata::iri: <handle> or metadata::name: <handle> together with metadata::value_encoding: <schema id>). The attribute is the abstract shared thing multiple parties agree on; codebase-local annotations (the rust identifier, source location, doc comment) are emitted at the [attributes!] call site as usage facts — there is no [AttributeUsage] type, the macro inlines them.

Construct via From<Fragment>:

// Display-name origin (JSON fields, config keys, column headers):
Attribute::<S>::from(entity! {
    metadata::name:         name.to_blob().get_handle(),
    metadata::value_encoding: <S as MetaDescribe>::id(),
})

// RDF / JSON-LD predicate (IRI as canonical identifier):
Attribute::<S>::from(entity! {
    metadata::iri:          iri.to_blob().get_handle(),
    metadata::value_encoding: <S as MetaDescribe>::id(),
})

// Explicit hex id (pinned attribute namespace):
Attribute::<S>::from(entity! {
    ExclusiveId::force_ref(&id) @
        metadata::value_encoding: <S as MetaDescribe>::id(),
})

Re-exports§

pub use crate::id::RawId as RawIdAlias;

Structs§

Attribute
A typed reference to an attribute: a rooted Fragment carrying the identity-determining facts, tagged with a phantom value-schema marker.