queryexec

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 22 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 queryexec executes immutable document-query plans.

Index

Constants

View Source
const AssertionVerification runtime.AssertionKind = "verification"

AssertionVerification is the kind of a verdict row reporting a verification case's run, following the requirement verdict it verifies.

View Source
const PropertyValuation = "valuation"

PropertyValuation projects what a row feature's own valuation binds (KerML Feature::valuation): the value its declaration writes, or a redefinition binds, evaluated where it is an expression. A row that is not a feature, or a feature bound to nothing, reads as absent.

Variables

This section is empty.

Functions

func ElementIDOf added in v0.12.0

func ElementIDOf(read ElementIDReader, idx *symbols.Index, sym *symbols.Symbol) (string, error)

ElementIDOf is sym's elementId through read. A relationship the notation writes as part of another element reads as the conversion writes it: an implied OwningMembership as its member's owning membership, an import as its declaration, a written clause or an end's attachment as the element materialized for it, a prefix metadata's Annotation as the metadata's; one the conversion never writes reads empty.

func OutcomeLines added in v0.12.0

func OutcomeLines(err error) []string

OutcomeLines is the record behind err rendered for a prompt, none for an error that carries no record.

func RationalText added in v0.10.0

func RationalText(value semantics.Value) string

RationalText spells an exact Rational as a document spells a number: a terminating one in decimal, as strconv's shortest 'g' form spells a Real, else `numer/denom`.

func RegisterElementIDSource added in v0.12.0

func RegisterElementIDSource(s ElementIDSource)

RegisterElementIDSource installs the source elementId is read from.

Types

type Bindings

type Bindings map[string][]Value

Bindings supplies named values to an entry query.

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

Cell is one immutable projected value sequence.

func (Cell) Origin

func (c Cell) Origin() symbols.Origin

Origin returns the selected model element behind the cell.

func (Cell) Values

func (c Cell) Values() []Value

Values returns an independent copy of the cell values.

type Column

type Column struct {
	// contains filtered or unexported fields
}

Column describes one ordered projected property.

func StaticColumn added in v0.12.0

func StaticColumn(label string, width int, origin symbols.Origin) Column

StaticColumn is a column of a table whose rows were written out rather than queried: headed label, sized width (0 for automatic), and originating where the table was written.

func (Column) Label added in v0.9.2

func (c Column) Label() string

Label is the heading the column is presented under: the stated label, or the name when none is stated.

func (Column) Name

func (c Column) Name() string

Name returns the projected property name.

func (Column) Origin

func (c Column) Origin() symbols.Origin

Origin returns the query expression that projected the column.

func (Column) Width added in v0.9.2

func (c Column) Width() int

Width is the column's stated width in source units relative to the other columns of its table, 0 when the column is sized automatically.

func (Column) WithLabel added in v0.9.2

func (c Column) WithLabel(label string) Column

WithLabel returns the column headed label; "" heads it by its name.

func (Column) WithWidth added in v0.9.2

func (c Column) WithWidth(width int) Column

WithWidth returns the column with a stated width; a width of 0 sizes it automatically.

type Constraint added in v0.12.0

type Constraint string

Constraint is what a model error found violated, one per constructor of the Lean Constraint.

const (
	ConstraintAmbiguousName Constraint = "ambiguousName"
	ConstraintMultiplicity  Constraint = "multiplicity"
	ConstraintTyping        Constraint = "typing"
	ConstraintUnit          Constraint = "unit"
	ConstraintDuplicateKey  Constraint = "duplicateKey"
)

type Context

type Context struct {
	Index     *symbols.Index
	Resolver  *resolve.Resolver
	Model     *semantics.Model
	LineIndex func(doc string) *source.LineIndex
	// ElementID reads the elementId a conversion of the model writes for an
	// element, or why the model has none; without one, elementId is absent.
	ElementID func(sym *symbols.Symbol) (string, error)
	// Runtime holds the objects the query may read; nil makes object bindings
	// and Objects typed errors.
	Runtime *runtime.Context
	// Roots are the objects the session holds directly, each under its label,
	// in the order Objects enumerates them.
	Roots []Root
	// Related memoizes relationship edge tables across the executions sharing
	// this context; nil builds them once per execution.
	Related *RelationshipTables
}

Context provides the semantic workspace used by one execution; Index, Resolver and Model are required, Runtime and Roots absent over the model alone.

func (Context) HeldRoot

func (c Context) HeldRoot(sym *symbols.Symbol) (Value, bool)

HeldRoot returns the first root materialized from a declaration, so a binding naming the declaration binds its object while the session holds one.

func (Context) Verifier added in v0.10.0

func (c Context) Verifier() runtime.RequirementVerifier

Verifier runs verification cases over the context: in its runtime when it holds one, or a behavior-free reader over its model.

type ElementIDDocument added in v0.12.0

type ElementIDDocument struct {
	File       *source.SourceFile
	Root       *ast.RootNamespace
	ParseDiags []parser.Diagnostic
}

ElementIDDocument is a document of the model a conversion writes, with its parse's errors, which refuse a model of several documents.

type ElementIDReader added in v0.12.0

type ElementIDReader interface {
	Read(doc string, decl ast.Node, fqn string) (string, error)
	ReadOwningMembership(doc string, decl ast.Node, fqn string) (string, error)
	ReadRelationship(doc string, node ast.Node) (string, error)
	ReadExpressionPart(doc string, node ast.Node, slot string) (element, membership string, err error)
}

ElementIDReader reads the elementIds a conversion of the model writes: Read, for the element declared at decl in document doc, named fqn; ReadOwningMembership, for the membership through which its namespace owns it; ReadRelationship, for the relationship element the notation implies at a node (a head clause, a bound end's attachment, a dependency's prefix metadata). Each reports why the model has none.

func OpenElementIDs added in v0.12.0

func OpenElementIDs(docs []ElementIDDocument) ElementIDReader

OpenElementIDs opens the registered source over docs; nil when none is linked, and elementId is then absent.

type ElementIDSource added in v0.12.0

type ElementIDSource func(docs []ElementIDDocument) ElementIDReader

ElementIDSource opens a reader over a model's documents, converting them once, on the first read: how a query's elementId column is filled. The converter registers one (queryexec/elementids), so a binary that links no translator reports elementId absent.

type Error

type Error struct {
	Kind      ErrorKind
	Query     string
	Operation queryplan.Operation
	Parameter string
	Property  string
	Target    string
	Path      []string
	Expected  string
	Actual    string
	Origin    symbols.Origin
	// Candidates are what the model offers in place of what the query asked for:
	// the spellings nearest an unresolved name, or the elements an ambiguous name denotes.
	Candidates []string
	// Outcome is the QVTS record behind a path or model error (outcome.go); nil for
	// the failures that are neither, the flat fields above being its rendering.
	Outcome *Outcome
	// Also names the other elements the same fan-out failed on (missing-feature).
	Also []string
	// Cause is the evaluator's reason an unevaluable feature could not be read.
	Cause error
}

Error is a typed query-execution failure with plan provenance.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorKind

type ErrorKind string

ErrorKind classifies a document-query execution failure.

const (
	ErrorInvalidContext        ErrorKind = "invalid-context"
	ErrorUnknownBinding        ErrorKind = "unknown-binding"
	ErrorMissingBinding        ErrorKind = "missing-binding"
	ErrorBindingType           ErrorKind = "binding-type"
	ErrorBindingMultiplicity   ErrorKind = "binding-multiplicity"
	ErrorMissingElement        ErrorKind = "missing-element"
	ErrorUnsupportedOperation  ErrorKind = "unsupported-operation"
	ErrorInvalidArgument       ErrorKind = "invalid-argument"
	ErrorInvalidOperator       ErrorKind = "invalid-operator"
	ErrorInvalidOrder          ErrorKind = "invalid-order"
	ErrorUnknownProperty       ErrorKind = "unknown-property"
	ErrorUnknownClassification ErrorKind = "unknown-classification"
	ErrorUnknownElement        ErrorKind = "unknown-element"
	// ErrorAmbiguousElement: Named was given a name several elements carry — a
	// finding about the model, where ErrorUnknownElement is one about the query.
	ErrorAmbiguousElement    ErrorKind = "ambiguous-element"
	ErrorUnknownRelationship ErrorKind = "unknown-relationship"
	// ErrorMissingFeature: Project or WhereFeature read a feature an element row
	// lacks — a path error about that element; ErrorUnknownProperty: no row had it.
	ErrorMissingFeature     ErrorKind = "missing-feature"
	ErrorUnevaluableFeature ErrorKind = "unevaluable-feature"
	// ErrorUnservedProperty: a metamodel property the row's metaclass carries,
	// which this OpenSysML does not derive yet — a path error naming the gap.
	ErrorUnservedProperty      ErrorKind = "unserved-property"
	ErrorUnknownInvocation     ErrorKind = "unknown-invocation"
	ErrorInvocationCycle       ErrorKind = "invocation-cycle"
	ErrorInvocationDepth       ErrorKind = "invocation-depth"
	ErrorInvocationBudget      ErrorKind = "invocation-budget"
	ErrorVisitBudget           ErrorKind = "visit-budget"
	ErrorResultType            ErrorKind = "result-type"
	ErrorResultMultiplicity    ErrorKind = "result-multiplicity"
	ErrorColumnOperand         ErrorKind = "column-operand"
	ErrorColumnOperandType     ErrorKind = "column-operand-type"
	ErrorColumnDivisionByZero  ErrorKind = "column-division-by-zero"
	ErrorColumnIncommensurable ErrorKind = "column-incommensurable"
	ErrorColumnArithmetic      ErrorKind = "column-arithmetic"
	ErrorColumnAbsent          ErrorKind = "column-absent"
	// ErrorUnknownColumn: Differ named a key or column one side does not project.
	ErrorUnknownColumn ErrorKind = "unknown-column"
	// ErrorDuplicateKey: a Differ side carries one key value on two rows, or a key cell
	// that is not single-valued — the model error, every finding kept.
	ErrorDuplicateKey      ErrorKind = "duplicate-key"
	ErrorColumnCardinality ErrorKind = "column-cardinality"
	// ErrorNoRuntime: an operation over a session's objects ran with no session.
	ErrorNoRuntime ErrorKind = "no-runtime"
	// ErrorObjectRow: a model-only operation was given a runtime object row.
	ErrorObjectRow ErrorKind = "object-row"
	// ErrorVerdictRow: a model-only operation was given a verdict row.
	ErrorVerdictRow ErrorKind = "verdict-row"
	// ErrorNotAnObject: Verdicts was asked about an element that declares no object.
	ErrorNotAnObject ErrorKind = "not-an-object"
	// ErrorIncompleteValidation: Verdicts could not check every assertion about a row.
	ErrorIncompleteValidation ErrorKind = "incomplete-validation"
	// ErrorStateRow: a model-only operation was given a state row.
	ErrorStateRow ErrorKind = "state-row"
	// ErrorEventRow: a model-only operation was given an event row.
	ErrorEventRow ErrorKind = "event-row"
	// ErrorNotHeld: a runtime operation was given an element the session holds no object of.
	ErrorNotHeld ErrorKind = "not-held"
	// ErrorNoStateMachine: States was asked about an object exhibiting no state machine.
	ErrorNoStateMachine ErrorKind = "no-state-machine"
	// ErrorUnknownState: InState named a state no session object's machine declares.
	ErrorUnknownState ErrorKind = "unknown-state"
	// ErrorObjectDestroyed: States or Events was given an object the run destroyed.
	ErrorObjectDestroyed ErrorKind = "object-destroyed"
	// ErrorNoTrace: Events ran in a session that records no trace.
	ErrorNoTrace ErrorKind = "no-trace"
	// ErrorInvalidInterval: an Events bound is not an instant on the clock, or the interval is empty.
	ErrorInvalidInterval ErrorKind = "invalid-interval"
	// ErrorTraceTruncated: Events reaches back to records the session's bounded trace has dropped.
	ErrorTraceTruncated ErrorKind = "trace-truncated"
	// ErrorUndeclaredRow: a RelatedColumn was to traverse from a row no element declares.
	ErrorUndeclaredRow ErrorKind = "undeclared-row"
	// ErrorProjectedAncestors: Tree was given ancestors for rows already projected.
	ErrorProjectedAncestors ErrorKind = "projected-ancestors"
)

type Event

type Event struct {
	// contains filtered or unexported fields
}

Event is one row of Events: a typed record of the session's trace, at the instant it was made. Immutable once built.

func EventsFromTrace added in v0.10.0

func EventsFromTrace(ctx *runtime.Context, records []runtime.TraceRecord) []Event

EventsFromTrace converts documented trace records into rows in run order.

func (Event) Alternatives

func (ev Event) Alternatives() []string

Alternatives are a choice's alternatives as offered, or a decide's branches, nil for any other record.

func (Event) Assigned added in v0.12.0

func (ev Event) Assigned() (feature string, value runtime.Value, ok bool)

Assigned is the feature an assign record wrote and the value it holds since; ok is false for any other record.

func (Event) At

func (ev Event) At() float64

At is the clock instant the record was made at, in clock units.

func (Event) Behavior

func (ev Event) Behavior() *symbols.Symbol

Behavior is the state machine or action the record was made under.

func (Event) Kind

func (ev Event) Kind() string

Kind names the record's kind as its `kind` property does: `accept`, `send`, `transition`, `entry`, `exit`, `do`, `choice`, `guard`, `terminate`, and for an action's run `step`, `wait`, `assign`, `decide`, `complete`.

func (Event) Label

func (ev Event) Label() string

Label names the row: the machine it came from and its text (`lamp.lp: enter: on`); a record with no object reads as its text alone.

func (Event) Machine

func (ev Event) Machine() string

Machine names the behavior as its `machine` property does, "" for none.

func (Event) Object

func (ev Event) Object() (*runtime.Instance, string)

Object is the object whose behavior made the record, nil for one made from outside the run, with the label a session reaches it by.

func (Event) Payload

func (ev Event) Payload() []string

Payload is an accept's or send's payload, `name = value` per parameter in name order, in the runtime's notation.

func (Event) Record

func (ev Event) Record() runtime.TraceRecord

Record is the trace record the row reads.

func (Event) Step added in v0.12.0

func (ev Event) Step() int

Step is the executor step the record was made in, 0 for a record of none.

func (Event) Summary

func (ev Event) Summary() string

Summary is the event in one line: its instant in clock units, then its label.

func (Event) Taken

func (ev Event) Taken() string

Taken is the alternative a choice took or the branch a decide took, "" for any other record.

func (Event) Target

func (ev Event) Target() (*runtime.Instance, string)

Target is the object a send was addressed to, nil for any other record, with the label a session reaches it by.

func (Event) Text

func (ev Event) Text() string

Text is the record's trace text.

func (Event) Time

func (ev Event) Time() Value

Time is the instant as its `time` property answers it.

func (Event) Token added in v0.12.0

func (ev Event) Token() int64

Token is the action token a step, wait, assign, decide or action accept record is about, and Step the executor step that made it; both 0 for any other record.

type Failure added in v0.12.0

type Failure struct {
	Step     Step     `json:"step"`
	Expected string   `json:"expected"`
	Frontier Frontier `json:"frontier"`
}

Failure is one failure of one step on one element: what the step asserted (Expected) and what the model holds there (Frontier).

type FeatureRef added in v0.12.0

type FeatureRef struct {
	Name string
	Type string
}

FeatureRef is one feature reachable on the element the path stopped at, `(name, type)`; Type is empty for an untyped feature.

func (FeatureRef) MarshalJSON added in v0.12.0

func (f FeatureRef) MarshalJSON() ([]byte, error)

type Finding added in v0.12.0

type Finding struct {
	Step       Step       `json:"step"`
	Element    string     `json:"element"`
	Constraint Constraint `json:"constraint"`
	Observed   string     `json:"observed"`
}

Finding is one finding about Element at Step: a constraint the model violates.

type Frontier added in v0.12.0

type Frontier struct {
	At       string
	Members  []Member
	Features []FeatureRef
	Kinds    []string
	Nearest  string
}

Frontier is what the model holds where the path stopped resolving: the last element that did resolve (At) and what it offers in place of what was asked.

func (Frontier) MarshalJSON added in v0.12.0

func (f Frontier) MarshalJSON() ([]byte, error)

type Member added in v0.12.0

type Member struct {
	Name      string
	Metaclass string
}

Member is one owned member of the namespace the path stopped at, `(name, metaclass)`.

func (Member) MarshalJSON added in v0.12.0

func (m Member) MarshalJSON() ([]byte, error)

type ModelError added in v0.12.0

type ModelError struct {
	Findings     []Finding `json:"findings"`
	PathFailures []Failure `json:"pathFailures"`
}

ModelError says the model violates a constraint a legitimate step relied on, with the path failures of the elements that failed in the same fan-out.

type Options

type Options struct {
	VisitBudget      int
	InvocationDepth  int
	InvocationBudget int
}

Options controls bounded query execution.

type Outcome added in v0.12.0

type Outcome struct {
	Path  *PathError
	Model *ModelError
}

Outcome is the QVTS record behind a failed query: exactly one of Path and Model is set, as Outcome.pathError / Outcome.modelError are in Lean.

func (Outcome) Kind added in v0.12.0

func (o Outcome) Kind() string

Kind is `pathError` or `modelError`.

func (Outcome) Lines added in v0.12.0

func (o Outcome) Lines() []string

Lines renders the record for a prompt or a CLI, one indented line per failure or finding, the frontier on the line after it.

func (Outcome) MarshalJSON added in v0.12.0

func (o Outcome) MarshalJSON() ([]byte, error)

MarshalJSON writes the record in the shape qvts's SPARQL differential records: `outcome`, `step`, then the failures or the findings and path failures.

func (Outcome) Step added in v0.12.0

func (o Outcome) Step() Step

Step is the step the outcome is reported at: that of its first failure or finding.

type PathError added in v0.12.0

type PathError struct {
	Failures []Failure `json:"failures"`
}

PathError says the query is wrong about this model: every failure with its own step.

type RelationshipTables

type RelationshipTables struct {
	// contains filtered or unexported fields
}

RelationshipTables memoizes one model's per-kind edge tables across the executions whose Context shares them. Not safe for concurrent use.

func NewRelationshipTables

func NewRelationshipTables() *RelationshipTables

NewRelationshipTables returns empty tables for a Context to carry.

type Root

type Root struct {
	Label  string
	Object *runtime.Instance
}

Root is one object a session holds directly, under its label (`Demo::car`, `#7`).

type Row

type Row struct {
	// contains filtered or unexported fields
}

Row retains the selected element, object, verdict, state or event and its ordered projected cells.

func StaticRow added in v0.12.0

func StaticRow(cells []string, origin symbols.Origin) Row

StaticRow is a row written out rather than queried: one text cell per column, originating where the row was written, and selecting no element.

func (Row) Cells

func (r Row) Cells() []Cell

Cells returns an independent copy of the row's projected cells.

func (Row) Depth added in v0.9.2

func (r Row) Depth() int64

Depth is the row's nesting under the rows above it: 0 for a top-level row, one more for each row it nests under when the query arranged its rows as a tree (`Tree`); otherwise every row is at depth 0.

func (Row) Element

func (r Row) Element() Value

