The following ClassCastException occurs frequently when running the algorithm from within Eclipse. Hereby the classes involved in the cast differ. When deactivating the Hierarchy Distance Base Matcher, the PropertyByDRClassMatcher can cause the same problem but less frequently. I assume a concurrency issue when accessing the OWL API from different threads.
Exception in thread "0" java.lang.ClassCastException: uk.ac.manchester.cs.owl.OWLDataAllRestrictionImpl cannot be cast to org.semanticweb.owl.model.OWLCardinalityRestriction
at uk.ac.manchester.cs.owl.OWLCardinalityRestrictionImpl.compareObjectOfSameType(OWLCardinalityRestrictionImpl.java:72)
at uk.ac.manchester.cs.owl.OWLObjectImpl.compareTo(OWLObjectImpl.java:152)
at uk.ac.manchester.cs.owl.OWLObjectImpl.compareTo(OWLObjectImpl.java:41)
at java.util.TreeMap.put(TreeMap.java:545)
at java.util.TreeSet.add(TreeSet.java:238)
at uk.ac.manchester.cs.owl.OWLClassImpl.getSuperClasses(OWLClassImpl.java:133)
at de.fzi.mappso.basematcher.HierarchyDistanceMatcher.getNamedSuperClasses(HierarchyDistanceMatcher.java:133)
at de.fzi.mappso.basematcher.HierarchyDistanceMatcher.computeDistance(HierarchyDistanceMatcher.java:76)
at de.fzi.mappso.basematcher.AbstractBaseMatcher.getDistance(AbstractBaseMatcher.java:62)
at de.fzi.mappso.align.impl.CorrespondenceEvaluator.computeBaseDistances(CorrespondenceEvaluator.java:230)
at de.fzi.mappso.align.impl.CorrespondenceEvaluator.getEvaluation(CorrespondenceEvaluator.java:172)
at de.fzi.mappso.align.impl.AlignmentParticle.computeFitness(AlignmentParticle.java:997)
at de.fzi.mappso.align.impl.AlignmentParticle.updateVelocity(AlignmentParticle.java:725)
at de.fzi.mappso.align.impl.AlignmentParticle.update(AlignmentParticle.java:454)
at de.fzi.mappso.align.impl.AlignmentParticle.run(AlignmentParticle.java:275)
at java.lang.Thread.run(Thread.java:619)
The same problem occurs when invoking MapPSO from the command line via
./dist $ java -jar MapPSO.jar test
Parameter file used
This problem occured because multiple particles were accessing the ontology (OWL API) models simultaneously. Having a HashMap of some OWL entities and checking if it contains a specific entity invokes OWL API comparison methods, which compare undefined objects if accessed from multiple threads simultaneously.
Fixed by introducing a semaphore to allow exclusive access to critical operations on the ontology model. Note that this significantly slows down base matcher evaluation of numerous correspondences if run on a single computer. An alternative fix would have been to copy the sets of OWL entities to local base matcher fields if comparison checks need to be done. Problem: memory usage and possibly expensive copy operations.
Reopened. If the problem is solved in the new OWL API version 3.1 the semaphore should be removed in order to gain runtime performance.
Check the need for semaphores after the OWL API upgrade. Remove semaphores where possible in order to gain performance.