stariongroup / reqifsharp Goto Github PK
View Code? Open in Web Editor NEWA C# library for reading and writing reqif documents
License: Apache License 2.0
A C# library for reading and writing reqif documents
License: Apache License 2.0
When a ReqIF object is deserialized, add the XML fragment that represented the object in the ReqIf file. This functionality shall be initialize don request when deserializing as to not incur the memory overhead when this is not requested by the API user
NA
The AlternativeId
property of the Identifiable
abstract class throws an exception
NA
NA
original issue STARIONGROUP/COMET-IME-Community-Edition#996
notice that in the attached file the following occurs
<REQ-IF p1:lang="en" xmlns:p1="xml" xmlns="http://www.omg.org/spec/ReqIF/20110401/reqif.xsd">
the xml namespace is aliased by the p1 namespace, this needs to be handled
Implement event on Deserializer to indicate progress of de-serialization process.
NA
While validating a serialized ReqIF content against the XSD, it appears that the AlternativeId object is wrongly serialized.
Current Serialization Example:
<ALTERNATIVE-ID IDENTIFIER="9"/>
Expected Serialization based on XSD
<ALTERNATIVE-ID>
<ALTERNATIVE-ID IDENTIFIER="9"/>
</ALTERNATIVE-ID>
currently the Deserializer needs a path to an reqif file. Add a method to deserialize from a stream
NA
Add repository to LGTM to scan for zero day vulnerabilities at https://lgtm.com. This requires testing a yaml file and then commiting this yaml file to the repos for proper configuration
NA
I have a reqif that has default values for several attribute definitions. I can deserialize it and see the default values in the data structure, but when serializing it, the default values are missing
<ATTRIBUTE-DEFINITION-ENUMERATION LAST-CHANGE="2021-06-11T15:52:48+02:00" IDENTIFIER="_e5e971b3-62e3-4607-8696-f359c1ae85f3" MULTI-VALUED="false" LONG-NAME="Relevant Author" IS-EDITABLE="true">
<DEFAULT-VALUE>
<ATTRIBUTE-VALUE-ENUMERATION>
<DEFINITION>
<ATTRIBUTE-DEFINITION-ENUMERATION-REF>_e5e971b3-62e3-4607-8696-f359c1ae85f3</ATTRIBUTE-DEFINITION-ENUMERATION-REF>
</DEFINITION>
<VALUES>
<ENUM-VALUE-REF>_6feb570f-8ad8-40d9-9517-5abd6fe6f63a</ENUM-VALUE-REF>
</VALUES>
</ATTRIBUTE-VALUE-ENUMERATION>
</DEFAULT-VALUE>
<TYPE>
<DATATYPE-DEFINITION-ENUMERATION-REF>_1c895072-5968-46a7-ba03-9a3680a499c2</DATATYPE-DEFINITION-ENUMERATION-REF>
</TYPE>
</ATTRIBUTE-DEFINITION-ENUMERATION>
In https://github.com/RHEAGROUP/reqifsharp/blob/development/ReqIFSharp/Datatype/DatatypeDefinitionInteger.cs it is assumed that Integers may only ever be 32 bit. E.g.:
https://github.com/RHEAGROUP/reqifsharp/blob/d96203280ded07de2750971d0ac61f9652e2ba65/ReqIFSharp/Datatype/DatatypeDefinitionInteger.cs#L56
https://github.com/RHEAGROUP/reqifsharp/blob/d96203280ded07de2750971d0ac61f9652e2ba65/ReqIFSharp/Datatype/DatatypeDefinitionInteger.cs#L76
This might not necessarily be true. For example Polarion uses 64bit integers by default, thus resulting in the min/max in the DataType definition to be +/- 9.223.372.036.854.775.807. This leads to a crash while deserializing.
As far as I can tell the ReqIF and xml specification do not make any statements about the maximum size allowed.
Modify an existing .reqif file and adjust the min/max values of an integer DataType definition to use values bigger than a 32 bit int can hold and deserialize it.
Currently the library does not provide support for extracting OLE objects or other objects that may be present in q reqifz file. This needs to be implemented. Question is what would be the best way to achieve this? Currently the reqif xml data is loaded into memory and a fully deserialized object graph is created and made available.
It doubt this is the best way forward for attachments. These might be large objects for which it does not make sense to load them into memory. Probably better to retrieve them (load via stream) on request.
NA
Add capability to serialize to reqifz file and make serializer symmetrical to deserializer
NA
The current implementation is synchronous, the API should be mirrored adding asynchronous methods on the API using the async methods of the XML reader
NA
strip out any xhtml / html tags from the value of a XHTML atrribute value
NA
NA
Feature request: Access to target identifier in RelationGroup(if target object isn't available in *.reqif file, external link)
Given a *.reqif file with a RelationGroup where the target object isn't part of the reqif file (external link). It would be nice to get the identifier of that target object (SpecObject).
New/Changed Interface:
string CoreContent[i].SpecRelations.TargetIdentifier or so
The xml snippet. The identifier 'x0400000001330720' isn't specified in *.reqif. It's part of another file.
<SPEC-RELATION IDENTIFIER="x1500000001330753" LAST-CHANGE="2015-03-31T16:33:20+02:00"> <TARGET> <SPEC-OBJECT-REF>x0400000001330720</SPEC-OBJECT-REF> </TARGET> <SOURCE> <SPEC-OBJECT-REF>x040000000133073F</SPEC-OBJECT-REF> </SOURCE> <TYPE> <SPEC-RELATION-TYPE-REF>SPECREL</SPEC-RELATION-TYPE-REF> </TYPE> </SPEC-RELATION>
only Interface extension.
Add metadata to classes and properties as as in done in the COMET-SDK to self document relationships etc.
NA
NA
I used the code from ReqIFSerializerTestFixture and tested it to become familiar with functions and API.
I checked the resulting ReqIF against reqif.xsd and found the missing namespace for xhtml. After inserting the missing namespace it runs. I have no deep experiences in ReqIF or XML.
Add a capability to compute the difference between 2 ReqIF objects.
NA
Limit deserialization from files with supported file extensions zip, reqif and reqifz. This harmonizes the API to the serializer that only supports serialization to reqif or reqifz or zip files
NA
I pass a .reqif
to parse
{
"ClassName": "System.NullReferenceException",
"Message": "Object reference not set to an instance of an object.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": " at lambdaHandler.Parser.ParseDoc(ReqIF doc) in src/Handler/Parser.cs:line 303\n at lambdaHandler.Parser.Parse(String filePath) in src/Handler/Parser.cs:line 287",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2147467261,
"Source": "Handler",
"WatsonBuckets": null
}
The 303 follows
Numeric values have to be serialized using .NET XmlConvert class in order to create valid numeric XML strings.
For example: In class DatatypeDefinitionReal the Min/Max values are written into the XML writer using ToString() method. This will produce invalid XML if local settings is not set to German.
To produce valid XML all values have to be converted into strings by using XmlConvert.ToString method.
Set local settings of windows system to German settings and serialize a ReqIF document.
Running windows with German local settings.
The class https://github.com/RHEAGROUP/reqifsharp/blob/3f90b2aaa837cf4f553487cb61b7b911eb2ac6fd/ReqIFSharp/AttributeValue/AttributeValueXHTML.cs#L232 looks for external objects in XHTML strings in line 232. That doesn't work if the data Attribute is not in first position. When for example the type Attribute is in first position, no external objects are detected.
I got a ReqIF file where some SPEC-OBJECT elements have ATTRIBUTE-VALUE-XHTML fields that are not properly read after Deserialize. Is there any way to read these values, including formatting or just as plain text?
Example of SPEC-OBJECT within my ReqIF file:
<SPEC-OBJECT IDENTIFIER="rmf-spec-obj-id">
<VALUES>
<ATTRIBUTE-VALUE-XHTML>
<DEFINITION>
<ATTRIBUTE-DEFINITION-XHTML-REF>rmf-field-id</ATTRIBUTE-DEFINITION-XHTML-REF>
</DEFINITION>
<THE-VALUE>
<xhtml:div>Description of the SpecObject that includes formatted tables and/or style:<xhtml:ul class="noindent">
<xhtml:li>Element 1</xhtml:li>
<xhtml:li>Element 2</xhtml:li>
</xhtml:ul></xhtml:div>
</THE-VALUE>
</ATTRIBUTE-VALUE-XHTML>
</VALUES>
<TYPE>
<SPEC-OBJECT-TYPE-REF>_id</SPEC-OBJECT-TYPE-REF>
</TYPE>
</SPEC-OBJECT>
The way I'm deserializing my file:
ReqIFDeserializer deserializer = new ReqIFDeserializer(); ReqIF reqIf = deserializer.Deserialize(@"myFile.reqif");
As a result, I the SpecObjects are created properly within the ReqIF item, but in the list of Values, this ATTRIBUTE-VALUE-XHTML field is never read.
When trying to deserialize a sample file I got an NullReferenceExeption.
The file I used is from google "reqif example files".
https://eclipse.googlesource.com/rmf/org.eclipse.rmf/+/44228c91a7b51612cf392a3e508334cac9c8e602/org.eclipse.rmf.reqif10.model.test/testdata/sample.reqif
public class ReqifTest
{
public ReqifTest()
{
Deserialize();
}
public void Deserialize()
{
var path = @"C:\Users\xxx\Downloads\Sample2.reqif";
ILoggerFactory factory = LoggerFactory.Create(builder => builder.AddDebug().SetMinimumLevel(LogLevel.Trace));
ReqIFDeserializer deserializer = new ReqIFDeserializer(factory);
var reqif = deserializer.Deserialize(path);
var first = reqif.First();
var header = first.TheHeader;
var content = first.CoreContent;
Debug.WriteLine("Halt");
}
}
While executing the Deserialize-Method throws an exception.
Logging from stacktrace
at System.Xml.Schema.XsdDateTime.Parser.Parse(String text, XsdDateTimeFlags kinds)
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
at ReqIFSharp.Identifiable.ReadXml(XmlReader reader)
at ReqIFSharp.DatatypeDefinitionString.ReadXml(XmlReader reader)
at ReqIFSharp.ReqIFContent.DeserializeDataTypes(XmlReader reader)
at ReqIFSharp.ReqIFContent.ReadXml(XmlReader reader)
at ReqIFSharp.ReqIF.ReadXml(XmlReader reader)
at ReqIFSharp.ReqIFDeserializer.DeserializeReqIF(Stream stream, SupportedFileExtensionKind fileExtensionKind, Boolean validate, ValidationEventHandler validationEventHandler)
at ReqIFSharp.ReqIFDeserializer.Deserialize(String fileUri, Boolean validate, ValidationEventHandler validationEventHandler)
at ReqifSharpExample.ReqifTest.Deserialize() in C:\Users\xxx\source\repos\ReqifSharpExample\ReqifSharpExample\Program.cs:line 35
Logging from Debug-Output
ReqIFSharp.ReqIFDeserializer: Trace: start deserializing from C:\Users\xxx\Downloads\Sample2.reqif
ReqIFSharp.ReqIFDeserializer: Trace: reading from reqif
ReqIFSharp.ReqIFDeserializer: Trace: starting to read xml
ReqIFSharp.Identifiable: Trace: read xml of DatatypeDefinitionString:3631dcd2-59d1-11da-beb2-6fbc179f63e3
Ausnahme ausgelöst: "System.NullReferenceException" in System.Xml.dll
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
If this is not a bug I am very sorry for bothering you. I was successfull with another example file but as the sample file is pretty small I am not sure what should be wrong with it.
If you could point me in a direction where I could find other (known working an validated) sample files I would gladly try them. Thank you for making this library available!
Best regards
First of all thanks for the great library!
When defining custom DataTypes I get an error with v5. With v4 the document seems to be correct.
Do I miss something that I need to change for the upgrade?
The following test case will pass with v4 and fail with v5
The error stack trace is:
The type ReqIFSharp.DatatypeDefinitionDate was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterReqIF.Write5_DatatypeDefinition(String n, String ns, DatatypeDefinition o, Boolean isNullable, Boolean needType)
[Fact]
public void TestSerialize()
{
var document = new ReqIF
{
Lang = "en",
TheHeader = new ReqIFHeader(),
CoreContent = new ReqIFContent()
};
var dateDefinition = new DatatypeDefinitionDate
{
Identifier = "dateDefinition",
LongName = "Date",
LastChange = new DateTime()
};
document.CoreContent.DataTypes.Add(dateDefinition);
using var file = new TemporaryFile();
var serializer = new ReqIfSerializer();
serializer.Serialize(document, file.FileInfo.FullName);
Assert.InRange(file.FileInfo.Length, 600, 700);
}
NA
add capability to serialize to stream (next to serialization to file)
NA
The AlternativeId of the DatatypeDefinition
objects is not deserialized
NA
Provide some additional test cases with interoperability with DOORS with databases provided by ESA as examples.
Serialization can be improved by refactoring and removing the xmlSerializer
and relying solely on the XmlWriter
and XmlReader
classes.
NA
The only documentation that exists is on the Getting Started. Document the library on the GitHub wiki
Add logging using Microsoft logging abstractions so a library user can inject their own logging library.
NA
When I use the reqifsharp for deserialize a large ReqIF file, the program throw the exception.
It seems that the cause is that the position of the stream changes when the program reads the stream using ZipArchive().
I confirmed by debugging that the position of Stream does not return to 0 not only for ReqIF files but also for files with a large number of characters.
For example, is it possible to change the program to return the stream position to 0?
The sample file with the problem is attached below.
Thank you.
https://github.com/RHEAGROUP/reqifsharp/blob/development/ReqIFSharp/ReqIFDeserializer.cs#L240
sample-reqif file: sample.zip
It would be nice to have the Parent Property in SpecHierarchy Objects like stated in the ReqIF Specification (10.8.37 SpecHierarchy)
ReqEdit outputs the error message:
Fatal (SCHEMA): Error: The 'IS-SIMPLIFIED' attribute is invalid - The value 'False' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:boolean' - The string 'False' is not a valid Boolean value.; Line and position: 218, 36
The reqif file contains 'False' and 'false' as boolean value. I only used the default value of the attribute. Most of the values are correct.
Write a new ReqIF file.
When a reqif file is deserialized to a ReqIF object and then serialized to a new destination file, the namespaces should be retained
ReqIF 'TOOL-EXTENSIONS' are not loaded when the rest of the ReqIF file is deserialized.
Some brute force debugging of commenting out chunks of ReqIF.cs showed that commenting out the following lines in the ReqIF.cs file allows Tool-Extensions to load:
https://github.com/RHEAGROUP/reqifsharp/blob/2116a7a3e2ba9e4aaa8e57aa012a3d70eb6d3fa0/ReqIFSharp/ReqIF.cs#L64-L75
Some further debugging into ReqIFContent.cs lead me to the ReadXml function:
https://github.com/RHEAGROUP/reqifsharp/blob/2116a7a3e2ba9e4aaa8e57aa012a3d70eb6d3fa0/ReqIFSharp/ReqIFContent.cs#L139-L141
The while loop appears to be iterating over all remaining XML elements in the file, going outside the scope of the CORE-CONTENT
and REQ-IF-CONTENT
elements.
Reference ReqIF file:
ProR_Traceability-Template-v1.0.reqif.zip
Following Nunit test fails for the provided ReqIF file:
var path = "ProR_Traceability-Template-v1.0.reqif";
var deserializer = new ReqIFSharp.ReqIFDeserializer();
var reqif = deserializer.Deserialize(path);
Assert.That(reqif.TheHeader, Is.Not.Empty);
Assert.That(reqif.CoreContent, Is.Not.Empty);
// Note: This is the problem. This SHOULDN'T be empty, but it is.
Assert.That(reqif.ToolExtensions, Is.Not.Empty);
Update docs on page https://github.com/RHEAGROUP/reqifsharp/wiki/Quick-Start
NA
NA
Add the capability to perform asynchronous serialization
NA
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.