Element returns the selected value: a model element, a runtime object when the query ran over a session's objects, a verdict about one, a state one is in, or an event of the session's trace.

func (Row) Origin

func (r Row) Origin() symbols.Origin

Origin returns the selected element's declaration provenance.

type RowSet

type RowSet struct {
	// contains filtered or unexported fields
}

RowSet is an immutable ordered query result.

func Execute

func Execute(program *queryplan.Program, context Context, bindings Bindings, options Options) (*RowSet, error)

Execute evaluates a compiled entry query into an immutable ordered row set.

func (*RowSet) Columns

func (r *RowSet) Columns() []Column

Columns returns an independent copy of the projected columns.

func (*RowSet) Origin

func (r *RowSet) Origin() symbols.Origin

Origin returns the entry query declaration.

func (*RowSet) Rows

func (r *RowSet) Rows() []Row

Rows returns an independent copy of the result rows.

type State

type State struct {
	// contains filtered or unexported fields
}

State is one row of States or InState: an active leaf state of one object's state machine, as the session stands. Immutable once built.

func (State) Declaration

func (s State) Declaration() *symbols.Symbol

Declaration is the state as declared, nil when lowering synthesized it.

func (State) Enclosing

func (s State) Enclosing() []string

Enclosing names the composite states the leaf is nested in, outermost first; each is active with the leaf.

func (State) Label

func (s State) Label() string

Label names the row: the state's path on its object's machine (`lamp.lp in on.dim`).

func (State) Machine

func (s State) Machine() string

Machine names the state machine the object exhibits that is in the state.

func (State) Name

func (s State) Name() string

Name is the active leaf state's own name.

func (State) Object

func (s State) Object() (*runtime.Instance, string)

Object is the object whose machine is in the state, under the label the session reaches it by.

func (State) Path

func (s State) Path() string

Path is the leaf's name qualified by the states enclosing it (`on.run`).

func (State) Region

func (s State) Region() string

Region names the orthogonal region the leaf runs in, "" outside any region.

type Step added in v0.12.0

type Step struct {
	Kind     StepKind
	Argument string
}

Step is one operation of the query with its argument: the name Named looked up, the feature Feature read, the column Project filled.

func (Step) Label added in v0.12.0

func (s Step) Label() string

Label spells the step as the Lean and SPARQL sides do: `Named(Observatory::x)`.

func (Step) MarshalJSON added in v0.12.0

func (s Step) MarshalJSON() ([]byte, error)

type StepKind added in v0.12.0

type StepKind string

StepKind is the operation a QVTS outcome points at, one per constructor of lean/QVTS/Outcome.lean's Step.

const (
	StepNamed        StepKind = "Named"
	StepOwned        StepKind = "Owned"
	StepDescendants  StepKind = "Descendants"
	StepFeature      StepKind = "Feature"
	StepValue        StepKind = "Value"
	StepOfType       StepKind = "OfType"
	StepRelated      StepKind = "Related"
	StepWhereFeature StepKind = "WhereFeature"
	StepProject      StepKind = "Project"
	StepDiffer       StepKind = "Differ"
)

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is one immutable scalar carried through query execution.

func BooleanValue

func BooleanValue(value bool) Value

BooleanValue constructs a Boolean value.

func ConnectorEndValue added in v0.10.0

func ConnectorEndValue(connector *symbols.Symbol, position int, label string) Value

ConnectorEndValue constructs the value of end position of connector, labelled by the attachment it names (`bench.ccd.usb`), with the connector as provenance.

func ElementValue

func ElementValue(sym *symbols.Symbol) Value

ElementValue constructs an element value with declaration provenance.

func EventValue

func EventValue(event Event) Value

EventValue constructs an event value; its provenance is the object's declaration.

func IntegerOf added in v0.10.0

func IntegerOf(value semantics.Value) Value

IntegerOf constructs the integer value of the Integer constant value, which may lie beyond int64.

func IntegerValue

func IntegerValue(value int64) Value

