Collections
A collection defines a named set of records of a specific actor type and declares where that collection is expected to exist.
It binds:
- a data shape (
actor) - to a named collection (
collection) - with existence expectations (
location)
A collection does not define structure. The actor does that.
Syntax
collection <CollectionName> {
of { <ActorName> }
expects {
in { <LocationName> }
in { <LocationName> }
}
} Structure
of { <ActorName> } (required)
Declares the actor type for items in the collection.
- Must reference an
actordeclared in the samescene - Exactly one
ofblock is required - The referenced actor defines the shape and identity of each item
Example:
collection Tools {
of { Tool }
} expects { ... } (optional)
Declares where the collection must exist.
Inside expects, one or more in { <LocationName> } blocks may be declared.
- Each
inmust reference a declaredlocation - Duplicate locations are not allowed
expectsmay be omitted if no existence requirements are needed
Example:
collection Tools {
of { Tool }
expects {
in { DataFiles }
}
} Validation rules
The compiler enforces:
collectionnames must be unique within a sceneofmust appear exactly once- The referenced actor must exist
- All referenced locations must exist
- Unknown child blocks are errors
- Unknown blocks inside
expectsare errors
Invalid example:
collection Tools {
of { UnknownActor }
} Error:
Collection 'Tools' references unknown actor 'UnknownActor' Relationship to actor
An actor defines:
- fields
- constraints
- identity
A collection defines:
- grouping
- existence expectations
Example:
actor Tool {
shape {
id { integer }
name { string }
}
identity { id }
}
collection Tools {
of { Tool }
} Relationship to location
A location names a target environment.
A collection declares that it must exist in one or more locations.
Example:
location DataFiles {
kind { 'directory' }
}
collection Tools {
of { Tool }
expects {
in { DataFiles }
}
} The scene declares intent. The edge configuration supplies the concrete wiring. The attestation verifies that the collection exists as declared.
Minimal example
The following example demonstrates how the…
Tool— an actor, which defines the shape of a recordTools— a collection, which groups records of type ToolDataFiles— a location, where the collection is expected to exist
scene SimpleScene {
location DataFiles {
kind { 'directory' }
}
actor Tool {
shape {
id { integer }
name { string }
}
identity { id }
}
collection Tools {
of { Tool }
expects {
in { DataFiles }
}
}
}