pub struct FactAssembler { /* private fields */ }Expand description
Source-language-neutral construction of direct schema facts.
Parsers provide validated contract identities and source spans. The assembler owns duplicate detection and the forward-reference resolution needed to mint stable role and playing identities consistently across source languages.
Implementations§
Source§impl FactAssembler
impl FactAssembler
Sourcepub fn new(format: FormatVersion) -> Self
pub fn new(format: FormatVersion) -> Self
Start an assembler for one canonical fact-format version.
Sourcepub fn require_capability(
&mut self,
capability: CapabilityId,
source: SourceSpan,
) -> Result<(), SchemaDiagnostics>
pub fn require_capability( &mut self, capability: CapabilityId, source: SourceSpan, ) -> Result<(), SchemaDiagnostics>
Add one required capability, retaining duplicate provenance.
Sourcepub fn insert_fact(
&mut self,
fact: SchemaFact,
source: SourceSpan,
) -> Result<(), SchemaDiagnostics>
pub fn insert_fact( &mut self, fact: SchemaFact, source: SourceSpan, ) -> Result<(), SchemaDiagnostics>
Insert one fully identified direct fact.
Sourcepub fn insert_struct(
&mut self,
fact: StructFact,
source: SourceSpan,
) -> Result<(), SchemaDiagnostics>
pub fn insert_struct( &mut self, fact: StructFact, source: SourceSpan, ) -> Result<(), SchemaDiagnostics>
Insert one struct declaration through the shared declaration namespace.
Sourcepub fn insert_relates(
&mut self,
id: RelatesFactId,
specializes: Option<(Label, SourceSpan)>,
source: SourceSpan,
) -> Result<(), SchemaDiagnostics>
pub fn insert_relates( &mut self, id: RelatesFactId, specializes: Option<(Label, SourceSpan)>, source: SourceSpan, ) -> Result<(), SchemaDiagnostics>
Queue a related-role declaration whose specialization may target an ancestor.
Sourcepub fn insert_relates_with_collection_mode(
&mut self,
id: RelatesFactId,
specializes: Option<(Label, SourceSpan)>,
collection_mode: CollectionMode,
source: SourceSpan,
) -> Result<(), SchemaDiagnostics>
pub fn insert_relates_with_collection_mode( &mut self, id: RelatesFactId, specializes: Option<(Label, SourceSpan)>, collection_mode: CollectionMode, source: SourceSpan, ) -> Result<(), SchemaDiagnostics>
Queue a related-role declaration with explicit collection semantics.
Sourcepub fn insert_plays(
&mut self,
player: Label,
relation: Label,
role: Label,
source: SourceSpan,
)
pub fn insert_plays( &mut self, player: Label, relation: Label, role: Label, source: SourceSpan, )
Queue a player-keyed playing declaration for forward resolution.
Sourcepub fn finish(self) -> Result<DeclaredSchema, SchemaDiagnostics>
pub fn finish(self) -> Result<DeclaredSchema, SchemaDiagnostics>
Materialize deferred identities and construct the validated declared graph.