IntegerValue constructs an integer value.

func ObjectValue

func ObjectValue(inst *runtime.Instance, label string) Value

ObjectValue constructs a runtime object value under the label a session reaches it by (`car.wheels[2]`, `#7`), with its declaration as provenance.

func QuantityValue

func QuantityValue(quantity semantics.Quantity) Value

QuantityValue constructs a quantity value from a magnitude in a unit; the quantity is deep-copied, so the value stays immutable.

func RationalOf added in v0.10.0

func RationalOf(value semantics.Value) Value

RationalOf constructs the value of the exact Rational constant value.

func ReadFeature added in v0.12.0

func ReadFeature(context Context, row Value, property string, options Options) ([]Value, error)

ReadFeature reads one feature of a row as a span column's cell does: the property is a feature name or member path below the row, read from the declared model for an element row and from the object for a session row. Absent features answer no values; a feature that cannot be evaluated is an unevaluable-feature error.

func RealValue

func RealValue(value float64) Value

RealValue constructs a real value.

func StateValue

func StateValue(state State) Value

StateValue constructs a state value; its declaration is the state.

func StringValue

func StringValue(value string) Value

StringValue constructs a string value.

func VerdictValue

func VerdictValue(verdict Verdict) Value

VerdictValue constructs a verdict value; its declaration is the assertion.

func (Value) Boolean

func (v Value) Boolean() (bool, bool)

Boolean returns the value's Boolean and whether it is a Boolean value.

func (Value) ConnectorEnd added in v0.10.0

func (v Value) ConnectorEnd() (*symbols.Symbol, int, bool)

ConnectorEnd returns the connector and end position a connector-end value stands for, and whether it is one.

func (Value) Declaration

func (v Value) Declaration() *symbols.Symbol

