Documentation
¶
Overview ¶
Package sysmlv1 interprets the element tree of internal/translate/xmi as the UML model with stereotype applications that SysML v1 tools export.
The reader is deliberately tolerant of the serialization's dialect: the UML, XMI and profile namespaces differ between the OMG normative XMI and the Eclipse UML2 serialization Papyrus writes, so elements are classified by the local part of their xmi:type and stereotype applications by the local part of their element name. A zip archive holding the model, such as a MagicDraw .mdzip project, is opened in place and its model entries read as one document.
The tree carries no UML semantics of its own; internal/translate/migrate interprets it as a SysML v1 model.
Index ¶
- Constants
- func IsDocGenProfile(ns string) bool
- func IsSysMLNamespace(ns string) bool
- func SameName(a, b string) bool
- type Bounds
- type Column
- type ColumnKind
- type Criterion
- type CriterionKind
- type Diagram
- type DiagramProperty
- type DocGenAnchor
- type DocGenDocument
- type DocGenParagraph
- type DocGenStep
- type DocGenView
- type Element
- func (e *Element) Applied(namespace, name string) *Stereotype
- func (e *Element) DocGen() *Stereotype
- func (e *Element) DocGenView() bool
- func (e *Element) HasStereotype(names ...string) bool
- func (e *Element) HrefOwnerName() string
- func (e *Element) IsProxy() bool
- func (e *Element) Owned(role string) []*Element
- func (e *Element) Path() []string
- func (e *Element) RefIDs(role string) []string
- func (e *Element) Stereotype(name string) *Stereotype
- func (e *Element) Values(role string) []string
- type ElementRef
- type Extension
- type ExtensionElement
- type Font
- type ImageError
- type Model
- func (m *Model) Ambiguous(id string) []string
- func (m *Model) Ancestors(e *Element) []*Element
- func (m *Model) Applications(namespace string) []*Stereotype
- func (m *Model) Attachment(name string) ([]byte, bool)
- func (m *Model) AttachmentNames() []string
- func (m *Model) Diagram(id string) *Diagram
- func (m *Model) DocGenChain(a *Element) ([]*DocGenStep, string)
- func (m *Model) Generals(e *Element) []*Element
- func (m *Model) Lookup(id string) *Element
- func (m *Model) ModuleStereotypeAncestors(namespace, name string) ([]StereotypeRef, bool)
- func (m *Model) Ref(e *Element, role string) *Element
- func (m *Model) Refs(e *Element, role string) []*Element
- func (m *Model) StereotypeAncestors(id string) ([]StereotypeRef, bool)
- func (m *Model) StereotypeRef(id string) StereotypeRef
- func (m *Model) TagRefs(s *Stereotype, tag string) []ElementRef
- func (m *Model) Unresolved(e *Element, role string) []string
- func (m *Model) UnresolvedGenerals(e *Element) []string
- type Point
- type RowFilter
- type Sort
- type Stereotype
- type StereotypeRef
- type Style
- type Symbol
- type Table
- type TableKind
Constants ¶
const ( // MagicDrawProfileNS is MagicDraw's own profile: tables and relation maps. MagicDrawProfileNS = "http://www.omg.org/spec/UML/20131001/MagicDrawProfile" // DependencyMatrixNS is MagicDraw's dependency matrix profile. DependencyMatrixNS = "http://www.magicdraw.com/schemas/Dependency_Matrix_Profile.xmi" // DocGenNS is the Open-MBEE MDK document generation profile. DocGenNS = "http://www.magicdraw.com/schemas/manual/Document_Profile.xmi" // DocGenCollaboratorNS is the MDK view collaborator profile. DocGenCollaboratorNS = "http://www.magicdraw.com/schemas/manual/Document_View_Collaborator_Profile.xmi" )
Exact namespaces of the tool profiles the reader gives a typed form. Cameo serializes user profiles under the same host as its own, so only an exact namespace, never its host, identifies tool content.
const ( DisplayList = "List" DisplayCompactTree = "Compact tree" DisplayCompleteTree = "Complete tree" )
The display modes MagicDraw writes to a table's displayMode tag.
const DiagramMainImage = "DiagramMainImage"
DiagramMainImage is the anchor kind naming the figure a section draws of a diagram.
Variables ¶
This section is empty.
Functions ¶
func IsDocGenProfile ¶
IsDocGenProfile reports whether ns is one of the DocGen profiles the document mapping reads.
func IsSysMLNamespace ¶
IsSysMLNamespace reports whether ns is an OMG SysML v1 profile namespace, of any version, Papyrus' copy of it, or an Eclipse UML2 SysML EPackage.
Types ¶
type Bounds ¶ added in v0.9.2
type Bounds struct {
X, Y, Width, Height float64
}
Bounds is a rectangle in diagram pixels: its top-left corner and size.
type Column ¶
type Column struct {
// ID is the column id as written.
ID string
// Kind classifies the id.
Kind ColumnKind
// Property is the QPROP property name: "name", "documentation", "owner"...
Property string
// Feature is the IColumn feature; its Element is nil when dangling.
Feature ElementRef
// Profile and Stereotype name a stereotype-tag column's stereotype as the
// id qualifies it, Profile "" when the id names the stereotype alone; Tag
// is the tag's name. Definition is the stereotype the read documents
// define under that name and TagDefinition the property of that name it
// owns or inherits; both nil when no read document defines the stereotype,
// TagDefinition alone when it defines no such tag.
Profile, Stereotype, Tag string
Definition *Element
TagDefinition *Element
// Hidden is whether hideColumns lists the column.
Hidden bool
// Width is the column's columnWidth in pixels; 0 when the tool wrote
// none or -1, which sizes the column automatically.
Width int
}
Column is one column of a table.
type ColumnKind ¶
type ColumnKind string
ColumnKind classifies a column id.
const ( // ColumnTool is a tool column with no model content: row numbers, the // margin, an empty spacer. ColumnTool ColumnKind = "tool" // ColumnProperty is a QPROP:Element:<property> column: a UML property of // the row element, named by Property. ColumnProperty ColumnKind = "property" // ColumnFeature is an IColumn:<id> column: a feature of the row // classifier, resolved in Feature. ColumnFeature ColumnKind = "feature" // ColumnPropertyPair is the PROPERTY_COLUMN / VALUE_COLUMN pair of a // generic table's property view. ColumnPropertyPair ColumnKind = "propertyPair" // ColumnStereotypeTag is a QPROP:stereotypeTags:<<Profile::Stereotype>>.tag // column: a tag of a stereotype applied to the row element. ColumnStereotypeTag ColumnKind = "stereotypeTag" // ColumnUnknown is an id in a form the reader does not know. ColumnUnknown ColumnKind = "unknown" )
The column ids MagicDraw writes.
type Criterion ¶
type Criterion struct {
// Name is the display name the tool recorded; "" when none.
Name string
// Kind is the expression form.
Kind CriterionKind
// Stereotype names the relationship stereotype a relation criterion
// walks; zero when it walks a metaclass instead.
Stereotype StereotypeRef
// Metaclass is the relationship metaclass a relation criterion walks;
// "" when it walks a stereotype.
Metaclass string
// Direction is the walk direction as written: "DIRECT", "REVERSED",
// "BOTH", or "" when the tool wrote none.
Direction string
// IncludeSubtypes is the criterion's includeSubtypes flag.
IncludeSubtypes bool
// Expression is the expression's xsi:type for forms other than a
// relation, and Detail its body: the chain steps, the property, the script.
Expression, Detail string
// Malformed is why the criterion could not be decoded; "" when it could.
Malformed string
}
Criterion is one dependency or relation criterion of a matrix or relation map, decoded from the structured expression the tool serialized.
type CriterionKind ¶
type CriterionKind string
CriterionKind is the form a matrix or relation map criterion takes.
const ( // CriterionRelation walks relationships of one stereotype or metaclass. CriterionRelation CriterionKind = "relation" // CriterionMetachain navigates a chain of UML or stereotype properties. CriterionMetachain CriterionKind = "metachain" // CriterionProperty reads one UML property. CriterionProperty CriterionKind = "property" // CriterionScript evaluates an inline script, such as OCL. CriterionScript CriterionKind = "script" // CriterionOther is any other expression form. CriterionOther CriterionKind = "other" )
The criterion forms MagicDraw's structured expressions take.
type Diagram ¶
type Diagram struct {
// ID is the diagram's xmi:id; "" when the tool wrote none.
ID string
// Name is the diagram's name attribute.
Name string
// Kind is the tool's diagram type, such as "SysML Block Definition Diagram"
// or "Requirement Table"; "" when the tool serialized none.
Kind string
// UMLKind is the UML diagram type Kind derives from, such as "Class Diagram"
// or "Composite Structure Diagram"; "" when the tool serialized none.
UMLKind string
// OwnerID is the ownerOfDiagram attribute as written; "" when absent.
OwnerID string
// Owner is the element OwnerID resolves to; nil when it is absent or dangling.
Owner *Element
// Holder is the element whose xmi:Extension holds the diagram; nil at the
// document root or inside a stereotype application.
Holder *Element
// Shown lists the elements the diagram shows in serialized order, each id
// once, however many times the tool listed it.
Shown []ElementRef
// Extender is the tool named by the extension the diagram sits in.
Extender string
// Stream names the archive entry the tool serialized the diagram's symbols
// to (a binaryObject's streamContentID); "" when none is named.
Stream string
// Documentation is the body of the diagram's first own comment: an
// ownedComment annotating nothing but the diagram; "" when it has none.
Documentation string
// Drawn reports whether Stream was read, so that Shown lists the elements
// the diagram's symbols display, by standing for them or for an ancestor,
// and Free the symbols standing for none.
Drawn bool
// Free counts the symbols standing for no model element, such as a pasted
// image or a text box, by the tool's symbol class; set only when Drawn.
Free map[string]int
// Symbols lists every symbol of the stream in serialized order, nested ones
// included, with its geometry, style and ends; set only when Drawn.
Symbols []*Symbol
// Frame is the diagram frame's rectangle, when the stream draws one.
Frame *Bounds
// Properties are the properties the tool saved with the diagram, such as
// a table's row filter, in serialized order; nil when it saved none.
Properties []DiagramProperty
}
Diagram is one diagram of the model as a tool serialized it inside an xmi:Extension: what it is called, what kind of diagram it is, which element owns it and which elements it shows; from the tool's symbol stream, where and how each symbol is drawn.
func (*Diagram) Flag ¶ added in v0.9.2
Flag reports whether the diagram property id is a boolean saved as true.
func (*Diagram) Property ¶ added in v0.9.2
func (d *Diagram) Property(id string) (DiagramProperty, bool)
Property finds the diagram property with the given id; false when the tool saved none by that id.
func (*Diagram) Represented ¶
Represented reports whether the tool serialized what the diagram is and shows; a diagram with neither a kind nor contents is a name and nothing more.
func (*Diagram) SymbolByID ¶ added in v0.9.2
SymbolByID finds the symbol with the given xmi:id; nil when none has it.
type DiagramProperty ¶ added in v0.9.2
type DiagramProperty struct {
// ID is the propertyID, such as OPTION_FILTER_SEARCHING_TEXT.
ID string
// Class is the property's elementClass: BooleanProperty, StringProperty,
// ChoiceProperty, NumberProperty...
Class string
// Value is the value as written: a value element's xmi:value attribute,
// else its text; "" when the property holds none.
Value string
// Choices are a ChoiceProperty's choices, in serialized order.
Choices []string
}
DiagramProperty is one property a tool saved with a diagram: MagicDraw's diagramProperties attribute holds them as an XML document of typed properties, each keyed by a property id.
type DocGenAnchor ¶ added in v0.9.2
type DocGenAnchor struct {
// Kind is the item's kind, DiagramMainImage for the figure of a diagram.
Kind string
// Target is the id the publisher gave the item.
Target string
}
DocGenAnchor is an item of the published document a collaborator paragraph follows that is no paragraph; the publisher writes it `<view>_<Kind>__<Target>`, as `Containment_DiagramMainImage__<id>` for the main image of a diagram.
type DocGenDocument ¶
type DocGenDocument struct {
// Class is the document class; Root its view tree, of which the
// document class is the first view.
Class *Element
Root *DocGenView
// Application is the Document application that names the class.
Application *Stereotype
}
DocGenDocument is one MDK DocGen document: a class carrying the Document stereotype of either DocGen profile, read into its view tree.
type DocGenParagraph ¶
type DocGenParagraph struct {
// Application is the CollaboratorParagraph or CollaboratorImageParagraph application.
Application *Stereotype
// Image reports a CollaboratorImageParagraph: the comment carries an attached image file.
Image bool
// Comment is the comment shown; nil when the application's base is dangling.
Comment *Element
// Malformed is why the paragraph cannot be shown, "" when it can.
Malformed string
// Predecessor is the siblingId or parentId tag as written, "" when the
// paragraph names nothing it follows.
Predecessor string
// Anchor is the generated item Predecessor names, nil when it names a
// paragraph (see Placed) or nothing readable.
Anchor *DocGenAnchor
// Placed reports whether the predecessor tag named a paragraph of the
// same view, which this one then follows.
Placed bool
}
DocGenParagraph is one collaborator paragraph: a comment the collaborator profile places in a view (ownerId, or sectionId in the 2022x schema) of a document, after the paragraph its siblingId or parentId names.
type DocGenStep ¶
type DocGenStep struct {
// Node is the activity node.
Node *Element
// Kind is the DocGen stereotype the node or its called behavior carries,
// "" when neither carries one.
Kind string
// Application is that stereotype's application.
Application *Stereotype
// Behavior is the behavior a CallBehaviorAction calls; nil otherwise.
Behavior *Element
// Targets are the node's explicit targets: its targets tag or its Expose
// suppliers; nil when the step works on what the chain feeds it.
Targets []ElementRef
// Branches are the parallel chains a fork opened, each ending at the
// node that rejoins them; Kind then names the join: "Union" for a merge,
// "Intersection" for a join, "XOR" for a decision.
Branches [][]*DocGenStep
// Malformed is why the step could not be read, "" when it could.
Malformed string
}
DocGenStep is one node of a DocGen activity chain: a collect, filter or sort step, a presentation node, a group, or a join of parallel branches.
type DocGenView ¶
type DocGenView struct {
// Class is the view class.
Class *Element
// Viewpoint is the viewpoint the view conforms to; nil when none.
Viewpoint *Element
// ConformMalformed is why the view's Conform names no viewpoint, "" when
// it does or the view has no Conform.
ConformMalformed string
// Method is the viewpoint's method activity, the behavior of its
// operation named View or its method tag; nil when the viewpoint has none.
Method *Element
// MethodMalformed is why the viewpoint's method tag yields no activity,
// "" when it does or the viewpoint declares no method.
MethodMalformed string
// Exposed are the elements the view exposes or imports, in document order.
Exposed []ElementRef
// Paragraphs are the collaborator paragraphs placed in this view, in the
// order they are shown.
Paragraphs []*DocGenParagraph
// Children are the child views, in property order.
Children []*DocGenView
// Malformed lists what could not be read.
Malformed []string
}
DocGenView is one view of a document: a class the SysML View stereotype applies to, placed by the composite properties of its parent view.
type Element ¶
type Element struct {
// ID is the xmi:id, or the href for a proxy of an external element.
ID string
// Type is the local name of the xmi:type, such as "Class" or "Property".
// A proxy carries the type its reference declared, or "".
Type string
// Role is the XML element name that owns this element in its parent, such
// as "packagedElement" or "ownedAttribute"; empty for a root.
Role string
// Name is the element's name attribute; a proxy takes the href fragment
// when it reads as a name.
Name string
// Href is set on a proxy for an element of another document.
Href string
// QualifiedName is the name a tool records beside an href for the element it
// points to (MagicDraw's referentPath); "" when the document gives none.
QualifiedName string
// Attrs holds the element's properties other than xmi:id and xmi:type, keyed
// by local name: the XML attributes, and the properties serialized as child
// elements (`<name>Wheel</name>`) where no attribute states them; references
// appear as their raw id text. Values lists every value of a property.
Attrs map[string]string
// Text is the element's character content, which stereotype tag values
// and opaque expression bodies are written as.
Text string
Parent *Element
Children []*Element
// Stereotypes are the stereotype applications whose base is this element.
Stereotypes []*Stereotype
// AttachedStream is the archive entry holding the element's attached file,
// "" when none.
AttachedStream string
// contains filtered or unexported fields
}
Element is one node of the model: a UML element with an xmi:id, or a proxy for an element in another document that an href points at.
func (*Element) Applied ¶
func (e *Element) Applied(namespace, name string) *Stereotype
Applied returns e's application of the named stereotype from one exact profile namespace, or nil; a homonym from another profile does not count.
func (*Element) DocGen ¶
func (e *Element) DocGen() *Stereotype
DocGen returns the DocGen application on e, from either DocGen profile.
func (*Element) DocGenView ¶
DocGenView reports whether the DocGen profile's own view stereotype applies to e, which makes a class a view as the SysML «View» does.
func (*Element) HasStereotype ¶
HasStereotype reports whether any of the named stereotypes applies to e.
func (*Element) HrefOwnerName ¶
HrefOwnerName reads the name a proxy's href fragment spells for its owner: SysML.xmi#SysML.AbstractRequirement.id is owned by AbstractRequirement.
func (*Element) Path ¶
Path returns the names from the root to e, for diagnostics; anonymous elements contribute their type in angle brackets.
func (*Element) RefIDs ¶
RefIDs lists the raw ids a role of e refers to, attribute ids first: xmi:ids within the document, or the hrefs of elements other documents hold, kept as written even once such an href resolves to a bundled copy of its element.
func (*Element) Stereotype ¶
func (e *Element) Stereotype(name string) *Stereotype
Stereotype returns e's application of the named stereotype, or nil.
type ElementRef ¶
type ElementRef struct {
// ID is the xmi:id the tool wrote, or the href of an element of another
// document, with a local href's fragment marker removed.
ID string
// Element is the element ID resolves to: one the read documents define, or
// the proxy standing for one of another document; nil when it is dangling.
Element *Element
// Listed marks an element the tool lists as used on the diagram that no
// symbol stands for: a compartment row of an ancestor's symbol.
Listed bool
// OnPath marks an element whose every symbol lies on a path: an association
// end's role label, which is no node of its own.
OnPath bool
}
ElementRef is one element a diagram shows.
type Extension ¶
type Extension struct {
// Extender is the tool named by the block's extender attribute.
Extender string
// Owner is the element the block sits in; nil at the document root.
Owner *Element
// Elements are the xmi:type and name of every typed element inside, the
// diagrams excepted, which Model.Diagrams holds.
Elements []ExtensionElement
}
Extension records one skipped xmi:Extension: who wrote it and what it held, less the ElementValue operands read into the model (see adoptValues).
type ExtensionElement ¶
type ExtensionElement struct {
ID, Type, Name string
}
ExtensionElement is one typed element inside a skipped extension.
type ImageError ¶ added in v0.9.2
type ImageError struct {
// Diagram and Symbol are the ids of the diagram and the symbol carrying it.
Diagram, Symbol string
// Offset is the position of the offending octet, counting from 0; Octet
// is what stands there.
Offset int
Octet string
}
ImageError reports a pasted image whose inline bytes do not read: the octet of its text that is not hexadecimal.
func (*ImageError) Error ¶ added in v0.9.2
func (e *ImageError) Error() string
func (*ImageError) Reason ¶ added in v0.9.2
func (e *ImageError) Reason() string
Reason says which octet does not read and why.
type Model ¶
type Model struct {
// Roots are the top-level UML elements, in document order.
Roots []*Element
// Stereotypes are every stereotype application, in document order.
Stereotypes []*Stereotype
// Exporter records the xmi:Documentation exporter, when the document names one.
Exporter string
// Extensions are the tool-private xmi:Extension blocks that were skipped.
Extensions []Extension
// Diagrams are the diagrams read out of those blocks, in document order.
Diagrams []Diagram
// Tables are the table, matrix and relation map definitions read out of
// the tool profile applications, in document order.
Tables []*Table
// Documents are the MDK DocGen documents, in document order.
Documents []*DocGenDocument
// StrayParagraphs are collaborator paragraphs no document's view shows.
StrayParagraphs []*DocGenParagraph
// contains filtered or unexported fields
}
Model is one document, or one archive's documents read as one.
func Parse ¶
Parse reads an XMI document, or a zip archive (such as a MagicDraw .mdzip) holding one or more, into a Model.
func (*Model) Ambiguous ¶
Ambiguous lists the hrefs a bare id could stand for when proxies of several documents share it as their fragment, in first-seen order; nil when the id resolves, or when no proxy carries it.
func (*Model) Ancestors ¶
Ancestors returns every classifier e specializes, transitively, nearest first and each once, in-document elements and proxies alike; a proxy into a module snapshot continues through the stereotypes the snapshot declares it specializes. e itself is among them exactly when its generalizations cycle back to it.
func (*Model) Applications ¶
func (m *Model) Applications(namespace string) []*Stereotype
Applications lists the stereotype applications of one exact profile namespace, in document order.
func (*Model) Attachment ¶ added in v0.9.2
Attachment returns the archive entry named name read in full; false when the model was not read from an archive or names no such entry.
func (*Model) AttachmentNames ¶ added in v0.9.2
AttachmentNames lists the archive's entries by name; empty when the model was not read from an archive.
func (*Model) Diagram ¶
Diagram finds the diagram with xmi:id id, or the one an href's fragment names; nil when no diagram has it.
func (*Model) DocGenChain ¶
func (m *Model) DocGenChain(a *Element) ([]*DocGenStep, string)
DocGenChain reads the activity chain of a DocGen behavior or structured node: the steps reached from its initial node along single control flows, with parallel branches folded into the step that rejoins them.
func (*Model) Generals ¶
Generals returns the classifiers e directly specializes through its generalizations: elements of the documents read, or proxies for others.
func (*Model) Lookup ¶
Lookup resolves an xmi:id, or an href of an element another document holds, to its element; nil when the document defines neither.
func (*Model) ModuleStereotypeAncestors ¶ added in v0.11.0
func (m *Model) ModuleStereotypeAncestors(namespace, name string) ([]StereotypeRef, bool)
ModuleStereotypeAncestors is StereotypeAncestors for the stereotype name a module snapshot declares in the profile namespace denotes, as an application under that namespace resolves it.
func (*Model) Refs ¶
Refs returns the elements a role of e refers to: the ids in the attribute of that name (space-separated, as XMI writes multi-valued references) and the child elements of that name carrying xmi:idref or href. Unresolvable ids are dropped (Unresolved lists them); an href yields a proxy element.
func (*Model) StereotypeAncestors ¶ added in v0.11.0
func (m *Model) StereotypeAncestors(id string) ([]StereotypeRef, bool)
StereotypeAncestors lists the stereotypes the one an id or href names specializes, transitively, as the archive's module snapshots declare them, and whether a snapshot declares it at all.
func (*Model) StereotypeRef ¶
func (m *Model) StereotypeRef(id string) StereotypeRef
StereotypeRef resolves an id or href to the stereotype it names: through the tool's stereotype table, else through a bundled Stereotype element, whose profile namespace is the owning Profile's URI when it declares one.
func (*Model) TagRefs ¶
func (m *Model) TagRefs(s *Stereotype, tag string) []ElementRef
TagRefs resolves a reference-valued tag of a stereotype application to the elements it names, one ElementRef per id in serialized order, an href of another document yielding its proxy and a dangling id a nil Element.
func (*Model) Unresolved ¶
Unresolved returns the ids a role of e refers to that no read document defines, so a caller can tell a complete reference list from a dangling one.
func (*Model) UnresolvedGenerals ¶
UnresolvedGenerals lists the ids of generals of e no document read defines.
type Point ¶ added in v0.9.2
type Point struct {
X, Y float64
}
Point is a position in diagram pixels.
type RowFilter ¶ added in v0.9.2
type RowFilter struct {
// Text is the text searched for.
Text string
// Columns are the indexes of the columns searched, counted from 0 among
// the columns shown in their order, as the property's value lists them
// joined by ^; nil when the value is empty and every column is searched.
// The property's choices are the indexes on offer, not a selection.
Columns []int
// Malformed is why the column selection could not be read, Columns then
// nil; "" when it could.
Malformed string
// Wildcard reads Text as a wildcard pattern (* and ?); Regexp as a
// regular expression; CaseSensitive matches case; FromStart and FromEnd
// anchor the match at a cell's start and end.
Wildcard, Regexp, CaseSensitive, FromStart, FromEnd bool
}
RowFilter is the filter a tool saved with a table: the text its rows are searched for and how it is matched, as MagicDraw's diagram properties SAVE_FILTER_VALUE, OPTION_FILTER_SEARCHING_TEXT, OPTION_FILTER_COLUMN_INDEXES and the OPTION_FILTER_* flags record it.
type Sort ¶
type Sort struct {
// Column is the column id sorted by, in the form Column.ID uses.
Column string
// Descending is the direction.
Descending bool
}
Sort is one sort key: a column id and a direction.
type Stereotype ¶
type Stereotype struct {
ID string
// Name is the stereotype's local name, such as "Block" or "Requirement": the
// model name of a resolved Definition, else the XML name the tool wrote.
Name string
// Namespace is the XML namespace the profile was serialized under.
Namespace string
// BaseID is the value of the base_* attribute; Base resolves it.
BaseID string
Base *Element
// BaseMetaclass is the UML metaclass the stereotype extends, as the base_*
// attribute names it: "Class" of base_Class, "Element" of base_Element.
BaseMetaclass string
// Definition is the uml:Stereotype the application instantiates, when a
// document read defines it and the application can be traced to it: through
// the tool's stereotypesHREFS table, or by name within the profile the
// application's XML namespace denotes. Nil otherwise.
Definition *Element
// Generals are every stereotype Definition specializes, transitively:
// Model.Ancestors of the definition, so proxies stand for those defined
// outside the documents read. Without a Definition, they are the
// stereotypes the archive's module snapshots declare the applied one
// specializes, as elements standing for the snapshot's; else empty.
Generals []*Element
// Module reports that a module snapshot, not a document read, declares the
// stereotype: Generals are then the snapshot's, however few.
Module bool
// Tags holds the tagged values: attributes other than xmi:* and base_*, and
// child elements as their text or idref, keyed by tag name. A multi-valued
// tag lists each value.
Tags map[string][]string
// contains filtered or unexported fields
}
Stereotype is one stereotype application: an element outside the UML model whose base_* attribute names the element it extends.
func (*Stereotype) Bool ¶
func (s *Stereotype) Bool(name string) bool
Bool reads a boolean tag; absent or unparsable is false.
func (*Stereotype) IDs ¶
func (s *Stereotype) IDs(name string) []string
IDs returns the ids a reference-valued tag lists: an IDREFS attribute split on whitespace, a child element's idref or href kept whole, since an href into another archive entry may contain spaces.
func (*Stereotype) Tag ¶
func (s *Stereotype) Tag(name string) string
Tag returns the first value of a tag, or "".
type StereotypeRef ¶
type StereotypeRef struct {
// ID is the id or href as written.
ID string
// Name is the stereotype's name; "" when the document does not tell.
Name string
// Namespace is the profile namespace the name belongs to; "" when unknown.
Namespace string
// Element is the bundled stereotype element; nil when the profile is not
// in the read documents.
Element *Element
}
StereotypeRef names a stereotype an id refers to: by the namespace and name its profile declared it under when the document tells, by its element when the profile is bundled, and by the raw id always.
func (StereotypeRef) Known ¶
func (r StereotypeRef) Known() bool
Known reports whether the document told what stereotype the id names.
type Style ¶ added in v0.9.2
type Style struct {
// Fill, Pen and Text are the fill, line and text colours.
Fill, Pen, Text string
// NoFill reports that the symbol is drawn without a fill (USE_FILL_COLOR false).
NoFill bool
// Font is the font of the symbol's text.
Font *Font
}
Style is a symbol's own presentation choices, each "" or nil when the symbol inherits the tool's default. Colours are written "#RRGGBB".
type Symbol ¶ added in v0.9.2
type Symbol struct {
// ID is the symbol's own xmi:id; "" when the tool wrote none.
ID string
// Class is the tool's symbol class, such as "Class", "State", "Transition",
// "Note", "NoteAnchor", "TextBox" or "ImageShape".
Class string
// ElementID names the model element the symbol stands for; "" for free
// content standing for none, such as a pasted image or a text box.
ElementID string
// Parent is the symbol this one is drawn inside; nil at the top level.
Parent *Symbol
// Bounds is a shape's rectangle in diagram pixels, y down; nil for a path
// or a shape whose geometry the tool did not write.
Bounds *Bounds
// Points are a path's bends, ends included, in drawing order; nil for a shape.
Points []Point
// Ends are the symbol ids at a path's first and second end; "" for a shape.
Ends [2]string
// Style holds the symbol's own colour and font choices, overriding the
// tool's defaults for its class; zero when it made none.
Style Style
// Text is what a free text box or note says; "" when it says nothing itself.
Text string
// Attachment names the file a pasted image was taken from, when the tool
// wrote one; "" otherwise.
Attachment string
// Image holds a pasted image's own bytes when the tool serialized them in
// the stream; nil when it wrote only the file's name or they do not read.
Image []byte
// ImageError says why Image is nil though the tool wrote bytes; nil otherwise.
ImageError *ImageError
// Hidden reports a symbol the tool keeps but does not draw (visible false):
// it takes no room on the diagram, and a hidden frame does not bound it.
Hidden bool
// Compartments are the symbol's SUPPRESS_* compartment properties by
// property id, its own and then its symbol style's: true when suppressed.
Compartments map[string]bool
// StyleID names the symbol style the symbol is drawn in (symbolStyleID).
StyleID string
}
Symbol is one symbol of a tool's own serialization of a diagram: what it stands for, where it is drawn, and how, as far as the stream says.
func (*Symbol) ImageType ¶ added in v0.9.2
ImageType is the content type of the symbol's inline image bytes, "" when it carries none or they are of no image kind.
type Table ¶
type Table struct {
// Kind is the table's kind.
Kind TableKind
// Diagram is the diagram the definition applies to; nil when the
// base_Diagram id names no diagram of the read documents.
Diagram *Diagram
// DiagramID is the base_Diagram id as written.
DiagramID string
// Application is the profile application that defines the table; Filter
// is the matrix's MatrixFilter application, nil otherwise.
Application, Filter *Stereotype
// Scope lists the elements whose subtrees are searched for rows: a
// table's scope, a matrix's rowScope, a relation map's contextElement.
Scope []ElementRef
// WholeModel is the takeWholeModelAsScope flag.
WholeModel bool
// RowTypes are the classifiers, stereotypes or metaclasses rows must be
// of: a table's classifiers or rowElementType, a matrix's
// rowElementType, a relation map's elementTypes.
RowTypes []ElementRef
// IncludeSubtypes is whether rows of subtypes of RowTypes are listed too;
// MagicDraw defaults it to true.
IncludeSubtypes bool
// Rows are the elements listed as rows regardless of scope: a table's
// rowElements and additionalElements.
Rows []ElementRef
// Excluded are the elements a table's excludedElements removes from the
// rows, each with the rows nested under it.
Excluded []ElementRef
// DisplayMode is a table's displayMode tag: "List", "Compact tree" or
// "Complete tree"; "" when the tool wrote none, which displays a list.
DisplayMode string
// ShowScopeAsRoot is a table's showScopeAsRoot tag: whether a tree
// display mode lists the scope element as the root row.
ShowScopeAsRoot bool
// Expanded are the rows a table's expandedRows records as expanded in
// the tool's window, in serialized order.
Expanded []ElementRef
// RowFilter is the row filter the tool saved with the table's diagram;
// nil when none is saved.
RowFilter *RowFilter
// Columns are the table's columns in serialized order, hidden ones included.
Columns []Column
// Sorts are the table's sort keys in priority order.
Sorts []Sort
// ColumnScope and ColumnTypes are a matrix's columnScope and
// columnElementType; IncludeColumnSubtypes its includeSubtypesOfColumnTypes.
ColumnScope, ColumnTypes []ElementRef
IncludeColumnSubtypes bool
// Direction is a matrix's direction tag: "Row to column", "Column to row"
// or "Both".
Direction string
// ShowElements is a matrix's showElements tag: "All" or "With relations".
ShowElements string
// Criteria are a matrix's dependencyCriteria or a relation map's
// relationCriterion, in serialized order.
Criteria []Criterion
// Depth is a relation map's depth; 0 when absent.
Depth int
// Malformed lists what in the serialization could not be read, each a
// short phrase naming the tag and the value.
Malformed []string
// Ignored lists the presentation settings written in a form the reader
// does not read, in the same phrasing; the table is read without them.
Ignored []string
}
Table is the semantic definition of a MagicDraw table, dependency matrix or relation map: what it lists, how it filters, sorts and lays out columns, read from the tool's exact profile applications on the diagram. The presentation tags of those applications are not read.