Documentation
¶
Overview ¶
Package migrate writes a SysML v1 model, read from XMI, as SysML v2 textual notation, and reports what each v1 element became.
A diagram's symbols become a view's DiagramLayout annotations. The compartments a modeler collapsed on a symbol (its SUPPRESS_* properties, own or inherited from its symbol style) become the Layout's show… switches by the kind their members take in v2: parts → showParts, references → showReferences, properties, values and class attributes → showAttributes, constraints → showConstraints, flow properties → showItems, proxy, full and class ports → showPorts, operations → showActions (compartmentKinds). A kind is hidden when every Cameo compartment the symbol states for it is suppressed; a suppressed compartment with no v2 kind is reported as an unsupported presentation property.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// ID is the element's xmi:id, the handle a v1 tool addresses it by.
ID string `json:"id"`
// Kind is the v1 element as modeled: its stereotype when one classifies it
// («Block», «Requirement»), else its UML metaclass.
Kind string `json:"kind"`
// Name is the element's qualified name in the v1 model.
Name string `json:"name"`
// Target is the v2 declaration written for it (a qualified name with its
// keyword), or "" when nothing was.
Target string `json:"target,omitempty"`
Verdict Verdict `json:"verdict"`
// Note explains an approximation or an omission.
Note string `json:"note,omitempty"`
}
Entry records the verdict on one v1 element.
type LayoutSummary ¶
type LayoutSummary struct {
Source string `json:"source"`
MTIPVersion string `json:"mtipVersion,omitempty"`
CameoVersion string `json:"cameoVersion,omitempty"`
ExportTime string `json:"exportTime,omitempty"`
// Diagrams counts the export's diagram records; DiagramsJoined those whose
// diagram's view was written and laid out, DiagramsUnmatched those whose
// diagram is not written as a view or matches none — joined + unmatched
// always equals Diagrams.
Diagrams int `json:"diagrams"`
DiagramsJoined int `json:"diagramsJoined"`
DiagramsUnmatched int `json:"diagramsUnmatched"`
// ViewsWithoutLayout counts the written views the export does not cover.
ViewsWithoutLayout int `json:"viewsWithoutLayout"`
// GeometryOmitted counts the joined or stream-laid-out views whose
// geometry a strict migration leaves unwritten, DiagramLayout being OpenSysML's.
GeometryOmitted int `json:"geometryOmitted,omitempty"`
// Placements counts the shown elements the export positions;
// PlacementsWritten those positioned into a view, PlacementsUnexposed
// those the view neither exposes nor draws, PlacementsOnEdges those whose
// symbol lies on a connection's route — an association or connector end,
// which the route carries — PlacementsDangling those resolving to no
// element. Routes likewise per connector, RoutesUnexposed counting every
// route pinned to no member, for the reasons RoutesByKind itemizes.
Placements int `json:"placements"`
PlacementsWritten int `json:"placementsWritten"`
PlacementsUnexposed int `json:"placementsUnexposed"`
PlacementsOnEdges int `json:"placementsOnEdges,omitempty"`
PlacementsDangling int `json:"placementsDangling"`
Routes int `json:"routes"`
RoutesWritten int `json:"routesWritten"`
RoutesUnexposed int `json:"routesUnexposed"`
RoutesDangling int `json:"routesDangling"`
// RoutesByKind itemizes the routes by the connector's v1 kind and why each
// is or is not pinned to a member of the view.
RoutesByKind []RouteKind `json:"routesByKind,omitempty"`
// Malformed counts the export's malformed records; Unsupported the
// presentation properties DiagramLayout carries no attribute for, by tag.
Malformed int `json:"malformed"`
Unsupported map[string]int `json:"unsupported,omitempty"`
// StreamDiagrams counts the views laid out from their diagram's own symbol
// stream alone, the export holding no record for the diagram;
// StreamSupplemented the joined views whose stream placed or routed an
// element the export's record did not.
StreamDiagrams int `json:"streamDiagrams"`
StreamSupplemented int `json:"streamSupplemented,omitempty"`
// Styles counts the symbols drawn in colours or a font of their own;
// StylesWritten those whose element the view lays out, so a Style is written.
Styles int `json:"styles"`
StylesWritten int `json:"stylesWritten"`
// CompartmentsSuppressed counts the compartment switches written, over
// SymbolsSuppressing placed symbols that suppress at least one compartment.
CompartmentsSuppressed int `json:"compartmentsSuppressed,omitempty"`
SymbolsSuppressing int `json:"symbolsSuppressing,omitempty"`
// Notes counts the comments and text boxes drawn, every one written as a
// Note; NotesAnchored those anchored to an element the view lays out,
// NotesFreed those whose anchor reaches none, written free on the view.
Notes int `json:"notes"`
NotesAnchored int `json:"notesAnchored"`
NotesFreed int `json:"notesFreed"`
// Pictures counts the pasted images carried; PicturesWritten those written and drawn, PicturesUnderlaid
// among them those drawn under symbols they lay over, PicturesUndrawn those on a view whose table draws none.
Pictures int `json:"pictures"`
PicturesWritten int `json:"picturesWritten"`
PicturesUnderlaid int `json:"picturesUnderlaid,omitempty"`
PicturesUndrawn int `json:"picturesUndrawn,omitempty"`
// Dropped counts the free symbols standing for no element and written as
// nothing, the pasted images not written among them, by the tool's symbol class.
Dropped map[string]int `json:"dropped,omitempty"`
}
LayoutSummary accounts for what an MTIP export and the diagrams' own symbol streams contributed to a migration: how many diagram records joined, and how much of their geometry, style and notes was written into the views.
type LibrarySummary ¶ added in v0.10.0
type LibrarySummary struct {
// Inlined names the library packages appended, in the order appended.
Inlined []string `json:"inlined,omitempty"`
// NotInlined explains, by package, why a referenced library package was
// not appended, so the output still refers to it.
NotInlined map[string]string `json:"notInlined,omitempty"`
}
LibrarySummary accounts for the OpenSysML library packages a portable migration appended to its output, and those it could not.
type Options ¶
type Options struct {
// Layout is the parsed MTIP export; nil migrates without layout.
Layout *mtip.Export
// LayoutSource names the file Layout was read from, for the report and
// diagnostics.
LayoutSource string
// ImageBaseURL resolves a comment's relative <img src> to the server
// serving it; "" leaves such images out.
ImageBaseURL string
// Strict writes only notation a pinned SysML v2 production admits and
// refers to no OpenSysML library: a construct whose only v2 form is one
// (a history pseudostate, a document) is reported unmapped instead of
// written, one with a standard approximation (a choice, a probability)
// written so and reported approximated.
Strict bool
// Portable appends the OpenSysML library packages the output refers to,
// so the one file loads in a tool that ships only the standard library;
// what is written is otherwise unchanged. The report names the packages.
Portable bool
}
Options carries the optional inputs of a migration: an MTIP export whose diagram records lay out the views the migration writes.
type Report ¶
type Report struct {
// Source names the v1 document migrated.
Source string `json:"source"`
// Exporter is the tool the document says wrote it, when it says.
Exporter string `json:"exporter,omitempty"`
Entries []Entry `json:"entries"`
// Layout accounts for the geometry the views were laid out from, an MTIP
// export or the diagrams' own symbol streams; nil when there was neither.
Layout *LayoutSummary `json:"layout,omitempty"`
// Images counts the attached image files the migration wrote beside the
// notation for its Image blocks.
Images int `json:"images,omitempty"`
// Libraries accounts for the OpenSysML library packages a portable
// migration appended to the output; nil when the migration was not portable.
Libraries *LibrarySummary `json:"libraries,omitempty"`
}
Report is the per-element account of a migration.
func (*Report) NothingWritten ¶ added in v0.13.0
NothingWritten says that the migration wrote no element of a document holding some, so its output is an empty model; "" when it wrote any, or read none.
func (*Report) Unreferenced ¶
Unreferenced returns how many skipped entries are the user's own elements that nothing refers to, as opposed to profile, library or notation content.
type Result ¶
type Result struct {
Notation []byte
Report *Report
Results *simresults.Results
// Files are the attached image files the documents' Image blocks show, by
// the relative path they are written under (images/<name>); a caller
// writes them beside the notation, empty when none was attached.
Files map[string][]byte
}
Result is a migration's output: the v2 notation, the report over it, and the result snapshots of its run configurations.
func FromModelOptions ¶
FromModelOptions migrates an already-read XMI model with the augments opts carries; unlike MigrateOptions it cannot fail, so a layout export joins what it can and reports the rest.
type RouteKind ¶
type RouteKind struct {
Kind string `json:"kind"`
Reason string `json:"reason"`
Count int `json:"count"`
}
RouteKind counts the routes of one v1 connector kind that share a reason: written, not drawn, not exposed, unnamed, not written, no v2 member, duplicate or dangling.
type Verdict ¶
type Verdict int
Verdict is what the migration did with one SysML v1 element.
const ( // Mapped: the element has a SysML v2 counterpart that states the same thing. Mapped Verdict = iota // Approximated: the element was written, but the v2 form loses or // restates part of what v1 said; the note says what. Approximated // Unmapped: the element has no v2 counterpart in this migration and is // recorded as a comment where it stood. Unmapped // Skipped: the element is not the user's model — a profile, a library the // tool bundled, a diagram — or nothing in the model refers to it, so no v2 // form would say anything; it is left out without a comment. Skipped )
func (Verdict) MarshalText ¶
MarshalText writes the verdict by name, so the JSON report reads as the text one.
func (*Verdict) UnmarshalText ¶
UnmarshalText reads a verdict written by MarshalText.
Source Files
¶
- absent.go
- activity.go
- adjunct.go
- arguments.go
- arrivals.go
- behavior.go
- call_port.go
- call_target.go
- carriers.go
- classify.go
- compartments.go
- context.go
- controlobjects.go
- datawait.go
- diagrams.go
- documents.go
- edges.go
- events.go
- expression.go
- holders.go
- imagefile.go
- interaction.go
- loop.go
- metadata.go
- migrate.go
- montecarlo.go
- names.go
- objectflows.go
- observation.go
- ocl.go
- ocllower.go
- opaque.go
- portable.go
- primitives.go
- prose.go
- query.go
- realization.go
- reconstruct.go
- references.go
- report.go
- results.go
- senders.go
- simconfig.go
- states.go
- stereotypes.go
- streams.go
- swimlane.go
- tablepresentation.go
- tables.go
- translate.go
- typefilter.go
- typemodifier.go
- uniqueness.go
- usage.go
- usecase.go
- values.go
- views.go
- writer.go