{"modulePath":"github.com/Open-MBEE/OpenSysML","version":"v0.13.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package record\n\nPackage record generates the SysML declarations that record an analysis run, a sweep or a Monte-Carlo sample into the model it ran on, as usages of the bundled AnalysisRecords library.\n\n## Functions\n\n```go\nfunc Attributes(idx *symbols.Index, sem *semantics.Model, def *symbols.Symbol) map[string]Feature\n```\nAttributes are the features a record definition declares, by name, each with whether it is a reference and the name of its declared type.\n\n```go\nfunc ShortName(fqn string) string\n```\nShortName is the last segment of a qualified name.\n\n## Types\n\n```go\ntype Existing struct {\n\t// Package marks the target package already declared.\n\tPackage bool\n\n\t// Definition marks the per-case record definition already declared in it.\n\tDefinition bool\n\n\t// Attributes are the features the existing definition declares, by name.\n\tAttributes map[string]Feature\n\n\t// Taken are the N for which \u003ccase\u003e_runN is already declared in the package.\n\tTaken map[int]bool\n\n\t// Stem is the name the records and their definition are built on — the\n\t// case's short name, or an owner-prefixed fallback a sibling case's\n\t// definition forced.\n\tStem string\n}\n```\nExisting is what Generate must fit the records it makes into.\n\n```go\ntype Feature struct {\n\t// Ref marks a `ref part`, an object-valued feature; unset is an attribute.\n\tRef bool\n\n\t// TypeFQN is the qualified name of the feature's declared type.\n\tTypeFQN string\n\n\t// Multi marks a feature whose declared multiplicity admits more than one\n\t// value.\n\tMulti bool\n\n\t// Unique marks a multi-valued feature that holds no two equal values.\n\tUnique bool\n}\n```\nFeature is one member an existing record definition declares.\n\n```go\ntype Kind string\n```\nKind is the run shape a record's \\`kind\\` feature reports.\n\n```go\nconst (\n\t// KindRun records one run of an analysis case.\n\tKindRun Kind = \"run\"\n\t// KindTrade records one run of an analysis case that evaluated alternatives.\n\tKindTrade Kind = \"trade\"\n\t// KindSweep records the runs of a sweep.\n\tKindSweep Kind = \"sweep\"\n\t// KindRuns records the runs of a Monte-Carlo sample.\n\tKindRuns Kind = \"runs\"\n\t// KindSample records the conclusion a Monte-Carlo sample made, beside the\n\t// runs it was made of.\n\tKindSample Kind = \"sample\"\n)\n```\n\n```go\ntype Placement struct {\n\tPackage  string\n\tCaseName string\n\tExisting Existing\n}\n```\nPlacement is where a case's records go: the package, the case's declared name, and what the package already holds of the shape Generate must fit.\n\n```go\nfunc Place(idx *symbols.Index, fqn, into string) (Placement, error)\n```\nPlace finds the package the records of the case fqn names go into — into when named, else Records beside the package enclosing the case's own — and what it already holds.\n\n```go\ntype Provenance struct {\n\t// RunAt is when the run was made; recorded in UTC.\n\tRunAt time.Time\n\n\t// Tool names the program that ran it.\n\tTool string\n\n\t// Command is the invocation text that ran it.\n\tCommand string\n\n\t// Kind is the run shape the records report.\n\tKind Kind\n}\n```\nProvenance is what a recorded run reports about how it was made.\n\n```go\ntype Request struct {\n\t// Package is the qualified name of the package the records go into, e.g.\n\t// \"Records\" or \"Mission::Records\".\n\tPackage string\n\n\t// Case is the qualified name of the analysis case the runs were made of.\n\tCase string\n\n\t// CaseName is the case's declared name as written, quoting needs included;\n\t// the records and their definition are named from it. Empty falls back to\n\t// Case's last qualified-name segment.\n\tCaseName string\n\n\t// Provenance is what every record reports about how it was made.\n\tProvenance Provenance\n\n\t// Runs are the runs to record, in order.\n\tRuns []Run\n\n\t// Existing is what the target package already holds.\n\tExisting Existing\n}\n```\nRequest is one call to Generate.\n\n```go\ntype Result struct {\n\t// Source is the declaration text: the target package's full nesting down to\n\t// it, holding the record definition when new and every record usage.\n\tSource string\n\n\t// Definition is the qualified name of the per-case record definition.\n\tDefinition string\n\n\t// Records are the qualified names of the record usages, in order.\n\tRecords []string\n}\n```\nResult is what Generate made.\n\n```go\nfunc Generate(req Request) (Result, error)\n```\nGenerate renders the declarations recording req's runs.\n\n```go\ntype Run struct {\n\t// Iteration is the run's position in a sweep or sample; 0 for a single run.\n\tIteration int\n\n\t// Subject is the object the run was made on.\n\tSubject Subject\n\n\t// Inputs are the values the run bound the case's input parameters to.\n\tInputs []runtime.InputBinding\n\n\t// Outputs are the values the run's declared outputs came to.\n\tOutputs []runtime.CalcOutputValue\n\n\t// Verdicts are what the run's checks decided.\n\tVerdicts []runtime.AnalysisVerdict\n\n\t// Evaluations are the calc applications the run made.\n\tEvaluations []runtime.AnalysisEvaluation\n\n\t// Kind is the run shape this record makes; empty, the request's kind.\n\tKind Kind\n\n\t// Verifications are what a verification case's body and its subcases\n\t// decided, for a case that is one.\n\tVerifications []runtime.VerificationVerdict\n\n\t// Tools is what every external tool call this run made ran, in call order.\n\tTools []string\n\n\t// Spell renders the run's values for the text it cannot supply itself, in\n\t// the context it was made in — a sweep's rows each carry their own.\n\tSpell Spelling\n}\n```\nRun is everything one run of a case contributes to its record.\n\n```go\ntype Spelling struct {\n\t// ObjectUsage is the qualified name of the usage an object value is an\n\t// occurrence of, or \"\" when the value names no single usage.\n\tObjectUsage func(v runtime.Value) string\n\n\t// Text is a value's text for the surfaces that record it as a string.\n\tText func(v runtime.Value) string\n\n\t// Unset reports a value records nothing: null, or a feature holding none.\n\tUnset func(v runtime.Value) bool\n}\n```\nSpelling renders a run's values for the text it cannot supply itself.\n\n```go\nfunc SpellingIn(idx *symbols.Index, contexts map[*runtime.Context]bool, fallback *runtime.Context, text func(*runtime.Context, runtime.Value) string) Spelling\n```\n\n```go\ntype Subject struct {\n\t// Usage is the subject object's qualified name, or \"\" when it has none.\n\tUsage string\n\n\t// Text is the subject as subjectName reports it.\n\tText string\n}\n```\nSubject is how a run's object is recorded: its usage in the model, and its text for subjectName.\n\n```go\nfunc SubjectOf(idx *symbols.Index, inst *runtime.Instance, label string, contexts map[*runtime.Context]bool, text func(*runtime.Context, runtime.Value) string) Subject\n```\nSubjectOf names the object a run was made on: its usage when one usage alone declares it, else its text in the context it lives in, else label.\n\n","path":"github.com/Open-MBEE/OpenSysML/internal/exec/analysis/record","name":"record","synopsis":"Package record generates the SysML declarations that record an analysis run, a sweep or a Monte-Carlo sample into the model it ran on, as usages of the bundled AnalysisRecords library.","isRedistributable":true}
