Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration.tableauMonitorType is final?? #11

Open
dendrown opened this issue Feb 18, 2020 · 4 comments
Open

Configuration.tableauMonitorType is final?? #11

dendrown opened this issue Feb 18, 2020 · 4 comments

Comments

@dendrown
Copy link

dendrown commented Feb 18, 2020

Hello,

In version 1.3.8.413 of HermiT (pulled in via Tawny-OWL 2.0.0) I am unable to set Configuration.tableauMonitorType. Java reports that the class member is final; however on github Configuration.java does not show the field as final (not even in the file's history), and the HermiTConfigurations.java example is setting it to TableauMonitorType.TIMING, which is what I want to do.

I am ultimately trying to get this working in Clojure:

say.senti=>(def C (org.semanticweb.HermiT.Configuration.))
#'say.senti/C

say.senti=> (set! (.-tableauMonitorType C) org.semanticweb.HermiT.Configuration$TableauMonitorType/TIMING)
Execution error (IllegalAccessException) at sun.reflect.UnsafeFieldAccessorImpl/throwFinalFieldIllegalAccessException (UnsafeFieldAccessorImpl.java:76).
Can not set final org.semanticweb.HermiT.Configuration$TableauMonitorType field org.semanticweb.HermiT.Configuration.tableauMonitorType to org.semanticweb.HermiT.Configuration$TableauMonitorType

However, for sanity's sake, I created some test code in Java:

package net.dendrown.uqam.hermit;

import org.semanticweb.HermiT.Configuration;
import org.semanticweb.HermiT.Configuration.TableauMonitorType;


public class ConfigTools
{
    static public Configuration reconfig()
    {
        Configuration cfg = new Configuration();

        // FIXME: the tableauMonitorType field seems to be final w/ a value of NONE
        //        even though the source on github doesn't reflect this.
        cfg.tableauMonitorType=TableauMonitorType.TIMING;

        return cfg;
    }
}

Alas, it won't compile for the same reason.

$ lein javac
Compiling 1 source files to /home/dend/prog/say_sila/apps/say_sila/priv/fnode/say/target/classes
/home/dend/prog/say_sila/apps/say_sila/priv/fnode/say/java/src/net/dendrown/uqam/hermit/ConfigTools.java:16: error: cannot assign a value to final variable tableauMonitorType
        cfg.tableauMonitorType=TableauMonitorType.TIMING;
           ^
1 error
Compilation of Java sources(lein javac) failed.

I have tried setting a number of other fields in the Configuration object from Clojure, and it all works fine. This problem has baffled me because the HermiT source code does not show tableauMonitorType as final. I see now in issue #6 that this is not the official repository, so perhaps version 1.3.8.413 was created from a slightly different source tree. Can you suggest a work-around?

Thank you,
den Drown

@dendrown dendrown changed the title Configuration.TableauMonitorType is final?? Configuration.tableauMonitorType is final?? Feb 18, 2020
@ignazio1977
Copy link

ignazio1977 commented Feb 18, 2020

Hi, version 1.3.8.413 (and all versions released under the net.sourceforge.api group) are built from a fork of this repository, see https://github.com/owlcs/hermit-reasoner/

In that repo the field is final - not sure off the top of my head why.

@dendrown
Copy link
Author

Thank you, @ignazio1977. Yes, I see it, and at least now I know I'm not going crazy.

@ignazio1977
Copy link

Version 1.4.5.456 is OWLAPI 4 compatible and includes a fix for this. You should be able to add it as dependency and it should override 1.3.8.413. If not, you might need to exclude it explicitly. Haven't tried it with Tawny OWL, but in theory it should be a drop in replacement.

@dendrown
Copy link
Author

Hi @ignazio1977: Yes, thank you! That worked perfectly. :)

In case anyone else has a similar issue, here is what needs to go into project.clj:

(defproject ...
  ...
  :dependencies [...
                 ...
                 [net.sourceforge.owlapi/org.semanticweb.hermit "1.4.5.456"]    ; Override Tawny's dep
                 [uk.org.russet/tawny-owl "2.0.0"]
                 ...])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants