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

OWLReasoner.getReasonerVersion() causes NumberFormatException #49

Closed
matentzn opened this issue Feb 8, 2018 · 7 comments
Closed

OWLReasoner.getReasonerVersion() causes NumberFormatException #49

matentzn opened this issue Feb 8, 2018 · 7 comments

Comments

@matentzn
Copy link

matentzn commented Feb 8, 2018

Using ELK 0.4.3

OWLReasoner r = ...;
System.out.println(r.getReasonerVersion());

Exception in thread "main" java.lang.NumberFormatException: For input string: "2016-01-11T13:41:15Z"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at org.semanticweb.elk.owlapi.ElkReasoner.getReasonerVersion(ElkReasoner.java:638)

@matentzn
Copy link
Author

matentzn commented Feb 8, 2018

(This is particularly relevant for when using ELK in conjunction with InferredOntologyGenerator methods, which rely, needlessly as I must admit, on the implementation of the Reasoner version method)

InferredOntologyGenerator iog = new InferredOntologyGenerator(r, generators); iog.fillOntology(df, odef_all_inferred);

@ykazakov
Copy link
Member

ykazakov commented Feb 9, 2018

Reproduced with:

	<dependencies>
		<dependency>
			<groupId>org.semanticweb.elk</groupId>
			<artifactId>elk-owlapi</artifactId>
			<version>0.4.3</version>
		</dependency>
		<dependency>
			<groupId>net.sourceforge.owlapi</groupId>
			<artifactId>owlapi-apibinding</artifactId>
			<version>4.5.1</version>
		</dependency>
	</dependencies>

Code:

		OWLOntology o = OWLManager.createOWLOntologyManager().createOntology();

		OWLReasoner r = (new ElkReasonerFactory()).createReasoner(o);

		System.out.println(r.getReasonerVersion());

@matentzn
Copy link
Author

Reproduced with

 <dependency>
  <groupId>net.sourceforge.owlapi</groupId>
  <artifactId>owlapi-distribution</artifactId>
  <version>5.1.4</version>
</dependency>
<dependency> 
   <groupId>org.semanticweb.elk</groupId> 
   <artifactId>elk-owlapi5</artifactId> 
   <version>0.5.0-SNAPSHOT</version> 
</dependency> 

and

<dependency>
  <groupId>net.sourceforge.owlapi</groupId>
  <artifactId>owlapi-distribution</artifactId>
  <version>4.5.1</version>
</dependency>
<dependency> 
   <groupId>org.semanticweb.elk</groupId> 
   <artifactId>elk-owlapi4</artifactId> 
   <version>0.5.0-SNAPSHOT</version> 
</dependency> 

Same code as above.

@ykazakov
Copy link
Member

@matentzn Which version of java do you use? I can reproduce the problem with Java 9, but not with Java 8 (for which the version appears to be 0.0.0.0)

@ykazakov
Copy link
Member

Actually, even with Java 9 I can only reproduce this from Eclipse (after clean), but not from the command line. Weird...

@matentzn
Copy link
Author

That is very strange. I only tested it in Eclipse as well (after maven update and maven clean). Java 1.8.0_161.

@ykazakov
Copy link
Member

I figured out: I placed the test file into the same package org.semanticweb.elk.owlapi for which the version number is returned (via ElkReasoner.class.getPackage().getImplementationVersion())
This way java got confused as there are two packages with the same name, and returned the result non-deterministically.

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