dkpro-cassis
dkpro-cassis copied to clipboard
Error if there is no sofa
Describe the bug It is possible to create CAS objects in the UIMA Java SDK that do contain feature structures but not any sofa. XMI representing such CAS objects cannot be loaded in cassis.
To Reproduce
public static CAS casWithFloatingPointSpecialValues() throws Exception {
CAS cas = createCas();
DoubleArrayFS doubleArrayFs = cas.createDoubleArrayFS(5);
doubleArrayFs.set(0, 0.0);
doubleArrayFs.set(1, 1.0);
doubleArrayFs.set(2, Double.NEGATIVE_INFINITY);
doubleArrayFs.set(3, Double.POSITIVE_INFINITY);
doubleArrayFs.set(4, Double.NaN);
cas.addFsToIndexes(doubleArrayFs);
return cas;
}
<?xml version="1.0" encoding="UTF-8"?><xmi:XMI xmlns:noNamespace="http:///uima/noNamespace.ecore" xmlns:tcas="http:///uima/tcas.ecore" xmlns:xmi="http://www.omg.org/XMI" xmlns:cas="http:///uima/cas.ecore" xmi:version="2.0">
<cas:NULL xmi:id="0"/>
<cas:DoubleArray xmi:id="1" elements="0.0 1.0 -Infinity Infinity NaN"/>
<cas:View members="1"/>
</xmi:XMI>
Expected behavior Good question. I'd say the CAS should load and probably add the feature structures to the default view but without initializing the sofa of the view.
Error message
../cassis/xmi.py:73: in load_cas_from_xmi
return deserializer.deserialize(
../cassis/xmi.py:123: in deserialize
proto_view = self._parse_view(elem)
../cassis/xmi.py:295: in _parse_view
sofa = int(attributes["sofa"])
Please complete the following information:
- Version: 0.6.0-SNAPSHOT