protege
protege copied to clipboard
Equivalent sign between classes and object properties not displayed in Protege 5.5 (regression)
Hi !
With the following ontology, the equivalent ≡
sign is not displayed in the pan Entities -> Classes
and Entities -> Object properties
in Protege 5.5, but it is displayed in Protege 5.2.
It's regression.
Thanks in advance !
<?xml version="1.0"?>
<rdf:RDF xmlns="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#" xml:base="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109"/>
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#objectPropertyOne">
<owl:equivalentProperty rdf:resource="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#objectPropertyTwo"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#objectPropertyTwo"/>
<owl:Class rdf:about="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#classOne">
<owl:equivalentClass rdf:resource="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#classTwo"/>
</owl:Class>
<owl:Class rdf:about="http://www.semanticweb.org/julioprayer/ontologies/2019/6/untitled-ontology-109#classTwo"/>
</rdf:RDF>
I don't know if it could help, but equivalent sign in class hierarchy
disappear at the following commit. Note that in this commit the equivalent sign in Object property hierarchy
is displayed.
$ git bisect bad 3566e66d4052524c8e5fd53ec0ec691ba6574a05 is the first bad commit commit 3566e66d4052524c8e5fd53ec0ec691ba6574a05 Author: Matthew Horridge [email protected] Date: Thu Aug 31 18:18:13 2017 -0700
For Object property hierarchy
the equivalent sign disappear at:
4f522b6c385f69bc967783ea93e30ccd0bc6e62d is the first bad commit commit 4f522b6c385f69bc967783ea93e30ccd0bc6e62d Author: Matthew Horridge [email protected] Date: Tue Feb 5 15:41:36 2019 -0800
Addresses #847
Note also that owl:sameAs
does not display equivalent sign, even in Protégé 5.2.
@JulioJu I'm able to reproduce. This was last working for me in 5.5.0 beta 7. I'm using ELK 0.4.3.
5.5.0 (upgraded today)
5.5.0 beta 7
@matthewhorridge are you sure this piece of the code in ProtegeTreeNodeRenderer
does not need a type cast:
String equivsRendering = node.getEquivalentObjects().stream()
.map(this::getOwlObjectDisabmiguatedRendering)
.map(this::prefixWithEquivalentSymbol)
.collect(joining());
rendering += equivsRendering;
node.getEquivalentObjects().stream()
returns a Stream<Object>
, but this::getOwlObjectDisabmiguatedRendering
expects an OWLObject
.
When I run Protege from Eclipse, I get:
java.lang.BootstrapMethodError: bootstrap method initialization exception
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194) ~[na:na]
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:307) ~[na:na]
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:258) ~[na:na]
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:248) ~[na:na]
at org.protege.editor.owl.ui.renderer.ProtegeTreeNodeRenderer.getTreeCellRendererComponent(ProtegeTreeNodeRenderer.java:103) ~[na:na]
at java.desktop/javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:3155) ~[na:na]
at java.desktop/javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:493) ~[na:na]
at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1344) ~[na:na]
...
Caused by: java.lang.invoke.LambdaConversionException: Type mismatch for lambda argument 1: class java.lang.Object is not convertible to interface org.semanticweb.owlapi.model.OWLObject
at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:279) ~[na:na]
at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:328) ~[na:na]
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:127) ~[na:na]
... 80 common frames omitted
Interestingly, this does not happen when running Protege using run.sh (on MacOS, java 11.0.4). Frankly, I am not very well familiar with how casting works with streams.
I simple workaround would be to insert
.map(obj -> (OWLObject) obj)
or even safer:
.filter(obj -> obj instanceof OWLObject)
.map(obj -> (OWLObject) obj)
Odd... I don't have any issues with this...
I've added a cast further up on the tree node.... hmmm although this is only generics stuff so I'm not sure the runtime problem will be fixed. @ykazakov please can you let me know if you have problems with this?
@matthewhorridge your fix is working! But I do not really understand why. ;-) Another workaround I successfully tested is as follows:
Set<? extends OWLObject> equivalent = node.getEquivalentObjects();
String equivsRendering = equivalent.stream()
.map(this::getOwlObjectDisabmiguatedRendering)
.map(this::prefixWithEquivalentSymbol)
.collect(joining());
There appears to be lot's of similar issues / bugs with generics and lambdas:
https://stackoverflow.com/questions/27031244/lambdaconversionexception-with-generics-jvm-bug
@matthewhorridge Regression in 5.6.1 - also missing the Equivalent class in Equivalent To panel. @ykazakov Tested with ELK 0.4.3 and 0.5.0
5.5.0-beta7:
5.6.1:
@rwynne Did you manage to find a small example to reproduce the problem? This would be appreciated! Did you try other reasoners (on this example)? If for other reasoners there will be the equivalent sign, this is unlikely a Protege problem, but just due to incompleteness of ELK on datatypes liveontologies/elk-reasoner#61.
@ykazakov The small example is attached to the first comment in the ELK issue. I'm posting it to this issue if it's of any help.
With Protege 5.6.1, I find ELK 0.4.3 and HermiT both display the equivalent class in the Description panel, however there is no equivalent sign in the hierarchy. ELK 0.5.0 displays no equivalent class in the Description panel and also no equivalent sign in the hierarchy.
I only find everything to be satisfactory in Protege 5.5.0-beta7 with ELK 0.4.3.
Example small ontology (rename extension to .owl): with-datahasvalue.txt
IRIs of interest: http://snomed.info/id/Copy-392656009 http://snomed.info/id/392656009
By the way, this is a small ontology with the classes necessary for the equivalent classes. Please DSTM. ;-)
With the example small ontology and the latest 5.6.3 release of Protege MacOS, the equivalency sign is missing in the Class hierarchy. The equivalency is shown in the Description panel for both classes. I tried both ELK 4.3 and 5.0.
I can confirm that the equivalence symbol is no longer shown in the inferred hierarchy, already in a very simple example with two classes A and B, stated to be equivalent to each other:
Strangely, in the asserted hierarchy I also do not see class names but only ellipsis ...
As soon as I delete one of the class, the name is shown correctly.
Another bug I noticed: when changing the label of one of the equivalent classes to something longer, the rendering for the other equivalent class is truncated with ellipsis ...