metamodel

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package metamodel evaluates derived SysML and KerML metamodel properties over a resolved semantic model, optionally using graph-stated structure.

Index

Constants

View Source
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 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 ElementOf

func ElementOf(sym *symbols.Symbol) Element

ElementOf creates a handle for a declared symbol.

func MembershipElement

func MembershipElement(membership Membership) Element

MembershipElement creates a handle for a membership that is itself an element.

func NodeOf

func NodeOf(node ast.Node) Element

NodeOf creates a handle for an AST-backed element without a symbol.

func (Element) Key

func (e Element) Key() ElementKey

Key returns the canonical identity of an element.

type ElementIdentityStructure

type ElementIdentityStructure interface {
	ElementIdentity(Element) (string, bool)
}

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 New

func New(res *resolve.Resolver, model *semantics.Model, options ...Options) *Evaluator

New creates an evaluator over the resolver and semantic model for one model.

func (*Evaluator) Explain

func (e *Evaluator) Explain(el Element, definingClass, name string) (Reason, bool)

Explain returns a recorded cause without evaluating the property.

func (*Evaluator) Property

func (e *Evaluator) Property(el Element, definingClass, name string) (Value, bool)

Property returns a faithfully derived property value when the evaluator serves it.

func (*Evaluator) PropertyReadOnly

func (e *Evaluator) PropertyReadOnly(el Element, definingClass, name string) (Value, bool)

PropertyReadOnly returns a derived value whose sequence is shared with the evaluator cache; callers must not modify Values or any nested sequence.

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 Omission

type Omission struct {
	DefiningClass string
	Property      string
	Reason        string
}

Omission explains why a derived property has no faithful evaluator rule.

func Omitted

func Omitted() []Omission

Omitted returns a copy of the derived properties not served by the evaluator and the semantic facts their derivations require.

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

type QualifiedNameStructure interface {
	QualifiedName(Element) (string, bool)
}

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.

func (Reason) String

func (r Reason) String() string

String formats the category and its identifying detail.

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 Rule

type Rule struct {
	DefiningClass string
	Property      string
	Constraint    string
	Basis         string
}

Rule describes the basis for an evaluator-served property.

func Rules

func Rules() []Rule

Rules returns a copy of the property derivations the evaluator can faithfully compute.

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 Value

type Value struct {
	Kind       ValueKind
	Element    Element
	Membership Membership
	String     string
	Boolean    bool
	Integer    int64
	Real       float64
	Enum       string
	Values     []Value
	Success    bool
}

Value is a semantic value returned by a property derivation.

type ValueKind

type ValueKind uint8

ValueKind identifies the semantic value stored in Value.

const (
	InvalidValue ValueKind = iota
	NullValue
	ElementValue
	MembershipValue
	StringValue
	BooleanValue
	IntegerValue
	RealValue
	EnumValue
	SequenceValue
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL