dkpro / dkpro-cassis

UIMA CAS processing library written in Python
https://pypi.org/project/dkpro-cassis/
Apache License 2.0
84 stars 22 forks source link

Inheritance-final and feature-final not supported/checked #166

Open reckart opened 3 years ago

reckart commented 3 years ago

Describe the bug The cassis cas_with_collections test uses a type system in which a type is derived from uima.cas.StringArray. Loading this type system in the UIMA Java SDK produces an error.

To Reproduce

var tsd  = UIMAFramework.getXMLParser().parseTypeSystemDescription(new XMLInputSource("typesystem_with_collections_xml"));
CasCreationUtils.createCas(tsd, null, null, null);

Expected behavior If a type is inheritance final in the UIMA Java SDK, alternative implementations should probably also not permit subclassing it because the resulting XMI/TS files would not be interoperable.

Error message

Caused by: org.apache.uima.cas.admin.CASAdminException: Can't derive from type "uima.cas.StringArray" since it is inheritance final.
    at org.apache.uima.cas.impl.TypeSystemImpl.newTypeChecks(TypeSystemImpl.java:915)
    at org.apache.uima.cas.impl.TypeSystemImpl.addType(TypeSystemImpl.java:960)
    at org.apache.uima.cas.impl.TypeSystemImpl.addType(TypeSystemImpl.java:1)
    at org.apache.uima.util.CasCreationUtils.setupTypeSystem(CasCreationUtils.java:793)
    at org.apache.uima.util.CasCreationUtils.doCreateCas(CasCreationUtils.java:632)
    at org.apache.uima.util.CasCreationUtils.createCas(CasCreationUtils.java:375)
    at org.apache.uima.util.CasCreationUtils.createCas(CasCreationUtils.java:350)

Please complete the following information:

Additional information

Inheritance-final types (no subtypes permitted):

    setTypeFinal(intType);
    setTypeFinal(floatType);
    setTypeFinal(stringType);
    setTypeFinal(arrayBaseType);
    setTypeFinal(fsArrayType);
    setTypeFinal(intArrayType);
    setTypeFinal(floatArrayType);
    setTypeFinal(stringArrayType);
    setTypeFinal(sofaType);

    setTypeFinal(byteType);
    setTypeFinal(booleanType);
    setTypeFinal(shortType);
    setTypeFinal(longType);
    setTypeFinal(doubleType);
    setTypeFinal(booleanArrayType);
    setTypeFinal(byteArrayType);
    setTypeFinal(shortArrayType);
    setTypeFinal(longArrayType);
    setTypeFinal(doubleArrayType);

    setTypeFinal(fsListType);
    setTypeFinal(floatListType);
    setTypeFinal(stringListType);
    setTypeFinal(intListType);
    setTypeFinal(fsEListType);
    setTypeFinal(floatEListType);
    setTypeFinal(stringEListType);
    setTypeFinal(intEListType);
    setTypeFinal(fsNeListType);
    setTypeFinal(floatNeListType);
    setTypeFinal(stringNeListType);
    setTypeFinal(intNeListType);

Feature-final types (sub-types cannot add new features):

    topType.setFeatureFinal();
    listBaseType.setFeatureFinal();
    fsListType.setFeatureFinal();
    fsEListType.setFeatureFinal();
    fsNeListType.setFeatureFinal();
    floatListType.setFeatureFinal();
    floatEListType.setFeatureFinal();
    floatNeListType.setFeatureFinal();
    intListType.setFeatureFinal();
    intEListType.setFeatureFinal();
    intNeListType.setFeatureFinal();
    stringListType.setFeatureFinal();
    stringEListType.setFeatureFinal();
    stringNeListType.setFeatureFinal();
    annotType.setFeatureFinal();
    annotBaseType.setFeatureFinal();
jcklie commented 3 years ago

@reckart Is this done now?

reckart commented 3 years ago

I think we have the inhertiance-final now, but not the feature-final.