protegeproject / protege

Protege Desktop
http://protege.stanford.edu
Other
1.02k stars 231 forks source link

sometimes cannot enter language-tag in Protege 5.6.1 #1111

Open jclerman opened 1 year ago

jclerman commented 1 year ago

Summary

The new language-tag autocomplete functionality in Protege 5.6.x is really nice. However, today I found that I was suddiently unable to enter the tag on a given annotation. The behavior seems inconsistent - for example, I can enter an annotation ("comment") on the ontology itself, and set a language-tag for that comment - no problem.

However, here I am trying to enter a tag for a string-annotation on a class - and sometimes it works, but sometimes I can only enter one character of the tag (when I enter the 2nd character, the first one becomes invisible, though trying to select the tag in the UI shows the whole thing, backwards as I recall), and autocomplete is also not working.

Screenshot

image

Stack-trace

I also see a bunch of these stack-traces in the log; these may correlate to the behavior:

  ERROR  11:18:09  Uncaught Exception in thread 'AWT-EventQueue-0'
java.lang.IllegalStateException: Attempt to mutate in notification
    at java.desktop/javax.swing.text.AbstractDocument.writeLock(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.AbstractDocument.replace(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.JTextComponent.setText(Unknown Source) ~[na:na]
    at org.protege.editor.owl.ui.util.SuggestField.clear(SuggestField.java:230) ~[na:na]
    at org.protege.editor.owl.ui.lang.LangTagEditor.clear(LangTagEditor.java:62) ~[na:na]
    at org.protege.editor.owl.ui.editor.OWLConstantEditor.updateDatatype(OWLConstantEditor.java:128) ~[na:na]
    at org.protege.editor.owl.ui.editor.OWLConstantEditor.handleLangTagChanged(OWLConstantEditor.java:118) ~[na:na]
    at org.protege.editor.owl.ui.editor.OWLConstantEditor.lambda$new$0(OWLConstantEditor.java:73) ~[na:na]
    at org.protege.editor.owl.ui.util.SuggestField.handleDocumentChanged(SuggestField.java:114) ~[na:na]
    at org.protege.editor.owl.ui.util.SuggestField$4.insertUpdate(SuggestField.java:77) ~[na:na]
    at java.desktop/javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.AbstractDocument.handleInsertString(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.AbstractDocument.insertString(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.PlainDocument.insertString(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.AbstractDocument.replace(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.JTextComponent.replaceSelection(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction.actionPerformed(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.SwingUtilities.notifyAction(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.JComponent.processKeyBinding(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.JComponent.processKeyBindings(Unknown Source) ~[na:na]
    at java.desktop/javax.swing.JComponent.processKeyEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Component.processEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Container.processEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source) ~[na:na]
    at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source) ~[na:na]
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source) ~[na:na]
    at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[na:na]
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source) ~[na:na]
    at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) ~[na:na]
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) ~[na:na]

Environment

Protege 5.6.1 MacOS 12.6.3 (Monterey)

jclerman commented 1 year ago

After some experimentation I found that the above behavior, and some related-seeming behavior (bug) where I could not even edit some language-tagged annotation-values in Protege, was all apparently caused by one thing: The affected annotation property was modeled with an OWL range of xsd:string. That seems fine (and good) for the annotation-property in question, but is somehow incompatible (in Protege) with language-tagged strings.

Not sure if the incompatibility is correct per OWL - but even if it is, the weird/lost functionality in Protege shouldn't happen; instead it'd be much better if Protege detected the problem and displayed a useful error message, like: "Ontology contains language-tagged string values for annotation-property X, but language-tagged values are outside the stated range of xsd:string for X".