protege icon indicating copy to clipboard operation
protege copied to clipboard

StringIndexOutOfBoundsException when adding annotation properties

Open fanavarro opened this issue 5 years ago • 3 comments

Hi all, I'm creating an ontology that uses several custom annotation properties for annotating classes. Nonetheless, protege crashes randomly when I try to create annotations on class. Concretely, I have created two annotation properties "maxValue" and "minValue". The first time I annotate a class with one of these properties, it works well; however, when I try to include a second annotation on that class by using the other annotation property, the window for including annotations is not opening, and the log shows a java exception. Then, I'm able to save the ontology, close and reopen protege, load the ontology again, and include the annotation that failed previously.

I tried to reproduce the issue in a smaller test-case ontology, but I couldn't...

The log file is the following:

INFO  12:36:16  ------------------------------------ Protege -----------------------------------
   INFO  12:36:16  Protege Desktop
   INFO  12:36:16  Version 5.5.0, Build 
   INFO  12:36:16  
   INFO  12:36:16  
   INFO  12:36:16  ----------------------------------- Platform -----------------------------------
   INFO  12:36:16  Java: JVM 1.8.0_121-b13  Memory: 8232M
   INFO  12:36:16  Language: es, Country: ES
   INFO  12:36:16  Framework: Apache Software Foundation (1.8) 
   INFO  12:36:16  OS: linux (5.4.0-65-generic)
   INFO  12:36:16  Processor: x86-64

   INFO  12:36:16  
   INFO  12:36:16  ------------------------------------ Plugins -----------------------------------
   INFO  12:36:16  Plugin: SWRLTab Protege 5.0+ Plugin (2.0.6)
   INFO  12:36:16  Plugin: Cellfie Protege 5.0+ Plugin (2.1.0)
   INFO  12:36:16  Plugin: SPARQL Query Plugin (3.0.0)
   INFO  12:36:16  Plugin: OWL Difference (6.0.2)
   INFO  12:36:16  Plugin: Explanation Workbench (3.0.0)
   INFO  12:36:16  Plugin: HermiT Reasoner (1.4.3.456)
   INFO  12:36:16  Plugin: Factplusplus Plug-in (1.6.5)
   INFO  12:36:16  Plugin: ELK Reasoner Protege Plug-in (0.4.3)
   INFO  12:36:16  Plugin: DL Query (4.0.1)
   INFO  12:36:16  Plugin: Existential Query (2.0.0)
   INFO  12:36:16  Plugin: VOWL Plugin (0.1.4.SNAPSHOT)
   INFO  12:36:16  Plugin: Browser View (OWLDoc) (3.0.3)
   INFO  12:36:16  Plugin: OntoGraf (2.0.3)
   INFO  12:36:16  Plugin: OWLViz (5.0.3)
   INFO  12:36:16  Plugin: OWL Code Generation Plug-in (2.0.0)
   INFO  12:36:16  Plugin: Pellet Reasoner Plug-in (2.2.0)
   INFO  12:36:16  Plugin: OWLAPI RDF Library (3.0.0)
   INFO  12:36:16  
   INFO  12:36:16  Creating and setting up empty (default) editor kit
   INFO  12:36:16  OWL API Version: 4.5.9.2019-02-01T07:24:44Z
   INFO  12:36:18  Cannot generate ontology catalog for ontology at http://www.semanticweb.org/fabad/ontologies/2021/1/untitled-ontology-1583. URI scheme is not "file"
   INFO  12:36:18  ------------------------------- Auto-update Check ------------------------------
   INFO  12:36:18  Auto-update is disabled
   INFO  12:36:18  
   INFO  12:37:04  OWL API Version: 4.5.9.2019-02-01T07:24:44Z
   INFO  12:37:04  ------------------------------- Loading Ontology -------------------------------
   INFO  12:37:04  Loading ontology from file:/home/fabad/Proyectos_python/P4Q-rest/resources/FormViewOntology.owl
   INFO  12:37:04  Finished loading file:/home/fabad/Proyectos_python/P4Q-rest/resources/FormViewOntology.owl
   INFO  12:37:04  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:37:04  [GitRepo] On branch: main
   INFO  12:37:04  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:37:04  [GitRepo] On branch: main
   INFO  12:37:04  Loading for ontology and imports closure successfully completed in 794 ms
   INFO  12:37:04  
   INFO  12:37:05  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:37:05  [GitRepo] On branch: main
   INFO  12:37:05  ---------------------------- Disposing of Workspace ----------------------------
   INFO  12:37:05  Saved tab state for 'DL Query' tab
   INFO  12:37:05  Saved tab state for 'Entities' tab
   INFO  12:37:05  Saved tab state for 'OWLViz' tab
   INFO  12:37:05  Saved tab state for 'OntoGraf' tab
   INFO  12:37:05  Saved tab state for 'Individuals by class' tab
   INFO  12:37:05  Saved tab state for 'VOWL' tab
   INFO  12:37:05  Saved tab state for 'Active ontology' tab
   INFO  12:37:05  Saved tab state for 'SPARQL Query' tab
   INFO  12:37:05  Saved workspace
   INFO  12:37:05  Disposed of 'DL Query' tab
   INFO  12:37:05  Disposed of 'Entities' tab
   INFO  12:37:05  Disposed of 'OWLViz' tab
   INFO  12:37:05  Disposed of 'OntoGraf' tab
   INFO  12:37:05  Disposed of 'Individuals by class' tab
   INFO  12:37:05  Disposed of 'VOWL' tab
   INFO  12:37:05  Disposed of 'Active ontology' tab
   INFO  12:37:05  Disposed of 'SPARQL Query' tab
   INFO  12:37:05  Disposed of workspace
   INFO  12:37:05  
   INFO  12:37:05  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:37:05  [GitRepo] On branch: main
   INFO  12:38:05  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:38:05  [GitRepo] On branch: main
   INFO  12:38:08  ------------------------ Saving Workspace and Ontologies -----------------------
   INFO  12:38:08  Will save the FormViewOntology ontology because it has been modified
   INFO  12:38:08  Saving FormViewOntology
   INFO  12:38:08  Saving ontology to temp file: /tmp/temp-ontology3354218334837036436
   INFO  12:38:08  Copying ontology from temp file (/tmp/temp-ontology3354218334837036436) to actual destination (/home/fabad/Proyectos_python/P4Q-rest/resources/FormViewOntology.owl)
   INFO  12:38:08  Removing temp file: /tmp/temp-ontology3354218334837036436
   INFO  12:38:08  Saved ontology OntologyID(OntologyIRI(<http://www.semanticweb.org/Precise4Q/ontologies/FormViewOntology>) VersionIRI(<null>)) to file:/home/fabad/Proyectos_python/P4Q-rest/resources/FormViewOntology.owl in RDF/XML Syntax format
   INFO  12:38:08  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:38:08  [GitRepo] On branch: main
   INFO  12:38:08  Saved tab state for 'Active ontology' tab
   INFO  12:38:08  Saved tab state for 'DL Query' tab
   INFO  12:38:08  Saved tab state for 'OWLViz' tab
   INFO  12:38:08  Saved tab state for 'Entities' tab
   INFO  12:38:08  Saved tab state for 'VOWL' tab
   INFO  12:38:08  Saved tab state for 'OntoGraf' tab
   INFO  12:38:08  Saved tab state for 'Individuals by class' tab
   INFO  12:38:08  Saved tab state for 'SPARQL Query' tab
   INFO  12:38:08  Saved workspace
   INFO  12:38:08  
   INFO  12:38:08  [GitRepo] Git repository detected: /home/fabad/Proyectos_python/P4Q-rest/.git
   INFO  12:38:08  [GitRepo] On branch: main
  ERROR  12:38:39  Uncaught Exception in thread 'AWT-EventQueue-0'
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(String.java:658) ~[na:1.8.0_121]
	at uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryInternalsImplNoCache.getOWLLiteral(OWLDataFactoryInternalsImplNoCache.java:186) ~[na:na]
	at uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl.getOWLLiteral(OWLDataFactoryImpl.java:1854) ~[na:na]
	at org.protege.editor.owl.ui.editor.OWLConstantEditor.getEditedObject(OWLConstantEditor.java:186) ~[na:na]
	at org.protege.editor.owl.ui.editor.OWLConstantEditor.getEditedObject(OWLConstantEditor.java:38) ~[na:na]
	at org.protege.editor.owl.ui.editor.OWLAnnotationEditor.isValid(OWLAnnotationEditor.java:242) ~[na:na]
	at org.protege.editor.owl.ui.editor.OWLAnnotationEditor.addStatusChangedListener(OWLAnnotationEditor.java:248) ~[na:na]
	at org.protege.editor.owl.ui.framelist.OWLFrameList.showEditorDialog(OWLFrameList.java:435) ~[na:na]
	at org.protege.editor.owl.ui.framelist.OWLFrameList.handleEdit(OWLFrameList.java:367) ~[na:na]
	at org.protege.editor.owl.ui.framelist.OWLFrameList.handleAdd(OWLFrameList.java:346) ~[na:na]
	at org.protege.editor.core.ui.list.MList.lambda$new$1(MList.java:44) ~[na:na]
	at org.protege.editor.core.ui.list.MList.handleMouseClick(MList.java:212) ~[na:na]
	at org.protege.editor.core.ui.list.MList.access$200(MList.java:22) ~[na:na]
	at org.protege.editor.core.ui.list.MList$3.mouseReleased(MList.java:107) ~[na:na]
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290) ~[na:1.8.0_121]
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) ~[na:1.8.0_121]
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) ~[na:1.8.0_121]
	at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) ~[na:1.8.0_121]
	at java.awt.Component.processMouseEvent(Component.java:6533) ~[na:1.8.0_121]
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) ~[na:1.8.0_121]
	at java.awt.Component.processEvent(Component.java:6298) ~[na:1.8.0_121]
	at java.awt.Container.processEvent(Container.java:2236) ~[na:1.8.0_121]
	at java.awt.Component.dispatchEventImpl(Component.java:4889) ~[na:1.8.0_121]
	at java.awt.Container.dispatchEventImpl(Container.java:2294) ~[na:1.8.0_121]
	at java.awt.Component.dispatchEvent(Component.java:4711) ~[na:1.8.0_121]
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) ~[na:1.8.0_121]
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) ~[na:1.8.0_121]
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) ~[na:1.8.0_121]
	at java.awt.Container.dispatchEventImpl(Container.java:2280) ~[na:1.8.0_121]
	at java.awt.Window.dispatchEventImpl(Window.java:2746) ~[na:1.8.0_121]
	at java.awt.Component.dispatchEvent(Component.java:4711) ~[na:1.8.0_121]
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) ~[na:1.8.0_121]
	at java.awt.EventQueue.access$500(EventQueue.java:97) ~[na:1.8.0_121]
	at java.awt.EventQueue$3.run(EventQueue.java:709) ~[na:1.8.0_121]
	at java.awt.EventQueue$3.run(EventQueue.java:703) ~[na:1.8.0_121]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_121]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) ~[na:1.8.0_121]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) ~[na:1.8.0_121]
	at java.awt.EventQueue$4.run(EventQueue.java:731) ~[na:1.8.0_121]
	at java.awt.EventQueue$4.run(EventQueue.java:729) ~[na:1.8.0_121]
	at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_121]
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) ~[na:1.8.0_121]
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) ~[na:1.8.0_121]
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) [na:1.8.0_121]
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [na:1.8.0_121]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [na:1.8.0_121]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [na:1.8.0_121]
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [na:1.8.0_121]
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) [na:1.8.0_121]

fanavarro avatar Feb 23 '21 11:02 fanavarro

@fanavarro are you able to provide your ontology and some steps to reproduce?

matthewhorridge avatar Feb 24 '21 19:02 matthewhorridge

Hi @matthewhorridge.

Sure, I am attaching a zip file with the ontology (github does not allow attaching owl files). FormViewOntology.zip

The ontology has two custom annotation properties: hasMaxValue and hasMinValue. You can try to annotate a class with one of these properties, and then, make another annotation on the same class with the other property. Here you have some screenshots: imagen imagen imagen imagen

I hope this helps.

Thanks beforehand!

fanavarro avatar Feb 24 '21 19:02 fanavarro

Hi everyone, I have new findings on this issue. This only happens when I manually select the type of the annotation (xsd:integer). If so, Protege fails when I try to include another annotation. However, if I leave the type of the annotation in blank, protege selects xsd:integer automatically (is this the expected behavior?) and then I can include other annotations without crashing.

fanavarro avatar Nov 24 '21 08:11 fanavarro