pub enum DataDefinition {
Value {
value: LiteralValue,
resolved_type: Arc<LemmaType>,
origin: DataOrigin,
source: Source,
},
TypeDeclaration {
resolved_type: Arc<LemmaType>,
declared_suggestion: Option<BoundValueKind>,
declared_value: Option<BoundValueKind>,
source: Source,
},
Import {
row: Arc<RowInstance>,
pin: Option<ImportEffectivePin>,
candidates: BTreeMap<SpecIdentity, Arc<RowInstance>>,
source: Source,
},
InstanceList {
resolved_type: Arc<LemmaType>,
origin: DataOrigin,
source: Source,
},
Reference {
target: ReferenceTarget,
resolved_type: Arc<LemmaType>,
local_constraints: Option<Vec<Constraint>>,
local_suggestion: Option<BoundValueKind>,
local_value: Option<BoundValueKind>,
origin: DataOrigin,
source: Source,
},
}Expand description
Resolved data value for the execution plan: aligned with [DataValue] but with source per variant.
Variants§
Value
Value-holding data: current literal (spec default or with binding).
TypeDeclaration
Type-only data: type known, value to be supplied (e.g. via run data).
declared_suggestion carries the -> suggest ... payload for this binding or
the suggestion inherited from the parent type chain, if any; value-promoting code
uses it instead of re-deriving suggestions from TypeSpecification.
The evaluator never commits a suggestion — unbound stays MissingData.
Import
Import (uses): a spec instance named alias in this plan, a row over the
imported spec’s template plan. Its bindings are the -> with / path-fill fields
the declaring spec wrote; the imported data and rules are read through the
template in the instance’s context.
When pin is None, row is the sole body. When pin is Some (-> effective),
candidates holds every possible body and evaluation selects among them; row
then equals an arbitrary candidate and must not be read without selection.
Fields
row: Arc<RowInstance>candidates: BTreeMap<SpecIdentity, Arc<RowInstance>>Bound rows keyed by identity when pin is set; empty for static imports.
InstanceList
Instance list (data x: spec list). resolved_type is the list type.
Rows written in the spec are instances of this plan under the list path
(crate::planning::execution_plan::ExecutionPlan::instance_lists);
evaluation lists them unless run data replaces the list.
Reference
Value-copy reference to another data or a rule result.
resolved_type is the merged type that the copied value must satisfy at
evaluation time. Merging folds together: (1) the LHS’s own declared type,
if any; (2) the target’s type (data declared type or rule return type);
(3) any local_constraints written after the -> on the reference itself.
Merging happens in a dedicated pass once all data and rule types are
known; before that pass, resolved_type holds a provisional value and
must not be consumed for type checking.
local_constraints preserves the raw constraint list from the reference’s
-> ... tail (e.g. minimum 5 in data license2: law.other -> minimum 5)
for that merging pass. It is None when the reference has no trailing
constraints.
local_suggestion carries any suggest <value> constraint from the
reference’s -> ... tail. The reference-merge pass extracts it from the
constraint list during type resolution. It is a UI hint only
([Self::suggestion] / show); the evaluator never commits it — unbound
stays MissingData.
The reference itself is evaluated by copying the target’s value (data path)
or the target rule’s result in topological order. Evaluate data for this
path binds via resolved_type like a type declaration.
Fields
target: ReferenceTargetlocal_suggestion: Option<BoundValueKind>local_value: Option<BoundValueKind>origin: DataOriginImplementations§
Source§impl DataDefinition
impl DataDefinition
Sourcepub fn is_bound(&self) -> bool
pub fn is_bound(&self) -> bool
Whether a consumer bound this slot (uses -> with, path fill, or a row field
written in a data list). Bound slots take no evaluation data.
Sourcepub fn lemma_type(&self) -> Option<&LemmaType>
pub fn lemma_type(&self) -> Option<&LemmaType>
Declared lemma type for value, type-declaration, and reference data; None for imports.
Sourcepub fn resolved_type_arc(&self) -> Option<&Arc<LemmaType>>
pub fn resolved_type_arc(&self) -> Option<&Arc<LemmaType>>
Shared Arc for the declared type; None for imports.
Sourcepub fn schema_type(&self) -> Option<&LemmaType>
pub fn schema_type(&self) -> Option<&LemmaType>
Alias for Self::lemma_type (historical name).
Sourcepub fn value(&self) -> Option<LiteralValue>
pub fn value(&self) -> Option<LiteralValue>
Returns the literal value when the data already holds one, including -> with
on a type declaration or reference. A data-target Reference’s copied value
is produced by the evaluator at runtime, so at plan-time it has no value yet.
Sourcepub fn import_sole_row(&self) -> &Arc<RowInstance> ⓘ
pub fn import_sole_row(&self) -> &Arc<RowInstance> ⓘ
The sole row of a static (pin is None) import.
Sourcepub fn import_candidates(&self) -> &BTreeMap<SpecIdentity, Arc<RowInstance>>
pub fn import_candidates(&self) -> &BTreeMap<SpecIdentity, Arc<RowInstance>>
Candidate rows of a dynamic import (pin is set).
Sourcepub fn import_pin(&self) -> Option<&ImportEffectivePin>
pub fn import_pin(&self) -> Option<&ImportEffectivePin>
Whether this import selects its body from a -> effective pin at evaluation.
Sourcepub fn import_row_for(&self, identity: &SpecIdentity) -> &Arc<RowInstance> ⓘ
pub fn import_row_for(&self, identity: &SpecIdentity) -> &Arc<RowInstance> ⓘ
Row of a dynamic import for identity, or the sole static row when pin is None.