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.
Metadata
Release files for py_traceability_rdf 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_traceability_rdf-0.2.0.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_traceability_rdf-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / py_traceability_rdf-0.2.0.tar.gz
| Download URL | py_traceability_rdf-0.2.0.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25b5b7a744936c6dc58cdabcb3c00338be15500334ac0ffbf1e4cdec71aee479
|
|
BLAKE2b-256 checksum How to use checksums |
6fe875232768629e1f706801bbc9733bf205350f8e2ea0c76d535fdf0e5b8b64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.9.25 Linux/6.17.0-1020-azure
|
Release files / py_traceability_rdf-0.2.0-py3-none-any.whl
| Download URL | py_traceability_rdf-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e50a03a956fc386f11cedd4e0f463940bbecacafff3a9e39ea0c91c0e47d958
|
|
BLAKE2b-256 checksum How to use checksums |
897f5455115335523c1ddad8c2868944239a7d2f5f6b7584d8daa74ef43060bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.9.25 Linux/6.17.0-1020-azure
|