ReqIF (Requirements Interchange Format) is an OMG (Object Management Group) standard for the exchange of requirements between different tools. It is designed to facilitate the transfer of requirements information, ensuring that data can be shared and understood across various platforms and organizations. ReqIF provides a standardized XML format for requirements, making it easier to manage and collaborate on requirements throughout the development lifecycle.
The requirements-interchange-format (ReqIF) library is a parser (and in the future maybe generator) for ReqIF XML documents. The classes ReqIF.java and ReqIFz.java can access and decompress ReqIF content for further automation in a Java application.
This fork is based on https://github.com/bfriebel/requirements-interchange-format and fixed old library dependencies.
ReqIF file extensions .reqif and .reqifz (compressed).
The project builds with Maven (Java 17+):
mvn verify
Every push and pull request runs the test suite via GitHub Actions
(.github/workflows/ci.yml). The tests in src/test/java cover the
fixed parser defects documented in FEHLERANALYSE.md (namespace-prefixed
XHTML, multiselect enumerations, image/object conversion, picture lookup
in .reqifz archives, and crash robustness).
ReqIF has no semantic "this is a requirement" flag. The categories
REQ, SUB-REQ, HEADLINE and TEXT are this parser's own content
categories, not official ReqIF types — the standard only defines structural
types (SPEC-OBJECT-TYPE, SPECIFICATION-TYPE, SPEC-RELATION-TYPE) with
free-form LONG-NAMEs and free-form attributes. What an object means is a
convention of the exporting tool or exchange profile.
Classification is therefore a pluggable strategy (TypeClassifier). The
strategy receives the fully parsed SpecObject, so it may decide based on
the spec type name, the attribute values, or both. Two implementations ship
with the library.
The default applies a substring heuristic on the spec type name ("req", "sub", "headline"). It fits profiles whose type names follow that convention, but misses e.g. German type names or exports that only encode the content kind in attributes. It is used automatically when no classifier is passed.
The ProSTEP iViP / ReqIF Implementor Forum "ReqIF Implementation Guide" standardizes attribute names (while type names stay free-form). Tools such as IBM DOORS, PTC and Polarion emit:
ReqIF.ChapterName— set on heading objectsReqIF.Text— the requirement/description body
This classifier decides by those attributes, independent of the type name, which is more robust and tool-independent:
import de.uni_stuttgart.ils.reqif4j.specification.ReqIFImplementationGuideClassifier;
ReqIF reqif = new ReqIF("doors-export.reqif", new ReqIFImplementationGuideClassifier());
// custom attribute names, if your profile differs:
ReqIF reqif2 = new ReqIF("export.reqif",
new ReqIFImplementationGuideClassifier("Heading", "Body"));Rule: non-empty ReqIF.ChapterName → HEADLINE; else non-empty
ReqIF.Text → REQ; else TEXT. Note that the guide does not distinguish
normative requirements from informational text (both use ReqIF.Text), so
text-bearing objects are reported as REQ; use a custom classifier if your
profile marks requirements with an extra attribute.
Any other convention can be implemented directly:
TypeClassifier classifier = new TypeClassifier() {
@Override
public String classify(SpecObject specObject) {
String name = specObject.getSpecTypeName().toLowerCase();
if (name.contains("anforderung")) return ReqIFConst.REQ;
if (name.contains("überschrift")) return ReqIFConst.HEADLINE;
return ReqIFConst.TEXT;
}
@Override
public boolean isRequirement(SpecObject specObject) {
return ReqIFConst.REQ.equals(specObject.getType());
}
@Override
public boolean isSubRequirement(SpecObject specObject) {
return false;
}
};
ReqIF reqif = new ReqIF("spec.reqif", classifier); // .reqif
ReqIFz reqifz = new ReqIFz("archive.reqifz", classifier); // .reqifz