Skip to content

Error if there is no sofa #218

Description

@reckart

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

Activity

  1. added this to the 0.7.0 milestone on Sep 29, 2021
  2. modified the milestones: 0.7.0, Backlog on Dec 15, 2021
  3. added theissue type on Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions