{"modulePath":"github.com/Open-MBEE/OpenSysML","version":"v0.13.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package modelform\n\nPackage modelform is the forms of a model an external engine reads: the sources form and the versioned graphs:1 form of the lowered action and state graphs.\n\n## Constants\n\n```go\nconst GraphsVersion = 1\n```\nGraphsVersion is the version of the \\`graphs:\\\u003cv\u003e\\` form this build writes. It moves when a field the form carries changes meaning, is removed or is renamed; an added field keeps the version.\n\n## Variables\n\n```go\nvar ErrFormUnsupported = errors.New(\"export: model form not supported\")\n```\nErrFormUnsupported reports a model form this build does not export for an engine.\n\n```go\nvar ErrGraphsOrder = errors.New(\"graphs: elements of one graph cannot be ordered\")\n```\nErrGraphsOrder reports two graph elements the export cannot tell apart, which would make the output depend on memory layout; the lowering never produces them.\n\n```go\nvar ErrGraphsSubject = errors.New(\"graphs: subject has no lowered graph\")\n```\nErrGraphsSubject reports a subject no lowered graph is exported for: not an action or a state machine, or one the lowering refuses.\n\n```go\nvar ErrNoSources = errors.New(\"export: the model has no source documents\")\n```\nErrNoSources reports a model that registered no document to export.\n\n## Functions\n\n```go\nfunc MarshalGraphs(g *Graphs) ([]byte, error)\n```\nMarshalGraphs writes the form as canonical JSON: keys in struct order, no indentation, one trailing newline. encoding/json writes map keys sorted and the form holds no map, so the bytes are a function of the model alone.\n\n```go\nfunc RefuseRDFForm() error\n```\nRefuseRDFForm is the typed refusal of the \\`rdf\\` model form for an engine: the design defines it and the stage that adds policies and samplers delivers it.\n\n## Types\n\n```go\ntype AcceptForm struct {\n\tParam        string       `json:\"param,omitempty\"`\n\tSignalType   string       `json:\"signalType,omitempty\"`\n\tViaPort      string       `json:\"viaPort,omitempty\"`\n\tViaSelf      bool         `json:\"viaSelf,omitempty\"`\n\tSubsetsEvent *ExprForm    `json:\"subsetsEvent,omitempty\"`\n\tTrigger      *TriggerForm `json:\"trigger,omitempty\"`\n\tScope        string       `json:\"scope,omitempty\"`\n}\n```\nAcceptForm is what an accept node or a transition trigger receives.\n\n```go\ntype ActionForm struct {\n\t// Name is the qualified name of the action; Kind is its symbol kind.\n\tName string `json:\"name\"`\n\tKind string `json:\"kind\"`\n\t// Error is the lowering's refusal of a performed action, with no graph beside it.\n\tError string `json:\"error,omitempty\"`\n\t// Scope is the scope the action's body resolves names in.\n\tScope string `json:\"scope,omitempty\"`\n\t// Parameters is the signature a caller writes and reads back, in invocation\n\t// order: the action's own, then the inherited ones none redefines.\n\tParameters []ParameterForm `json:\"parameters,omitempty\"`\n\tAttributes []AttributeForm `json:\"attributes,omitempty\"`\n\tNodes      []NodeForm      `json:\"nodes\"`\n\t// Initial is the vertex the flow starts at, absent for a graph without one.\n\tInitial *int `json:\"initial,omitempty\"`\n\t// Concurrent are the subactions no succession reaches, started with the flow.\n\tConcurrent []int `json:\"concurrent,omitempty\"`\n\tFinals     []int `json:\"finals,omitempty\"`\n\t// Edges are the control flows, by source vertex then declaration order.\n\tEdges []EdgeForm `json:\"edges,omitempty\"`\n\t// Flows are the object flows between pins, by source vertex then declaration order.\n\tFlows       []ObjectFlowForm `json:\"flows,omitempty\"`\n\tBindings    []PinBindingForm `json:\"bindings,omitempty\"`\n\tConnections []ConnectionForm `json:\"connections,omitempty\"`\n}\n```\nActionForm is one lowered ActionGraph. Vertices are numbered by their position in Nodes; every other field refers to them by that number.\n\n```go\ntype AttributeForm struct {\n\tName  string    `json:\"name\"`\n\tTypes []string  `json:\"types,omitempty\"`\n\tUnit  string    `json:\"unit,omitempty\"`\n\tValue *ExprForm `json:\"value,omitempty\"`\n\tSpan  SpanForm  `json:\"span\"`\n\tScope string    `json:\"scope,omitempty\"`\n}\n```\nAttributeForm is an attribute the behavior declares, with the types and unit the semantic model derives for it.\n\n```go\ntype BehaviorForm struct {\n\tName  string   `json:\"name,omitempty\"`\n\tSpan  SpanForm `json:\"span\"`\n\tScope string   `json:\"scope,omitempty\"`\n\t// Owner is the state whose attributes the behavior reads and writes.\n\tOwner *int            `json:\"owner,omitempty\"`\n\tBody  []StatementForm `json:\"body\"`\n\t// Nodes are the action nodes the body's blocks declare, each a\n\t// subperformance of the behavior's, by name.\n\tNodes []string `json:\"nodes,omitempty\"`\n}\n```\nBehaviorForm is an entry, do, exit or effect behavior.\n\n```go\ntype BlockForm struct {\n\tStatements []StatementForm `json:\"statements\"`\n\tScope      string          `json:\"scope,omitempty\"`\n\tOwn        bool            `json:\"own,omitempty\"`\n\tStated     bool            `json:\"stated,omitempty\"`\n\tGraph      *ActionForm     `json:\"graph,omitempty\"`\n}\n```\nBlockForm is a block of statements, with the flow graph of one that states a flow of its own.\n\n```go\ntype ChainForm struct {\n\tBase  *ExprForm `json:\"base,omitempty\"`\n\tSteps []string  `json:\"steps,omitempty\"`\n\tText  string    `json:\"text\"`\n}\n```\nChainForm is a feature chain walked from a base expression.\n\n```go\ntype ChannelForm struct {\n\tSignal string `json:\"signal,omitempty\"`\n\tPort   string `json:\"port,omitempty\"`\n}\n```\nChannelForm is one message a move sends or waits for: the signal type as written (absent for any) and the port it travels through (absent for none).\n\n```go\ntype ConnectionForm struct {\n\tEnds      []string `json:\"ends\"`\n\tVariation string   `json:\"variation,omitempty\"`\n\tVariant   string   `json:\"variant,omitempty\"`\n\tOwner     string   `json:\"owner\"`\n\tScope     string   `json:\"scope,omitempty\"`\n}\n```\nConnectionForm is a connector the behavior routes a \\`send … via\\` through.\n\n```go\ntype Document struct {\n\tPath string `json:\"path\"`\n\tText string `json:\"text\"`\n}\n```\nDocument is one source document of the model, its registered name and its text.\n\n```go\ntype EdgeForm struct {\n\tSource      int       `json:\"source\"`\n\tTarget      int       `json:\"target\"`\n\tGuard       *ExprForm `json:\"guard,omitempty\"`\n\tElse        bool      `json:\"else,omitempty\"`\n\tProbability *ExprForm `json:\"probability,omitempty\"`\n\tDecl        SpanForm  `json:\"decl\"`\n\t// Gate is the guarded succession leading to the succession flow this edge\n\t// orders (`first a if g then f;`), when one does.\n\tGate *SpanForm `json:\"gate,omitempty\"`\n}\n```\nEdgeForm is a control flow, guarded when Guard is present; Else marks the branch of a decision written as \\`else\\`, taken when no guarded branch is. Probability is the weight a \\`@Probability\\` annotation gives a decision's branch.\n\n```go\ntype EntryTransitionForm struct {\n\t// Body is the state or region the transition is written in; absent for the\n\t// machine's own body.\n\tBody   *int           `json:\"body,omitempty\"`\n\tGuard  *ExprForm      `json:\"guard,omitempty\"`\n\tTarget *int           `json:\"target,omitempty\"`\n\tVia    *int           `json:\"via,omitempty\"`\n\tEffect []BehaviorForm `json:\"effect,omitempty\"`\n\tScope  string         `json:\"scope,omitempty\"`\n\tDecl   SpanForm       `json:\"decl\"`\n}\n```\nEntryTransitionForm is a transition out of the entry action of Body.\n\n```go\ntype ExprForm struct {\n\tText string   `json:\"text\"`\n\tSpan SpanForm `json:\"span\"`\n}\n```\nExprForm is an expression as the graph carries it: its source text and where it was written, so an engine parses the text and the host names the place.\n\n```go\ntype FeatureForm struct {\n\tName      string    `json:\"name\"`\n\tDirection string    `json:\"direction,omitempty\"`\n\tResult    bool      `json:\"result,omitempty\"`\n\tTypes     []string  `json:\"types,omitempty\"`\n\tUnit      string    `json:\"unit,omitempty\"`\n\tValue     *ExprForm `json:\"value,omitempty\"`\n\tSpan      SpanForm  `json:\"span\"`\n\tScope     string    `json:\"scope,omitempty\"`\n}\n```\nFeatureForm is a parameter or attribute a node declares itself.\n\n```go\ntype FootprintForm struct {\n\tReads   []PlaceForm   `json:\"reads,omitempty\"`\n\tWrites  []PlaceForm   `json:\"writes,omitempty\"`\n\tSends   []ChannelForm `json:\"sends,omitempty\"`\n\tAccepts []ChannelForm `json:\"accepts,omitempty\"`\n\tControl []int         `json:\"control,omitempty\"`\n\tDynamic bool          `json:\"dynamic,omitempty\"`\n}\n```\nFootprintForm is a lower.Footprint: the places a move reads and writes, the channels it sends on and accepts from, the joins and merges it converges on (by vertex number) and whether its target is dynamic, in which case it depends on every other move.\n\n```go\ntype FormUnsupportedError struct {\n\tForm   string\n\tReason string\n}\n```\nFormUnsupportedError says which form was asked for and why it is not exported.\n\n```go\nfunc (e *FormUnsupportedError) Error() string\n```\n\n```go\nfunc (e *FormUnsupportedError) Unwrap() error\n```\nUnwrap makes the error match ErrFormUnsupported.\n\n```go\ntype Graphs struct {\n\t// Version is GraphsVersion, first so a reader refuses a version it does not know.\n\tVersion int `json:\"version\"`\n\t// Subject is the qualified name of the behavior the form was exported for.\n\tSubject string `json:\"subject\"`\n\t// Actions are the lowered action graphs, the subject's first when it is an\n\t// action, then the performed ones by name.\n\tActions []*ActionForm `json:\"actions,omitempty\"`\n\t// States are the lowered state graphs, the subject's first when it is a state\n\t// machine, then the exhibited ones by name.\n\tStates []*StateForm `json:\"states,omitempty\"`\n}\n```\nGraphs is the \\`graphs:1\\` form: the lowered graph of a subject and of every behavior it performs, transitively, in a JSON an external engine reads. It is lossless for what the lowered IR carries, and its output is byte for byte the same for the same model.\n\n```go\nfunc GraphsOf(model *runtime.Model, subject *symbols.Symbol) (*Graphs, error)\n```\nGraphsOf exports the lowered graph of subject, an action or a state machine declared in model, and of every behavior it performs, at GraphsVersion.\n\n```go\ntype NodeForm struct {\n\tID   int      `json:\"id\"`\n\tKind string   `json:\"kind\"`\n\tName string   `json:\"name,omitempty\"`\n\tSpan SpanForm `json:\"span\"`\n\t// Scope is the scope the node's own members resolve in, when it owns one.\n\tScope    string        `json:\"scope,omitempty\"`\n\tFeatures []FeatureForm `json:\"features,omitempty\"`\n\t// Body is the node's statements; StatementRun marks a body the node runs as\n\t// statements rather than as a flow of its own.\n\tBody         []StatementForm `json:\"body,omitempty\"`\n\tStatementRun bool            `json:\"statementRun,omitempty\"`\n\t// Block lists the vertices a block's body sequences, for a node that is one.\n\tBlock []int `json:\"block,omitempty\"`\n\t// Accept is the message an accept node waits for.\n\tAccept *AcceptForm `json:\"accept,omitempty\"`\n\t// Subflow is the flow the node's own members state, for a node that has one.\n\tSubflow *SubflowForm `json:\"subflow,omitempty\"`\n\t// Performs are the qualified names of the behaviors the node performs or is\n\t// typed by, as they resolve; each has a graph of its own in the form.\n\tPerforms []string `json:\"performs,omitempty\"`\n\t// Footprint is what advancing a token through the node may touch, the\n\t// independence relation of the model checker; see lower.Footprint.\n\tFootprint *FootprintForm `json:\"footprint,omitempty\"`\n}\n```\nNodeForm is one vertex of an action graph with everything the lowering attached to it.\n\n```go\ntype ObjectFlowForm struct {\n\tName      string   `json:\"name,omitempty\"`\n\tKind      string   `json:\"kind\"`\n\tSource    int      `json:\"source\"`\n\tSourcePin string   `json:\"sourcePin,omitempty\"`\n\tTarget    int      `json:\"target\"`\n\tTargetPin string   `json:\"targetPin,omitempty\"`\n\tDecl      SpanForm `json:\"decl\"`\n\t// Gate is the succession leading to this succession flow, which moves its\n\t// value only when that succession is taken.\n\tGate *SpanForm `json:\"gate,omitempty\"`\n}\n```\nObjectFlowForm is a data flow from a pin of Source to a pin of Target. Kind is how it carries its values: \"streaming\" (a plain \\`flow\\`) or \"succession\".\n\n```go\ntype ParameterForm struct {\n\tName      string    `json:\"name\"`\n\tDirection string    `json:\"direction,omitempty\"`\n\tResult    bool      `json:\"result,omitempty\"`\n\tOptional  bool      `json:\"optional,omitempty\"`\n\tTypes     []string  `json:\"types,omitempty\"`\n\tUnit      string    `json:\"unit,omitempty\"`\n\tValue     *ExprForm `json:\"value,omitempty\"`\n\tSpan      SpanForm  `json:\"span\"`\n\tScope     string    `json:\"scope,omitempty\"`\n}\n```\nParameterForm is one parameter of the action's signature. Optional marks one a caller may leave out: it declares a default or its multiplicity admits no value.\n\n```go\ntype PinBindingForm struct {\n\tNode         *int       `json:\"node,omitempty\"`\n\tPath         []string   `json:\"path,omitempty\"`\n\tPin          string     `json:\"pin,omitempty\"`\n\tOther        *ExprForm  `json:\"other,omitempty\"`\n\tOtherNode    *int       `json:\"otherNode,omitempty\"`\n\tOtherPath    []string   `json:\"otherPath,omitempty\"`\n\tOtherPin     string     `json:\"otherPin,omitempty\"`\n\tOtherChain   *ChainForm `json:\"otherChain,omitempty\"`\n\tOtherFeature string     `json:\"otherFeature,omitempty\"`\n\tScope        string     `json:\"scope,omitempty\"`\n\tDecl         SpanForm   `json:\"decl\"`\n\tFromValue    bool       `json:\"fromValue,omitempty\"`\n}\n```\nPinBindingForm is a binding connector with an end at a node's pin; see lower.PinBinding for the reading of each field.\n\n```go\ntype PlaceForm struct {\n\tSymbol string `json:\"symbol,omitempty\"`\n\tName   string `json:\"name\"`\n\tLocal  bool   `json:\"local,omitempty\"`\n}\n```\nPlaceForm is one feature a move touches: the qualified name of the declaration it resolves to (absent when unresolved), the name it was written under, and whether it is a pin, held per performance.\n\n```go\ntype RegionForm struct {\n\tID   int      `json:\"id\"`\n\tName string   `json:\"name,omitempty\"`\n\tSpan SpanForm `json:\"span\"`\n\t// Owner is the composite state the region is in; Top marks a region of the\n\t// machine's own body.\n\tOwner *int `json:\"owner,omitempty\"`\n\tTop   bool `json:\"top,omitempty\"`\n\t// State is the graph-only state standing for the region, holding the\n\t// attributes its body declares.\n\tState   *int `json:\"state,omitempty\"`\n\tInitial *int `json:\"initial,omitempty\"`\n}\n```\nRegionForm is a region of a composite state.\n\n```go\ntype Sources struct {\n\tLibrary   string     `json:\"library\"`\n\tDocuments []Document `json:\"documents\"`\n}\n```\nSources is the \\`sources\\` model form: every document of the model as text, in path order, and the version of the standard library the host loaded beside them.\n\n```go\nfunc SourcesOf(model *runtime.Model) (*Sources, error)\n```\nSourcesOf exports the \\`sources\\` form of a model: the registered documents in name order with their whole text, and libs.Version for the standard library.\n\n```go\ntype SpanForm struct {\n\tDocument string `json:\"document,omitempty\"`\n\tOffset   int    `json:\"offset\"`\n\tLen      int    `json:\"len\"`\n}\n```\nSpanForm locates a node in the model's text: the document and the byte span.\n\n```go\ntype StateForm struct {\n\t// Name is the qualified name of the state machine; Kind is its symbol kind.\n\tName string `json:\"name\"`\n\tKind string `json:\"kind\"`\n\t// Error is the lowering's refusal of an exhibited machine, with no graph beside it.\n\tError string `json:\"error,omitempty\"`\n\t// Scope is the scope the machine's body resolves names in.\n\tScope      string          `json:\"scope,omitempty\"`\n\tAttributes []AttributeForm `json:\"attributes,omitempty\"`\n\t// Machine is the vertex standing for the machine itself; Initial the state\n\t// it starts in, absent when the entry transitions choose it.\n\tMachine  *int              `json:\"machine,omitempty\"`\n\tInitial  *int              `json:\"initial,omitempty\"`\n\tVertices []StateVertexForm `json:\"vertices\"`\n\tRegions  []RegionForm      `json:\"regions,omitempty\"`\n\t// Transitions are by source vertex, then declaration order.\n\tTransitions []TransitionForm `json:\"transitions,omitempty\"`\n\t// EntryTransitions are the transitions out of an entry action, by the body\n\t// they are written in: a state, a region, or the machine's own body.\n\tEntryTransitions []EntryTransitionForm `json:\"entryTransitions,omitempty\"`\n\tConnections      []ConnectionForm      `json:\"connections,omitempty\"`\n}\n```\nStateForm is one lowered StateGraph. Vertices — the machine, its states and pseudostates, the graph-only states the lowering synthesizes for orthogonal regions — are numbered by their position in Vertices; regions by theirs in Regions. Every other field refers to them by those numbers.\n\n```go\ntype StateVertexForm struct {\n\tID   int      `json:\"id\"`\n\tKind string   `json:\"kind\"`\n\tName string   `json:\"name,omitempty\"`\n\tSpan SpanForm `json:\"span\"`\n\t// Scope is the scope the state's own members resolve in.\n\tScope string `json:\"scope,omitempty\"`\n\t// Hidden marks a graph-only state the lowering synthesized; HiddenRegion is\n\t// the region it stands for.\n\tHidden       bool `json:\"hidden,omitempty\"`\n\tHiddenRegion *int `json:\"hiddenRegion,omitempty\"`\n\t// Parent is the composite state a substate is in; Region the region it is in.\n\tParent *int `json:\"parent,omitempty\"`\n\tRegion *int `json:\"region,omitempty\"`\n\t// Owner is the state a pseudostate belongs to; absent for the machine's own.\n\tOwner *int `json:\"owner,omitempty\"`\n\t// Regions are a composite state's regions, in order.\n\tRegions    []int           `json:\"regions,omitempty\"`\n\tAttributes []AttributeForm `json:\"attributes,omitempty\"`\n\tEntry      []BehaviorForm  `json:\"entry,omitempty\"`\n\tDo         []BehaviorForm  `json:\"do,omitempty\"`\n\tExit       []BehaviorForm  `json:\"exit,omitempty\"`\n}\n```\nStateVertexForm is a state, a pseudostate or the machine, with everything the lowering attached to it.\n\n```go\ntype StatementForm struct {\n\tKind  string   `json:\"kind\"`\n\tSpan  SpanForm `json:\"span\"`\n\tScope string   `json:\"scope,omitempty\"`\n\t// send\n\tMessage      *ExprForm `json:\"message,omitempty\"`\n\tTarget       string    `json:\"target,omitempty\"`\n\tTargetSymbol string    `json:\"targetSymbol,omitempty\"`\n\tTargetPath   bool      `json:\"targetPath,omitempty\"`\n\tTargetExpr   *ExprForm `json:\"targetExpr,omitempty\"`\n\tVia          bool      `json:\"via,omitempty\"`\n\tViaSelf      bool      `json:\"viaSelf,omitempty\"`\n\tReceiver     string    `json:\"receiver,omitempty\"`\n\tReceiverPath bool      `json:\"receiverPath,omitempty\"`\n\tReceiverExpr *ExprForm `json:\"receiverExpr,omitempty\"`\n\t// assign, declare, declare usage\n\tName  string     `json:\"name,omitempty\"`\n\tChain *ChainForm `json:\"chain,omitempty\"`\n\tValue *ExprForm  `json:\"value,omitempty\"`\n\t// loop\n\tLoop       string     `json:\"loop,omitempty\"`\n\tCondition  *ExprForm  `json:\"condition,omitempty\"`\n\tUntil      *ExprForm  `json:\"until,omitempty\"`\n\tVariable   string     `json:\"variable,omitempty\"`\n\tCollection *ExprForm  `json:\"collection,omitempty\"`\n\tBody       *BlockForm `json:\"body,omitempty\"`\n\t// if\n\tThen *BlockForm `json:\"then,omitempty\"`\n\tElse *BlockForm `json:\"else,omitempty\"`\n\t// effect\n\tEffect   string   `json:\"effect,omitempty\"`\n\tPerforms []string `json:\"performs,omitempty\"`\n\t// unsupported\n\tDescription string `json:\"description,omitempty\"`\n}\n```\nStatementForm is one lowered statement; Kind selects which fields are set.\n\n```go\ntype SubflowForm struct {\n\tGraph *ActionForm `json:\"graph,omitempty\"`\n\tError string      `json:\"error,omitempty\"`\n}\n```\nSubflowForm is the flow nested under a node: its graph, or the lowering's refusal.\n\n```go\ntype TransitionForm struct {\n\tName    string         `json:\"name,omitempty\"`\n\tSource  int            `json:\"source\"`\n\tTarget  int            `json:\"target\"`\n\tTrigger *TriggerForm   `json:\"trigger,omitempty\"`\n\tGuard   *ExprForm      `json:\"guard,omitempty\"`\n\tEffect  []BehaviorForm `json:\"effect,omitempty\"`\n\tVia     string         `json:\"via,omitempty\"`\n\tScope   string         `json:\"scope,omitempty\"`\n\t// BodyScope is the scope the guard and effect resolve in, when it differs\n\t// from Scope: a call trigger's parameters are visible there alone.\n\tBodyScope string   `json:\"bodyScope,omitempty\"`\n\tDecl      SpanForm `json:\"decl\"`\n}\n```\nTransitionForm is a transition; a nil Trigger is a completion transition.\n\n```go\ntype TriggerForm struct {\n\tKind string   `json:\"kind\"`\n\tText string   `json:\"text,omitempty\"`\n\tSpan SpanForm `json:\"span\"`\n\t// accept\n\tSignalType string `json:\"signalType,omitempty\"`\n\tSubsets    string `json:\"subsets,omitempty\"`\n\tPayload    string `json:\"payload,omitempty\"`\n\t// call\n\tOperation  string   `json:\"operation,omitempty\"`\n\tParameters []string `json:\"parameters,omitempty\"`\n\t// change\n\tCondition *ExprForm `json:\"condition,omitempty\"`\n\t// time\n\tDuration *ExprForm `json:\"duration,omitempty\"`\n\tAbsolute bool      `json:\"absolute,omitempty\"`\n}\n```\nTriggerForm is a trigger event as classified by the lowering: an accepted signal, a change of a condition, or a time.\n\n","path":"github.com/Open-MBEE/OpenSysML/internal/exec/analysis/modelform","name":"modelform","synopsis":"Package modelform is the forms of a model an external engine reads: the sources form and the versioned graphs:1 form of the lowered action and state graphs.","isRedistributable":true}
