UIMA
  1. UIMA
  2. UIMA-2011

Can't open XMI with data not specified by type system

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.0SDK
    • Component/s: CasEditor
    • Labels:
      None

      Description

      Given a XMI that contains annotations of types not present in the specified type system of the project, the CASe Editor can't open the file and displays an error.

        Activity

        Hide
        Joern Kottmann added a comment -

        Should editing be allowed if the type system does not match? Otherwise the editor could be opened as read only.

        Show
        Joern Kottmann added a comment - Should editing be allowed if the type system does not match? Otherwise the editor could be opened as read only.
        Hide
        Peter Klügl added a comment - - edited

        I think that editing is problematic, because the FS of the missing types are deleted. One could see that as a feature, but if it happens by accident...

        In my optinion read only is a good solution.

        Show
        Peter Klügl added a comment - - edited I think that editing is problematic, because the FS of the missing types are deleted. One could see that as a feature, but if it happens by accident... In my optinion read only is a good solution.
        Hide
        Joern Kottmann added a comment -

        Yeah, I believe we should then extend the error page to offer an option to open the CAS anyway in read-only mode.

        Show
        Joern Kottmann added a comment - Yeah, I believe we should then extend the error page to offer an option to open the CAS anyway in read-only mode.
        Hide
        Joern Kottmann added a comment -

        Should be tested by someone else, and then the issue can be closed.

        Show
        Joern Kottmann added a comment - Should be tested by someone else, and then the issue can be closed.
        Hide
        Joern Kottmann added a comment -

        Ups, closed the wrong issue.

        Show
        Joern Kottmann added a comment - Ups, closed the wrong issue.
        Hide
        Peter Klügl added a comment -

        I doesn't work for me, I get still an exception respectively.

        What do you think about adding this to line 250 in DocumentUimaImpl:

        } else if (DocumentFormat.XMI.equals(format)) {
        XmiCasDeserializer dezerializer = new XmiCasDeserializer(mTypeSystem);

        try

        { saxParser.parse(content, dezerializer.getXmiCasHandler(mCAS)); }

        catch (IOException e)

        { String message = e.getMessage() != null ? e.getMessage() : ""; IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e); throw new CoreException(s); }

        catch (SAXException e) {
        try

        { XmiCasDeserializer.deserialize(content, mCAS, true); }

        catch (SAXException e1)

        { String message = e.getMessage() != null ? e.getMessage() : ""; IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e); throw new CoreException(s); }

        catch (IOException e1)

        { String message = e.getMessage() != null ? e.getMessage() : ""; IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e); throw new CoreException(s); }

        }
        } else

        { throw new CoreException(new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, "Unkown file format!", null)); }

        We would then need a flag or something for readonly and the logic in the editor.

        Show
        Peter Klügl added a comment - I doesn't work for me, I get still an exception respectively. What do you think about adding this to line 250 in DocumentUimaImpl: } else if (DocumentFormat.XMI.equals(format)) { XmiCasDeserializer dezerializer = new XmiCasDeserializer(mTypeSystem); try { saxParser.parse(content, dezerializer.getXmiCasHandler(mCAS)); } catch (IOException e) { String message = e.getMessage() != null ? e.getMessage() : ""; IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e); throw new CoreException(s); } catch (SAXException e) { try { XmiCasDeserializer.deserialize(content, mCAS, true); } catch (SAXException e1) { String message = e.getMessage() != null ? e.getMessage() : ""; IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e); throw new CoreException(s); } catch (IOException e1) { String message = e.getMessage() != null ? e.getMessage() : ""; IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e); throw new CoreException(s); } } } else { throw new CoreException(new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, "Unkown file format!", null)); } We would then need a flag or something for readonly and the logic in the editor.
        Hide
        Joern Kottmann added a comment -

        Sorry, I am bit late with my reply. What are the consequences when we allow the user to edit a CAS with a type system that has unknown types?

        Show
        Joern Kottmann added a comment - Sorry, I am bit late with my reply. What are the consequences when we allow the user to edit a CAS with a type system that has unknown types?
        Hide
        Peter Klügl added a comment -

        I think all feature structures of types not defined in the used type system will be lost.

        I would just not allow the user to make any serious changes by deactivating the save actions int his case. Then the user can open and modify what he wants, but can only store the CAS if he uses the correct type system.

        Show
        Peter Klügl added a comment - I think all feature structures of types not defined in the used type system will be lost. I would just not allow the user to make any serious changes by deactivating the save actions int his case. Then the user can open and modify what he wants, but can only store the CAS if he uses the correct type system.
        Hide
        Joern Kottmann added a comment -

        Sounds good, should we do it for 2.4.0 or wait?

        Show
        Joern Kottmann added a comment - Sounds good, should we do it for 2.4.0 or wait?
        Hide
        Peter Klügl added a comment -

        I really like to have it in the 2.4.0 release. Do want to do this or should I make the changes?

        Btw, another thing I'd really can use for the 2.4.0 release is the option (preference) to deactivate the type system mapping (when selecting the type system). Can we include this too?

        Show
        Peter Klügl added a comment - I really like to have it in the 2.4.0 release. Do want to do this or should I make the changes? Btw, another thing I'd really can use for the 2.4.0 release is the option (preference) to deactivate the type system mapping (when selecting the type system). Can we include this too?
        Hide
        Joern Kottmann added a comment -

        Please open a jira for the type system mapping.

        Would be nice if you can do the change, since I am busy with other things to get the release done, the test plan and the documentation update is still missing.

        I think we should disable this feature by default, since it could be highly confusing for people when they can open a CAS with more or less any type system but cannot edit it.
        Do you have an idea how to solve this?

        Show
        Joern Kottmann added a comment - Please open a jira for the type system mapping. Would be nice if you can do the change, since I am busy with other things to get the release done, the test plan and the documentation update is still missing. I think we should disable this feature by default, since it could be highly confusing for people when they can open a CAS with more or less any type system but cannot edit it. Do you have an idea how to solve this?
        Hide
        Peter Klügl added a comment -

        Issue opened.

        Yes, I will make the changes. My first idea is to add another preference checkbox to enable this functionality. So if the user does not know about it, then the CAS Editor does behave as before.

        Show
        Peter Klügl added a comment - Issue opened. Yes, I will make the changes. My first idea is to add another preference checkbox to enable this functionality. So if the user does not know about it, then the CAS Editor does behave as before.
        Hide
        Joern Kottmann added a comment -

        I think the read-only document support is not properly implemented. I suggest that we don't try to do that now and just allow the user to edit the CAS on his own risk.

        The views would need to be updated to be sensitive to a read only editor.

        Should we create an issue to implement proper read-only support after 2.4.0?

        Show
        Joern Kottmann added a comment - I think the read-only document support is not properly implemented. I suggest that we don't try to do that now and just allow the user to edit the CAS on his own risk. The views would need to be updated to be sensitive to a read only editor. Should we create an issue to implement proper read-only support after 2.4.0?
        Hide
        Joern Kottmann added a comment -

        The preferences for this and the other issue should go into a new preference page which is contributed by the ide plugin.

        Show
        Joern Kottmann added a comment - The preferences for this and the other issue should go into a new preference page which is contributed by the ide plugin.
        Hide
        Peter Klügl added a comment -

        "Should we create an issue to implement proper read-only support after 2.4.0?"

        Ok, I will open a new issue for that.

        I'm a bit busy these days, but I think I can implement both preference issues tomorrow.

        Show
        Peter Klügl added a comment - "Should we create an issue to implement proper read-only support after 2.4.0?" Ok, I will open a new issue for that. I'm a bit busy these days, but I think I can implement both preference issues tomorrow.
        Hide
        Peter Klügl added a comment -

        I added the preference for this issue now to the annotation editor preference page. If you like, I will move the preference again to the ide plugin, but I think this one has no dependency to the ide plugin and is independent of the IDE, because it only controls the deserialization.

        Show
        Peter Klügl added a comment - I added the preference for this issue now to the annotation editor preference page. If you like, I will move the preference again to the ide plugin, but I think this one has no dependency to the ide plugin and is independent of the IDE, because it only controls the deserialization.
        Hide
        Joern Kottmann added a comment -

        No that is fine. Also nice that you added the warning.

        Show
        Joern Kottmann added a comment - No that is fine. Also nice that you added the warning.
        Hide
        Peter Klügl added a comment -

        Added preference for experienced users to load the CAS leniently. Further functionality (if necessary) like deactivating editing should be done in a new issue.

        Show
        Peter Klügl added a comment - Added preference for experienced users to load the CAS leniently. Further functionality (if necessary) like deactivating editing should be done in a new issue.

          People

          • Assignee:
            Peter Klügl
            Reporter:
            Peter Klügl
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development