Declaration returns the element a value is declared by: an element itself, the usage or definition an object stands for, the assertion a verdict is about, the state a state row is of, the behavior an event row came from (its object's declaration when the record names none), and nil for a scalar.

func (Value) Element

func (v Value) Element() (*symbols.Symbol, bool)

Element returns the value's element and whether it is an element value.

func (Value) Event

func (v Value) Event() (Event, bool)

Event returns the value's event and whether it is an event value.

func (Value) Integer

func (v Value) Integer() (int64, bool)

Integer returns the value's integer and whether it is an integer value within int64; IntegerConst reads any integer value.

func (Value) IntegerConst added in v0.10.0

func (v Value) IntegerConst() (semantics.Value, bool)

IntegerConst returns the value's Integer, of any size, and whether it is an integer value.

func (Value) Kind

func (v Value) Kind() ValueKind

Kind returns the value's scalar kind.

func (Value) Label added in v0.10.0

func (v Value) Label() string

Label is the text a connector-end value is labelled by: the attachment it names, as written on the connector.

func (Value) Magnitude

func (v Value) Magnitude() (Value, bool)

Magnitude returns a quantity value's magnitude as the bare integer or real value it is, and whether the value is a quantity.

func (Value) Object

func (v Value) Object() (*runtime.Instance, string, bool)

Object returns the value's runtime object, the label it is reached by, and whether it is an object value.

func (Value) Origin

func (v Value) Origin() symbols.Origin

Origin returns the source declaration behind the value.

func (Value) Quantity

func (v Value) Quantity() (semantics.Quantity, bool)

Quantity returns an independent copy of the value's quantity and whether it is a quantity value.

func (Value) Rational added in v0.10.0

func (v Value) Rational() (semantics.Value, bool)

Rational returns the value's exact Rational and whether it is a rational value.

func (Value) Real

func (v Value) Real() (float64, bool)

Real returns the value's real and whether it is a real value.

func (Value) State

func (v Value) State() (State, bool)

State returns the value's state and whether it is a state value.

func (Value) String

func (v Value) String() (string, bool)

String returns the value's string and whether it is a string value.

func (Value) Verdict

func (v Value) Verdict() (Verdict, bool)

Verdict returns the value's verdict and whether it is a verdict value.

type ValueKind

type ValueKind string

ValueKind classifies one scalar query value.

const (
	ValueElement ValueKind = "element"
	// ValueObject is a runtime object a session holds, `car.wheels[2]`, as opposed
	// to the model element declaring it.
	ValueObject ValueKind = "object"
	// ValueVerdict is an assertion checked about an object, carried as a row whose
	// declaration is the asserting element.
	ValueVerdict ValueKind = "verdict"
	// ValueState is one active state of an object's state machine, carried as a
	// row whose declaration is the state.
	ValueState ValueKind = "state"
	// ValueEvent is one record of a session's trace, carried as a row whose
	// declaration is the behavior that made it.
	ValueEvent   ValueKind = "event"
	ValueString  ValueKind = "string"
	ValueInteger ValueKind = "integer"
	ValueReal    ValueKind = "real"
	// ValueRational is an exact non-integer Rational, `1/3` or `0.1`.
	ValueRational ValueKind = "rational"
	ValueBoolean  ValueKind = "boolean"
	ValueInfinity ValueKind = "infinity"
	// ValueQuantity is a magnitude in a measurement unit, `2290000 [kg]`.
	ValueQuantity ValueKind = "quantity"
	// ValueConnectorEnd is one end of a connector usage, reached by navigating
	// its Connector::connectorEnd: it names the features its attachment walks.
	ValueConnectorEnd ValueKind = "connectorEnd"
)

type Verdict

type Verdict struct {
	// contains filtered or unexported fields
}

Verdict is one row of Verdicts: an assertion checked about one object, and how it came out. Immutable once built.

func (Verdict) Assertion

func (v Verdict) Assertion() *symbols.Symbol

Assertion is the asserting element: the constraint, requirement, satisfy usage or verification case.

func (Verdict) Carrier

func (v Verdict) Carrier() (*runtime.Instance, bool)

Carrier is the object the assertion was checked on, and whether the query's session holds it rather than the check having materialized it as declared.

func (Verdict) CarrierDeclaration

func (v Verdict) CarrierDeclaration() *symbols.Symbol

CarrierDeclaration is the element the carrier stands for in the model.

func (Verdict) Condition

func (v Verdict) Condition() string

Condition is the condition that evaluated to false on a violated verdict.

func (Verdict) Kind

func (v Verdict) Kind() runtime.AssertionKind

Kind is the kind of assertion checked: constraint, requirement, satisfaction or verification.

func (Verdict) Label

func (v Verdict) Label() string

Label names the verdict: the assertion as written on its carrier's path.

func (Verdict) Path

func (v Verdict) Path() string

Path names the carrier from the row checked: its label, then the features walked to the carrier (`car.wheels[2]`).

func (Verdict) Reason

func (v Verdict) Reason() string

Reason is why the assertion is violated or undecided; empty when it holds.

func (Verdict) Requirement

func (v Verdict) Requirement() *symbols.Symbol

Requirement is the requirement a requirement, satisfaction or verification verdict is about; nil for a constraint.

func (Verdict) Status

func (v Verdict) Status() runtime.ValidationStatus

Status is how the assertion came out.

func (Verdict) Summary

func (v Verdict) Summary() string

Summary is the verdict in one line: its label and status.

func (Verdict) Text

func (v Verdict) Text() string

Text is the assertion as written (`constraint massLimit`), naming an anonymous one.

func (Verdict) Verification

func (v Verdict) Verification() []runtime.VerdictKind

Verification is the verdict kinds of the verification cases the row reports: its own case on a verification row, those verifying its requirement otherwise.

Directories

Path Synopsis
Package elementids gives queries the elementId a conversion of the model writes for each element, read from the RDF export; a binary links it to fill the column, and one that does not reports elementId absent.
Package elementids gives queries the elementId a conversion of the model writes for each element, read from the RDF export; a binary links it to fill the column, and one that does not reports elementId absent.

Jump to

Keyboard shortcuts

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