ReqIF Tools v0.9.0 Labs
Added in version 0.9.0.
Syside Automator provides a ReqIF module for converting requirements between ReqIF and SysMLv2 models.
Note
The ReqIF module ships as an optional [reqif] extra and is not installed by
default. Add it with pip install 'syside[reqif]' (or, with uv, uv pip
install 'syside[reqif]'); see Install Automator for the surrounding install
steps. Running syside reqif <subcmd> without the extra exits with a message
pointing back to the same install command, so the failure mode is self-healing.
The module is accessible through syside reqif CLI and contains the following
commands:
init: Initialise the current workspace by extracting theSysideReqIF.sysmllibrary required for ReqIF interoperability.import: Import a ReqIF exchange document into a SysML v2 model. Either creates new elements or merges changes into existing ones.lock: Assign stable identifiers andlast_changetimestamps to newly-authored ReqIF elements so they survive the round-trip back to ReqIF.check: Run validation checks against a ReqIF document or the current SysML v2 workspace without producing any output.export: Write the workspace’s ReqIF-tagged elements out as a ReqIF or ReqIFz exchange document.
Learn about:
Requirements Workflow: Suggested way of working with ReqIF imports and exports
ReqIF and SysML v2 Mapping: How ReqIF concepts map to SysML v2
Preconditions: What the module expects for a successful import or export
Known Limitations: What is still missing from the functionality
Requirements Workflow
The ReqIF specification frames its use around two exchange scenarios between exchange partners — typically two different requirement authoring tools, possibly at two different organisations:
One-way exchange — partner A exports a specification from their authoring tool, transmits it to partner B, and partner B imports it into their authoring tool.
Roundtrip exchange — same as one-way, but partner B then modifies the specification, exports it back to partner A, and partner A re-imports it on top of the original.
The Syside ReqIF CLI plays the role of the “ReqIF tool” on the SysML v2 side of either
scenario. The current workspace (the directory you run the CLI in) is the SysML v2
authoring tool’s storage. The remote partner is whatever requirements management tool
produced or will consume the .reqif / .reqifz exchange document.
The rest of this section walks through the full roundtrip — setup, import, edit, lock, and export — and points out where one-way exchanges deviate.
Set Up the Workspace
Before any ReqIF document can be imported or exported, the workspace needs the
SysideReqIF.sysml library. This library defines the metadata used to mark SysML v2
elements as ReqIF carriers — the @reqif / @reqif_* tags that pin a stable ReqIF
identity onto every imported element, and the #reqif_*_type prefixes used on the
four ReqIF *Type templates.
From the directory you intend to use as the workspace, run:
syside reqif init
This drops lib/SysideReqIF.sysml into the workspace. Pass --lib-dir to put it
somewhere else. The library is plain SysML v2 and is intended to be checked in alongside
the rest of the model.
init is idempotent — re-running it against a workspace that already contains the
library is a safe no-op (Found existing SysideReqIF.sysml library. No action
needed.). The other commands also produce a clear error pointing back to init when
the library is missing, so it is hard to forget.
Step 1 — Import a ReqIF Document
This step covers the ReqIF specification’s UC2: Import New Requirement Specifications and UC3: Update Requirement Specifications. From the SysML v2 side they are the same command — the CLI decides whether to create new elements or merge changes into existing ones based on what the workspace already contains.
Receive a .reqif or .reqifz from the upstream partner and place it anywhere on
disk, then run:
syside reqif import path/to/incoming.reqif
The command parses the exchange document, runs the Preconditions against
both the incoming document and the workspace, and writes a fixed package layout into the
workspace (ReqIF_Import_Enums, ReqIF_Import_Types, ReqIF_Import_Objects,
ReqIF_Import_Specifications, ReqIF_Import_Relations). Binary attachments
referenced from XHTML attribute values are extracted into attachments_reqif/ (or the
directory passed to --attachments-dir).
Imported elements are already locked: each carries an @reqif (or @reqif_*)
metadata tag with the original ReqIF identifier and last_change timestamp, so they
will round-trip back out without losing their identity.
Note
Re-running syside reqif import against a workspace that already contains a prior
import applies only the delta. Elements that had a ReqIF identifier but are no
longer present in the incoming document are reported as orphaned and left in place
— review and delete them by hand if they should be removed. See
Known Limitations for the cases that the delta path does not yet handle and
that require a fresh workspace.
Tip
Run syside reqif import from a clean Git working tree (or whichever VCS you
use). import rewrites the ReqIF_Import_*.sysml files in place, and on a
delta run also rewrites any other files that hold ReqIF elements, so committing
first lets you review git diff afterwards to see exactly what the partner
changed — or, on a fresh import, to sanity-check the generated layout before
building on it.
If the workflow ends here — partner A sent the document for information only — the SysML v2 model is now ready to be browsed, analysed, or fed into downstream tooling. This is the one-way scenario from the ReqIF specification.
Step 2 — Edit the Requirements in SysML v2
Once the document is in the workspace, edit it as ordinary SysML v2: rename
requirements, change attribute values, attach SysML v2 constructs that ReqIF cannot
express (parts, actions, analyses), or add new requirements under existing
Specifications.
Two practical points:
Anything written in SysML v2 that is not annotated with an
@reqif/@reqif_*metadata tag stays SysML-only and will not appear in any future ReqIF export. This is the intended way to enrich an imported document with model content that has no ReqIF counterpart.Anything that is annotated with such a tag and that you want to round-trip back out must end up with a stable identifier. Imported elements already have one; newly authored elements do not until the next step runs.
See ReqIF and SysML v2 Mapping for the table of equivalent constructs to use when authoring on the SysML v2 side.
Reorganising the Imported Files
The five ReqIF_Import_*.sysml files written by import are a starting point, not
a fixed layout. export and the import delta path key off the @reqif
metadata, not the file or package the element happens to live in, so any def-shaped
element — DatatypeDefinitionEnumeration, SpecificationType, SpecObjectType,
SpecRelationType, RelationGroupType, Specification, SpecObject, and
RelationGroup itself — can be moved into a different file or SysML v2 package once
you fix up the private import lines so cross-references still resolve. A subsequent
syside reqif export writes out exactly the same ReqIF content as before the move,
and a subsequent delta syside reqif import recognises the moved elements as
already-present and reports No changes detected.
The exception is usage-shaped elements that depend on their enclosing context:
A
SpecRelation(aconnection) must stay inside theoccurrence deffor itsRelationGroup. The export resolves a relation’s source and target endpoints through thesource_specification/target_specificationfeatures of the enclosing group, and the precondition that “every ReqIF tag must be an owned feature of a ReqIF-annotated type” rejects a relation hoisted into a top-level package. Move the wholeRelationGroupoccurrence definstead — the contained connections travel with it.A nested
SpecHierarchy(arequirementusage indexed as'1','2', …) is owned by the parentSpecObjectdefand moves with thatdef; it cannot be hoisted on its own.
A practical layout is to break the imported model up by subsystem or document — for
example, one file per Specification plus a shared types file — instead of keeping
the four flat ReqIF_Import_Objects / …Specifications / …Relations /
…Types files generated by import. Subdirectories are fine: the workspace is
scanned recursively, so files under specs/, types/, etc. are picked up just like
top-level ones.
Step 4 — Validate (Optional)
The same checks that import and export run automatically can be invoked on their
own:
syside reqif check reqif path/to/incoming.reqif
syside reqif check sysml
Use the first form to vet a .reqif from a new partner before committing to an
import; use the second to confirm the workspace is export-ready without producing an
output file. The full list of checks is documented in Preconditions.
Tip
Wire syside reqif check sysml into your CI/CD pipeline as a gating step. It
exits non-zero on any precondition failure, so a green build means the workspace is
ready for an export or a delta import at any time — no last-minute surprises
about an unlocked element or a stray top-level package when a partner actually asks
for the next round-trip.
Step 5 — Export Back to ReqIF
This step covers the ReqIF specification’s UC1: Export Requirement Specifications. Run:
syside reqif export --title "Brake System Requirements, rev. 3" outgoing.reqif
The --title flag is required and ends up in the exchange document’s
REQ-IF-HEADER as the human-readable name partner A will see. Useful additional
flags:
--comment "<text>"— free-form description that goes into the header alongside the title.--repository-id <id>— identifier (UUID, URL, …) of the repository this export was produced from. Recommended for any roundtrip workflow so the receiver can correlate exports. The Git remote URL of the repository where the SysML v2 model lives is usually the best choice — it identifies the workspace unambiguously and gives a recipient looking at a stale.reqifsomewhere to look it up.--reqifz— emit a zipped archive that bundles the XML and anyattachments_reqif/files into a single file. Use this whenever the document references binary attachments. The flag controls the format of the bytes written; the output filename is whatever you pass as the positionalfileargument, unchanged. The extension must agree with the flag —--reqifz outgoing.reqif(oroutgoing.reqifzwithout--reqifz) is rejected before any model work runs, so pick the matching.reqifz/.reqifname to start with.--attachments-dir <dir>— read attachments from a directory other thanattachments_reqif/.
Transmit the resulting file to partner A through the channel of your choice (email, shared drive, ticket attachment, …). The transmission itself is out of scope of the ReqIF specification and of this CLI.
Note
The body of an exported document (the CORE-CONTENT) is deterministic — running
export twice against an unchanged workspace produces byte-identical
CORE-CONTENT. The REQ-IF-HEADER, however, gets a fresh IDENTIFIER (a
random UUID) and a fresh CREATION-TIME (the current wall-clock time) on every
run. If you intend to commit exported .reqif files to version control alongside
the SysML v2 sources, expect a two-line diff in the header on every re-export even
when nothing in the model has changed.
ReqIF and SysML v2 Mapping
In ReqIF exchange documents, all elements have unique identifiers. SysML v2 currently does not have a standard way to assign unique identifiers to SysML v2 elements in textual notation that do not rely on qualified names and thus survive element renames or moves to another parent.
To preserve these unique ReqIF identifiers for round-trip conversions, the ReqIF
module relies on SysML v2’s metadata for persistence. Every imported element carries a
@reqif metadata tag with its original ReqIF IDENTIFIER and LAST-CHANGE; some
attributes also carry @reqif_* markers for tracking datatype references. This
metadata comes from SysideReqIF.sysml library that syside reqif init drops into
the workspace.
Note
SysML v2 is a significantly more expressive language and exchange format than ReqIF, which can lead to some semantic data loss when exporting SysML v2 content to ReqIF.
The mapping breaks down into three groups: datatypes and attributes, type templates, and the specifications/objects/relations authored against those templates.
Datatypes and Attributes
ReqIF |
SysML v2 |
Notes |
|---|---|---|
Scalar |
No standalone element. Carried as an |
SysML v2 has no ergonomic way to define custom scalar datatypes, so the
datatype’s identity and per-kind props ( |
|
|
|
|
|
Tagged with |
|
|
A default value is written as |
|
|
Uses the binding form |
Type Templates
ReqIF *Type elements act as templates for the specifications, objects, relations and
groups that reference them. Each becomes a SysML v2 definition tagged with the
kind-specific prefix from the SysideReqIF library.
ReqIF |
SysML v2 |
Notes |
|---|---|---|
|
|
Document template. |
|
|
Requirement template. |
|
|
Traceability-relation template. Concrete (not |
|
|
Traceability-context template. |
Specifications, Objects and Relations
These are the elements actually authored against the templates above.
ReqIF |
SysML v2 |
Notes |
|---|---|---|
|
|
Hosts the top-level |
|
|
Hosts any nested |
|
|
Distributing the nodes across their parent |
|
|
Owns the |
|
|
Source/target |
Preconditions
There are a couple of preconditions your ReqIF files and SysML v2 models need to satisfy to use this tool. Most of these preconditions should be met by default if your requirements management tool follows the ReqIF specification.
Precondition satisfaction can be checked using the syside reqif check CLI command.
syside reqif check reqif <file.reqif> runs the ReqIF preconditions against an
exchange document; syside reqif check sysml runs the SysML v2 preconditions against
the current workspace. The same checks also run automatically as part of syside reqif
import and syside reqif export.
ReqIF Preconditions
These checks run against the ReqIF exchange document (after parsing it into the IR).
Structural Integrity
Every cross-element reference must resolve to an element in the document of the right kind: a
Spec*element’stypeto its corresponding*Typedefinition; aSpecHierarchy’sobjectand aSpecRelation’ssourceandtargetto an existingSpecObject; aRelationGroup’ssourceandtargetto an existingSpecification; and everyAttributeDefinition’s datatype to an existingDatatypeDefinition.If the document contains any
SpecRelation, it must also contain at least oneRelationGroup. SysML v2 mapsSpecRelationto a connection inside aRelationGroup, so an unhomed relation has no parent namespace.Every
SpecRelationmust be referenced by exactly oneRelationGroup. References must resolve (no dangling ids), no relation may be claimed by more than one group, and no relation may be left unclaimed.For each
RelationGroup, everySpecRelationit contains must referenceSpecObjectsthat live inside one of theSpecificationsnamed on the group’ssourceandtarget.Each
SpecObjectmay appear in at most oneSpecification.The
SpecHierarchymust contain no cycles — noSpecObjectmay appear as its own descendant.A given
SpecObjectmay parent nested hierarchy nodes in at most one position across the model. Two distinct hierarchy nodes that parent the sameSpecObjectwould emit colliding indexed-name siblings ('1','2', …) under oneRequirementDefinition.
Name Uniqueness Within a Parent
EnumValueswithin an enumerationDatatypeDefmust have unique names.AttributeDefswithin aSpecTypemust have unique names.SpecRelationswithin the sameRelationGroupmust have unique names.
Names That Must Not Shadow Other Names
The SysML v2 embedding emits a fixed package layout (ReqIF_Import_Enums,
ReqIF_Import_Objects, ReqIF_Import_Specifications, ReqIF_Import_Relations,
ReqIF_Import_Types) with a fixed set of imports between them. The following name
collisions would shadow those imports and break re-parsing of the emitted SysML v2:
No element name may match a reserved
SysideReqIFmetadata name (the names defined by theSysideReqIF.sysmllibrary).No
SpecObjectmay share a name with an enumerationDatatypeDef.No
Specificationmay share a name with an enumerationDatatypeDef.No
RelationGrouporSpecRelationmay share a name with anySpecification.An enumeration
DatatypeDefmust not share its name with theAttributeDefit types. Otherwise SysML v2 emits an ambiguousattribute Priority typed by Priority; rename the enum (e.g. toPriority_enum) to fix.A
SpecTypemust not carry both a magicReqIF.Text/ReqIF.DescriptionAttributeDefand a free-formAttributeDefnamedText/Description. The magic attributes are emitted asdoc Text/doc Descriptionblocks on the parent and would shadow the free-form sibling.
Warnings (Non-Fatal)
A
DatatypeDefreferenced by noAttributeDefis reported as a warning. Such aDatatypeDefhas no carrier on the SysML v2 side (the embedding only emitsDatatypeDefsreached through@reqif_*annotations onAttributeDefs) and is dropped on import.
SysML v2 Preconditions
These checks run against the .sysml documents in the current workspace.
Each
.sysmldocument may declare at most one top-levelPackageorLibraryPackage. Incremental ReqIF import overwrites the document with one top-level package, so any extras would be dropped. Both kinds count toward the limit; a file that mixes one of each still fails.Every ReqIF tag (every element annotated with a
@reqif_*metadata tag) must be “locked” — must carry both a stable identifier and alast_changevalue. Unlocked tags lose their identity across ReqIF round-trips. Runsyside reqif lockto populate fresh UUIDs andlast_changetimestamps for any element flagged here.A
@reqif-annotateddefmay subclassify (:>) another@reqif-annotateddefonly when the parent carries a#reqif_*_typeprefix tag and the child does not. This is the instance-to-type pattern thatimportemits — aSpecObject/Specification/RelationGroupdefspecialising its correspondingSpecObjectType/SpecificationType/RelationGroupType. Any other@reqif :> @reqifchain — type extending type, or instance extending instance — has no ReqIF analogue and would be dropped on the next export.attributeusages that redefine (:>>) a type’sAttributeDefare unaffected; redefinition is not subclassification.
Known Limitations
As of 0.9.0, the following ReqIF features are not preserved across syside reqif
import and syside reqif export. Documents using them can still be imported, but
the listed fields will be missing from any ReqIF written back out.
Fields Dropped on Import
The following ReqIF fields are not imported to SysML:
ALTERNATIVE-IDon any element.IS-TABLE-INTERNALonSpecHierarchynodes.EDITABLE-ATTSonSpecHierarchynodes.IS-SIMPLIFIEDon XHTML attribute values, and the original (non-simplified) side of those values.AttributeValuesonRelationGroupandSpecRelations.
Fields Lost on Export
Attribute default values authored in the binding form
attribute X : T = vare not recognised as default values on export. Imported defaults use theattribute X : T default vform, which round-trips correctly; only defaults that are written or edited into the=form on the SysML v2 side after import are lost.
Attachment Bundling on Export
syside reqif exportcollects every file under--attachments-dir(defaultattachments_reqif/) recursively, regardless of whether the file is referenced from any XHTML attribute value in the exported document. Stale files left over from a previous import, build artefacts, scratch notes, or anything else that happens to sit in that directory tree will be shipped alongside the export — and bundled into the.reqifzarchive when--reqifzis used. Curate the directory before exporting, or point--attachments-dirat a folder that contains only the attachments you intend to ship.
XHTML Rich-Text Round-trip
Rich-text (XHTML) attribute values are converted to SysML v2 doc blocks that are
written in Markdown. Some text shapes do not round-trip unchanged:
Runs of two or more spaces inside text content collapse to a single space.
A heading whose only content is a non-breaking space (or any other Unicode whitespace character outside ASCII space) becomes empty.
Two adjacent bullet lists that use different bullet characters (
-and*) merge into a single list.Colored text in HTML cannot be represented in Markdown as colored.
Other Data
Arbitrary accuracy real numbers, as Syside currenltly stores all floating point numbers as Python floats.