Documentation
¶
Overview ¶
Package metamodel evaluates derived SysML and KerML metamodel properties over a resolved semantic model, optionally using graph-stated structure.
Index ¶
- Constants
- type AnnotationStructure
- type Element
- type ElementIdentityStructure
- type ElementKey
- type Evaluator
- func (e *Evaluator) Explain(el Element, definingClass, name string) (Reason, bool)
- func (e *Evaluator) Property(el Element, definingClass, name string) (Value, bool)
- func (e *Evaluator) PropertyReadOnly(el Element, definingClass, name string) (Value, bool)
- func (e *Evaluator) PropertyReadOnlyUncached(el Element, definingClass, name string) (Value, bool)
- type ImpliedRedefinitionStructure
- type LibraryMembershipResolver
- type LibrarySymbolResolver
- type Membership
- type MembershipKey
- type Omission
- type Options
- type QualifiedNameStructure
- type Reason
- type ReasonCategory
- type Rule
- type StatedAttributeStructure
- type Structure
- type SymbolStructure
- func (s *SymbolStructure) Annotations(element Element) ([]Element, bool)
- func (s *SymbolStructure) Attribute(element Element, property string) (Value, bool)
- func (s *SymbolStructure) DerivedName(element Element) (string, bool)
- func (s *SymbolStructure) ElementFor(sym *symbols.Symbol) Element
- func (s *SymbolStructure) ElementIdentity(element Element) (string, bool)
- func (s *SymbolStructure) HasStatedRelatedElement(element Element, property string) bool
- func (s *SymbolStructure) HasUnresolvedRelatedElement(element Element, property string) bool
- func (s *SymbolStructure) ImpliedRedefinedFeatures(element Element) ([]Element, bool)
- func (s *SymbolStructure) LibraryMember(membership Element) (*symbols.Symbol, bool)
- func (s *SymbolStructure) LibrarySymbol(element Element) (*symbols.Symbol, bool)
- func (s *SymbolStructure) Metaclass(element Element) (string, bool)
- func (s *SymbolStructure) OwnedRelatedElements(element Element) ([]Element, bool)
- func (s *SymbolStructure) OwnedRelationships(element Element) ([]Element, bool)
- func (s *SymbolStructure) OwningRelatedElement(element Element) (Element, bool, bool)
- func (s *SymbolStructure) OwningRelationship(element Element) (Element, bool, bool)
- func (s *SymbolStructure) QualifiedName(element Element) (string, bool)
- func (s *SymbolStructure) RelatedElements(element Element, property string) ([]Element, bool)
- func (s *SymbolStructure) SetIdentities(identities func(*symbols.Symbol) (string, bool))
- func (s *SymbolStructure) Specializes(sub, super string) bool
- func (s *SymbolStructure) StatedAttribute(element Element, property string) (Value, bool)
- func (s *SymbolStructure) StatedRelatedElements(element Element, property string) ([]Element, bool)
- func (s *SymbolStructure) SymbolOf(element Element) (*symbols.Symbol, bool)
- type Value
- type ValueKind
Constants ¶
const ExtensionMetaclassPrefix = "sysx:"
ExtensionMetaclassPrefix marks a Structure metaclass outside the SysML vocabulary; the evaluator treats such an element's SysML metaclass as unknown.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotationStructure ¶ added in v0.13.0
AnnotationStructure lists the Annotation relationships whose annotatedElement is the element: the inverse an element filter needs to find metadata stated `about` it.
type Element ¶
type Element struct {
Symbol *symbols.Symbol
Node ast.Node
Container *symbols.Symbol
Membership Membership
IsMembership bool
Aspect string
}
Element is a semantic element and the membership that owns it, when it has one.
func MembershipElement ¶
func MembershipElement(membership Membership) Element
MembershipElement creates a handle for a membership that is itself an element.
func (Element) Key ¶
func (e Element) Key() ElementKey
Key returns the canonical identity of an element.
type ElementIdentityStructure ¶
ElementIdentityStructure optionally supplies stable API identities for elements whose derived values contain an ID rather than an element handle.
type ElementKey ¶
type ElementKey struct {
// contains filtered or unexported fields
}
ElementKey identifies an element independently of its container and embedded membership.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator derives metamodel properties from a resolved semantic model.
func (*Evaluator) Property ¶
Property returns a faithfully derived property value when the evaluator serves it.
func (*Evaluator) PropertyReadOnly ¶
PropertyReadOnly returns a derived value whose sequence is shared with the evaluator cache; callers must not modify Values or any nested sequence.
func (*Evaluator) PropertyReadOnlyUncached ¶ added in v0.13.0
PropertyReadOnlyUncached returns a derived value the caller must not modify and leaves the result cache alone; the dependencies it derives are cached as usual.
type ImpliedRedefinitionStructure ¶ added in v0.13.0
ImpliedRedefinitionStructure optionally states the features an element redefines by its role (subject, objective, actor, stakeholder, rendering; SysML v2 §8.3.21-§8.3.26) unwritten.
type LibraryMembershipResolver ¶ added in v0.13.0
type LibraryMembershipResolver interface {
LibraryMember(membership Element) (*symbols.Symbol, bool)
}
LibraryMembershipResolver is the optional part of a Structure that names the library symbol a reference to a library membership stands for: the member that membership owns.
type LibrarySymbolResolver ¶ added in v0.13.0
LibrarySymbolResolver optionally resolves a structure element that merely references a library element to that element's semantic symbol.
type Membership ¶
type Membership struct {
Symbol *symbols.Symbol
Node ast.Node
Member *symbols.Symbol
Owner *symbols.Symbol
Feature bool
Aspect string
// contains filtered or unexported fields
}
Membership identifies an element's membership without depending on an export format.
func (Membership) Key ¶
func (m Membership) Key() MembershipKey
Key returns the canonical identity of a membership.
func (Membership) Metaclass ¶
func (m Membership) Metaclass() string
Metaclass returns the membership metaclass when it is known.
type MembershipKey ¶
type MembershipKey struct {
// contains filtered or unexported fields
}
MembershipKey identifies a membership independently of its feature flag.
type Options ¶
type Options struct {
Structure Structure
}
Options supplies graph-stated structure used by the evaluator. When Structure is nil, the evaluator serves properties derivable from the semantic model.
type QualifiedNameStructure ¶
QualifiedNameStructure supplies canonical names when graph containment is unavailable.
type Reason ¶
type Reason struct {
Category ReasonCategory
Detail string
Dependency string
}
Reason records the decision that made a property derivation unsupported.
type ReasonCategory ¶
type ReasonCategory string
ReasonCategory identifies why a property derivation is unsupported.
const ( ReasonNoRule ReasonCategory = "no-rule" ReasonUnresolvedReference ReasonCategory = "unresolved-reference" ReasonLibraryTargetWithoutCatalogIdentity ReasonCategory = "library-target-without-catalog-identity" ReasonDependsOnUnsupported ReasonCategory = "depends-on-unsupported" ReasonUnrepresentedEndpoint ReasonCategory = "unrepresented-endpoint" ReasonUnrepresentedElement ReasonCategory = "unrepresented-element" ReasonUnresolvedOperatorFunction ReasonCategory = "unresolved-operator-function" ReasonMissingStructure ReasonCategory = "missing-structure" ReasonMissingSemanticModel ReasonCategory = "missing-semantic-model" ReasonNotApplicable ReasonCategory = "not-applicable" ReasonIncompleteStructure ReasonCategory = "incomplete-structure" ReasonImpliedRelationshipNotMaterialized ReasonCategory = "implied-relationship-not-materialized" ReasonValueStatedUnderRedefinedProperty ReasonCategory = "value-stated-under-redefined-property" )
type StatedAttributeStructure ¶
type StatedAttributeStructure interface {
StatedAttribute(el Element, property string) (Value, bool)
}
StatedAttributeStructure distinguishes graph values from metamodel defaults.
type Structure ¶
type Structure interface {
Metaclass(Element) (string, bool)
Specializes(sub, super string) bool
OwnedRelationships(Element) ([]Element, bool)
OwningRelationship(Element) (Element, bool, bool)
OwnedRelatedElements(Element) ([]Element, bool)
OwningRelatedElement(Element) (Element, bool, bool)
RelatedElements(rel Element, property string) ([]Element, bool)
Attribute(el Element, property string) (Value, bool)
}
Structure supplies graph-stated metaclass, relationship, endpoint, and attribute facts used when a property cannot be derived from resolved semantics.
type SymbolStructure ¶ added in v0.13.0
type SymbolStructure struct {
// contains filtered or unexported fields
}
SymbolStructure is a Structure projected lazily from the symbols of a resolved model: declared symbols and the relationship and expression symbols the semantic model reflects, with no graph in between.
func NewSymbolStructure ¶ added in v0.13.0
func NewSymbolStructure(res *resolve.Resolver, model *semantics.Model) *SymbolStructure
NewSymbolStructure makes the symbol-backed structure of the model res and model were analyzed as.
func (*SymbolStructure) Annotations ¶ added in v0.13.0
func (s *SymbolStructure) Annotations(element Element) ([]Element, bool)
Annotations lists the Annotations whose annotatedElement is the element, a library element's included: its own, then those of metadata stated `about` it.
func (*SymbolStructure) Attribute ¶ added in v0.13.0
func (s *SymbolStructure) Attribute(element Element, property string) (Value, bool)
func (*SymbolStructure) DerivedName ¶ added in v0.13.0
func (s *SymbolStructure) DerivedName(element Element) (string, bool)
func (*SymbolStructure) ElementFor ¶ added in v0.13.0
func (s *SymbolStructure) ElementFor(sym *symbols.Symbol) Element
ElementFor is the handle standing for sym, placed on first use.
func (*SymbolStructure) ElementIdentity ¶ added in v0.13.0
func (s *SymbolStructure) ElementIdentity(element Element) (string, bool)
func (*SymbolStructure) HasStatedRelatedElement ¶ added in v0.13.0
func (s *SymbolStructure) HasStatedRelatedElement(element Element, property string) bool
func (*SymbolStructure) HasUnresolvedRelatedElement ¶ added in v0.13.0
func (s *SymbolStructure) HasUnresolvedRelatedElement(element Element, property string) bool
func (*SymbolStructure) ImpliedRedefinedFeatures ¶ added in v0.13.0
func (s *SymbolStructure) ImpliedRedefinedFeatures(element Element) ([]Element, bool)
func (*SymbolStructure) LibraryMember ¶ added in v0.13.0
func (s *SymbolStructure) LibraryMember(membership Element) (*symbols.Symbol, bool)
LibraryMember is the library symbol whose membership a library membership's handle names: the member an owning membership owns, or the alias a Membership is.
func (*SymbolStructure) LibrarySymbol ¶ added in v0.13.0
func (s *SymbolStructure) LibrarySymbol(element Element) (*symbols.Symbol, bool)
func (*SymbolStructure) Metaclass ¶ added in v0.13.0
func (s *SymbolStructure) Metaclass(element Element) (string, bool)
Exported reads take s.mu once; the *Locked bodies and their helpers assume it is held.
func (*SymbolStructure) OwnedRelatedElements ¶ added in v0.13.0
func (s *SymbolStructure) OwnedRelatedElements(element Element) ([]Element, bool)
func (*SymbolStructure) OwnedRelationships ¶ added in v0.13.0
func (s *SymbolStructure) OwnedRelationships(element Element) ([]Element, bool)
func (*SymbolStructure) OwningRelatedElement ¶ added in v0.13.0
func (s *SymbolStructure) OwningRelatedElement(element Element) (Element, bool, bool)
func (*SymbolStructure) OwningRelationship ¶ added in v0.13.0
func (s *SymbolStructure) OwningRelationship(element Element) (Element, bool, bool)
func (*SymbolStructure) QualifiedName ¶ added in v0.13.0
func (s *SymbolStructure) QualifiedName(element Element) (string, bool)
func (*SymbolStructure) RelatedElements ¶ added in v0.13.0
func (s *SymbolStructure) RelatedElements(element Element, property string) ([]Element, bool)
func (*SymbolStructure) SetIdentities ¶ added in v0.13.0
func (s *SymbolStructure) SetIdentities(identities func(*symbols.Symbol) (string, bool))
SetIdentities makes the structure spell its elements by identities, the one id scheme the API element form writes for named and anonymous elements alike.
func (*SymbolStructure) Specializes ¶ added in v0.13.0
func (s *SymbolStructure) Specializes(sub, super string) bool
Specializes reports whether the metaclass sub is super or conforms to it in the loaded metamodel libraries.
func (*SymbolStructure) StatedAttribute ¶ added in v0.13.0
func (s *SymbolStructure) StatedAttribute(element Element, property string) (Value, bool)
func (*SymbolStructure) StatedRelatedElements ¶ added in v0.13.0
func (s *SymbolStructure) StatedRelatedElements(element Element, property string) ([]Element, bool)