capellambse.extensions.reqif package¶
Tools for handling ReqIF Requirements.
- class capellambse.extensions.reqif.AbstractRequirementsAttribute¶
Bases:
ModelElement
- definition¶
The definition of this AbstractRequirementsAttribute.
- value: t.Any¶
- class capellambse.extensions.reqif.AbstractRequirementsRelation¶
Bases:
ReqIFElement
- source¶
The source of this AbstractRequirementsRelation.
- target¶
The target of this AbstractRequirementsRelation.
- type: m.Accessor¶
The type of this AbstractRequirementsRelation.
- class capellambse.extensions.reqif.AbstractType¶
Bases:
ReqIFElement
- attribute_definitions¶
The attribute definitions of this AbstractType.
- owner¶
The owner of this AbstractType.
- class capellambse.extensions.reqif.AttributeAccessor¶
Bases:
DirectProxyAccessor
[AbstractRequirementsAttribute
]- __init__()¶
Create a DirectProxyAccessor.
- Parameters:
class – The proxy class.
xtypes – The
xsi:type
(s) of the child element(s). If None, then the constructed proxy will be passed the original element instead of a child.aslist – If None, only a single element must match, which will be returned directly. If not None, must be a subclass of
ElementList
, which will be used to return a list of all matched objects.mapkey –
Specify the attribute to look up when the returned list is indexed with a str. If not specified, str indexing is not possible.
Ignored if aslist is not specified.
mapvalue –
If specified, return this attribute of the found object when using str indices into the returned list. If not specified, the found object itself is returned.
Ignored if aslist is not specified.
fixed_length –
When non-zero, the returned list will try to stay at exactly this length, by not allowing to insert or delete beyond this many members.
Ignored if aslist is not specified.
follow_abstract – Follow the link in the
abstractType
XML attribute of each list member and instantiate that object instead. The default is to instantiate the child elements directly.rootelem – A class or
xsi:type
(or list thereof) that defines the path from the current object’s XML element to the search root. If None, the current element will be used directly.single_attr – If objects can be created with only a single attribute specified, this argument is the name of that attribute. This
create_singleattr()
.
- Return type:
None
- follow_abstract: bool¶
- rootelem: cabc.Sequence[str]¶
- class capellambse.extensions.reqif.AttributeDefinition¶
Bases:
ReqIFElement
An attribute definition for requirement types.
- data_type¶
The data type of this AttributeDefinition.
- class capellambse.extensions.reqif.AttributeDefinitionEnumeration¶
Bases:
ReqIFElement
An enumeration attribute definition for requirement types.
- data_type¶
The data type of this AttributeDefinitionEnumeration.
- multi_valued¶
Whether to allow setting multiple values on this attribute.
- class capellambse.extensions.reqif.BooleanValueAttribute¶
Bases:
AbstractRequirementsAttribute
A string value attribute.
- value: t.Any¶
A POD containing a boolean.
- class capellambse.extensions.reqif.CapellaIncomingRelation¶
Bases:
AbstractRequirementsRelation
A Relation between a requirement and an object.
- class capellambse.extensions.reqif.CapellaModule¶
Bases:
ReqIFElement
A ReqIF Module that bundles multiple Requirement folders.
- attributes¶
The attributes of this CapellaModule.
- folders¶
The folders of this CapellaModule.
- requirement_types_folders¶
The requirement types folders of this CapellaModule.
- requirements¶
The requirements of this CapellaModule.
- to_reqif(to, *, metadata=None, pretty=False, compress=None)¶
Export this module as ReqIF XML.
You can override some auto-generated metadata placed in the header section by passing a dictionary as
metadata
. The following keys are supported. Unsupported keys are silently ignored.creation_time
: Adatetime.datetime
object that specifies this document’s creation time. Default to the current time.comment
: Override the ReqIF file’s comment. Defaults to a text derived from the model and module names.title
: Specify the document title. Defaults to the module’slong_name
.
- Parameters:
to (
Union
[str
,PathLike
,IO
[bytes
]]) – Where to export to. Can be the name of a file, or a file-like object opened in binary mode.metadata (
Mapping
[str
,Any
] |None
) – A dictionary with additional metadata (see above).pretty (
bool
) – Format the XML human-readable.compress (
bool
|None
) – Write compressed data (*.reqifz
). Defaults toTrue
iftarget
is a string or path-like and its name ends in.reqifz
, otherwise defaults toFalse
.
- Return type:
- type: m.Accessor¶
The type of this CapellaModule.
- class capellambse.extensions.reqif.CapellaOutgoingRelation¶
Bases:
AbstractRequirementsRelation
A Relation between an object and a requirement.
- source¶
The source of this CapellaOutgoingRelation.
- target¶
The target of this CapellaOutgoingRelation.
- class capellambse.extensions.reqif.CapellaTypesFolder¶
Bases:
ReqIFElement
- data_type_definitions¶
The data type definitions of this CapellaTypesFolder.
- module_types¶
The module types of this CapellaTypesFolder.
- relation_types¶
The relation types of this CapellaTypesFolder.
- requirement_types¶
The requirement types of this CapellaTypesFolder.
- class capellambse.extensions.reqif.DataTypeDefinition¶
Bases:
ReqIFElement
A data type definition for requirement types.
- class capellambse.extensions.reqif.DateValueAttribute¶
Bases:
AbstractRequirementsAttribute
A value attribute that stores a date and time.
- value: t.Any¶
A POD containing a timestamp.
The value stored in the XML will be formatted as required by Capella. This format is the ISO8601 format with millisecond precision, but no
:
in the time zone specification.
- class capellambse.extensions.reqif.ElementRelationAccessor¶
Bases:
WritableAccessor
[AbstractRequirementsRelation
]Provides access to RequirementsRelations of a ModelElement.
- __init__()¶
- Return type:
None
- aslist: type[_obj.ElementListCouplingMixin] | None¶
- purge_references(obj, target)¶
Do nothing.
This is a no-op, as this accessor provides a virtual relation.
The relation objects it handles are cleaned up by removing the source or target attribute.
- Return type:
- Parameters:
obj (ModelObject)
target (ModelObject)
- class capellambse.extensions.reqif.EnumValue¶
Bases:
ReqIFElement
An enumeration value for
EnumerationDataTypeDefinition
.
- class capellambse.extensions.reqif.EnumerationDataTypeDefinition¶
Bases:
ReqIFElement
An enumeration data type definition for requirement types.
- values¶
The values of this EnumerationDataTypeDefinition.
- class capellambse.extensions.reqif.EnumerationValueAttribute¶
Bases:
AbstractRequirementsAttribute
An enumeration attribute.
- definition¶
The definition of this EnumerationValueAttribute.
- property value¶
- values¶
The values of this EnumerationValueAttribute.
- class capellambse.extensions.reqif.Folder¶
Bases:
Requirement
A folder that stores Requirements.
- folders: m.Accessor¶
The folders of this Folder.
- requirements¶
The requirements of this Folder.
- class capellambse.extensions.reqif.IntegerValueAttribute¶
Bases:
AbstractRequirementsAttribute
An integer value attribute.
- value: t.Any¶
A POD containing an integer number.
- class capellambse.extensions.reqif.InternalRelation¶
Bases:
AbstractRequirementsRelation
A Relation between two requirements.
- class capellambse.extensions.reqif.ModuleType¶
Bases:
AbstractType
A requirement-module type.
- class capellambse.extensions.reqif.RealValueAttribute¶
Bases:
AbstractRequirementsAttribute
A floating-point number value attribute.
- value: t.Any¶
A POD containing a floating-point number.
In Capella’s Java land, these are often called “real numbers”.
- class capellambse.extensions.reqif.RelationType¶
Bases:
AbstractType
A requirement-relation type.
- class capellambse.extensions.reqif.RelationsList¶
Bases:
ElementList
[AbstractRequirementsRelation
]- __init__(model, elements, elemclass=None, *, source)¶
- Parameters:
model (MelodyModel)
source (ModelObject)
- Return type:
None
- by_relation_class(class_)¶
- Return type:
- Parameters:
class_ (Literal['incoming', 'outgoing', 'internal'])
- class capellambse.extensions.reqif.ReqIFElement¶
Bases:
ModelElement
Attributes shared by all ReqIF elements.
- description: str¶
A POD containing arbitrary string data.
- identifier¶
A POD containing arbitrary string data.
- long_name¶
A POD containing arbitrary string data.
- name¶
A POD containing arbitrary string data.
- prefix¶
A POD containing arbitrary string data.
- property type¶
- class capellambse.extensions.reqif.Requirement¶
Bases:
ReqIFElement
A ReqIF Requirement.
- attributes¶
The attributes of this Requirement.
- chapter_name¶
A POD containing arbitrary string data.
- foreign_id¶
A POD containing an integer number.
- owner¶
The owner of this Requirement.
The related of this Requirement.
- relations: m.Accessor[AbstractRequirementsRelation]¶
The relations of this Requirement.
- text¶
A POD containing a string with HTML inside.
- type: m.Accessor¶
The type of this Requirement.
- class capellambse.extensions.reqif.RequirementType¶
Bases:
AbstractType
A requirement type.
- class capellambse.extensions.reqif.RequirementsRelationAccessor¶
Bases:
WritableAccessor
[AbstractRequirementsRelation
]Searches for requirement relations in the architecture layer.
- __init__(*args, **kw)¶
- Return type:
None
- aslist: type[_obj.ElementListCouplingMixin] | None¶
- create(elmlist, typehint=None, /, **kw)¶
Create and return a new element of type
elmclass
.- Parameters:
elmlist (
ElementListCouplingMixin
) – The (coupled)ElementList
to insert the new object into.typehint (
str
|None
) – Hints for finding the correct type of element to create. Can either be a full or shortenedxsi:type
string, or an abbreviation defined by the specific Accessor instance.kw (
Any
) – Initialize the properties of the new object. Depending on the object’s type, some attributes may be required.
- Return type:
- insert(elmlist, index, value)¶
Insert the
value
object into the model.The object must be inserted at an appropriate place, so that, if
elmlist
were to be created afresh,value
would show up at indexindex
.- Return type:
- Parameters:
elmlist (ElementListCouplingMixin)
index (int)
value (ModelObject | NewObject)
- purge_references(obj, target)¶
Do nothing.
This is a no-op, as this accessor provides a virtual relation.
The relation objects it handles are cleaned up by removing the source or target attribute.
- Return type:
- Parameters:
obj (ModelObject)
target (ModelObject)
- class capellambse.extensions.reqif.StringValueAttribute¶
Bases:
AbstractRequirementsAttribute
A string value attribute.
- value: t.Any¶
A POD containing arbitrary string data.
Submodules¶
capellambse.extensions.reqif.exporter module¶
Implementation of a ReqIF 1.1 and 1.2 exporter.