A Python library providing RDF ontology definitions for requirement traceability across heterogeneous MBSE artifacts.
Project description
py-traceability-rdf
A Python library providing RDF ontology definitions for object-level traceability. The package includes a generated Turtle ontology and a Python interface to access traceability classes and properties for pre- and post-requirement links.
Ontology Visualization
You can visualize the ontology (TTL file) with WebVOWL.
Installation
pip install py_traceability_rdf
Usage
from py_traceability_rdf import Traceability
from rdflib import URIRef, Graph, RDF
g = Graph()
g.bind("trc", Traceability._NS)
req = URIRef("http://example.org#req_1")
design = URIRef("http://example.org#design_1")
decision = URIRef("http://example.org#decision_1")
rationale = URIRef("http://example.org#rationale_1")
source = URIRef("http://example.org#source_1")
stakeholder = URIRef("http://example.org#stakeholder_1")
test = URIRef("http://example.org#test_1")
module = URIRef("http://example.org#module_1")
g.add((req, RDF.type, Traceability.Requirement))
g.add((design, RDF.type, Traceability.DesignElement))
g.add((decision, RDF.type, Traceability.Decision))
g.add((rationale, RDF.type, Traceability.Rationale))
g.add((source, RDF.type, Traceability.Source))
g.add((stakeholder, RDF.type, Traceability.Stakeholder))
g.add((test, RDF.type, Traceability.TestCase))
g.add((module, RDF.type, Traceability.Implementation))
# Satisfaction
g.add((design, Traceability.satisfies, req))
g.add((module, Traceability.realizes, design))
g.add((test, Traceability.verifies, module))
# Rationale and provenance
g.add((decision, Traceability.isJustifiedBy, rationale))
g.add((rationale, Traceability.originatesFrom, source))
g.add((decision, Traceability.involves, stakeholder))
Traceable Objects
IdentifiableObject
Abstract base class for entities with stable identity metadata.
Datatype properties:
identifier(xsd:string): Stable unique key for cross-artifact traceability. Source: [2], [3]title(xsd:string): Human-readable object title used in trace navigation. Source: [2]
TraceableObject
Abstract base class for all traceable entities. Subclass of IdentifiableObject.
Datatype properties:
createdAt(xsd:dateTime): Creation timestamp for lifecycle reconstruction. Source: [1], [3]modifiedAt(xsd:dateTime): Last modification timestamp for change tracking. Source: [1], [3]
Requirement
Requirement that defines goals, constraints, or expected behavior.
Datatype properties:
criticality(xsd:string): Criticality level for prioritization/compliance focus (for examplehigh,safety-critical). Source: [2], [3]
DesignElement
Design artifact that realizes requirements.
Datatype properties:
designType(xsd:string): Design kind (for example architecture block, interface, SysML element). Source: [4]
Implementation
Implementation artifact such as a module, class, or function.
Datatype properties:
implementationType(xsd:string): Technology or realization type (for examplesoftware,firmware,hardware). Source: [2], [3]version(xsd:string): Version or revision identifier of the implementation artifact. Source: [3]
TestCase
Verification artifact used to validate requirements or implementation.
Datatype properties:
testType(xsd:string): Test class (unit, integration, acceptance, etc.). Source: [4]verificationStatus(xsd:string): Verification state (planned, passed, failed, blocked, etc.). Source: [3]
Decision
Decision made during development or change management.
Datatype properties:
decisionStatus(xsd:string): Decision state (proposed, accepted, rejected, deprecated). Source: [2]
Rationale
Explanation or justification that captures why a decision was made.
Datatype properties:
rationaleKind(xsd:string): Rationale category (issue, argument, assumption, alternative). Source: [2]
Source
Source artifact such as a document, note, ticket, or standard.
Datatype properties:
sourceType(xsd:string): Source category (document, standard, ticket, meeting note, etc.). Source: [2]sourceReference(xsd:anyURI): URI or external reference to the source artifact. Source: [2], [3]
Stakeholder
Person, role, or organization responsible for creating or changing artifacts. Subclass of IdentifiableObject.
Datatype properties:
stakeholderRole(xsd:string): Role in lifecycle activities. Source: [1], [2]organization(xsd:string): Team or organization affiliation. Source: [2]
Object Properties
| Relation | classification [2] | Domain | Range |
|---|---|---|---|
| satisfies | Satisfaction | DesignElement | Requirement |
| verifies | Satisfaction | TestCase | Implementation |
| realizes | Dependency | Implementation | DesignElement |
| contains | Dependency | Requirement | Requirement |
| tracesTo | Rationale | Requirement | Rationale |
| isJustifiedBy | Rationale | Decision | Rationale |
| originatesFrom | - | Rationale | Source |
| involves | - | TraceableObject | Stakeholder |
Development
Regenerating the Ontology
python create_traceability_ontology.py
Testing
python -m pytest tests/
Building the Package
poetry build
Publish the Package
poetry publish --username __token__ --password <TOKEN>
License
References
[1] Gotel, O. C. Z.; Finkelstein, A. C. W. (1994): An Analysis of the Requirements Traceability Problem.
[2] Ramesh, B.; Jarke, M. (2001): Toward Reference Models for Requirements Traceability.
[3] Cleland-Huang, J. et al. (2014): Software Traceability: Trends and Future Directions.
[4] Roques, P. (IREB RE Magazine): Modeling Requirements with SysML.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_traceability_rdf-0.2.0.tar.gz.
File metadata
- Download URL: py_traceability_rdf-0.2.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.17.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25b5b7a744936c6dc58cdabcb3c00338be15500334ac0ffbf1e4cdec71aee479
|
|
| MD5 |
540979aad9d3dad8fe27b613ddfd6735
|
|
| BLAKE2b-256 |
6fe875232768629e1f706801bbc9733bf205350f8e2ea0c76d535fdf0e5b8b64
|
File details
Details for the file py_traceability_rdf-0.2.0-py3-none-any.whl.
File metadata
- Download URL: py_traceability_rdf-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.17.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e50a03a956fc386f11cedd4e0f463940bbecacafff3a9e39ea0c91c0e47d958
|
|
| MD5 |
0f6d308247a9b7b337df2659d512d04c
|
|
| BLAKE2b-256 |
897f5455115335523c1ddad8c2868944239a7d2f5f6b7584d8daa74ef43060bf
|