changeset 18:d3616fac4ca5 draft

Elk support added
author Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
date Thu, 20 Sep 2012 12:46:36 +0200
parents c9e01f86b07c
children cc270db37d33
files OPPL/README OPPL/inference.jar OPPL/inference.xml OPPL/inference_lib/elk-owlapi.jar OPPL/inference_lib/log4j-sources.jar OPPL/inference_lib/log4j.jar OPPL/merge.jar OPPL/merge.xml OPPL/merge_lib/elk-owlapi.jar OPPL/merge_lib/log4j-sources.jar OPPL/merge_lib/log4j.jar OPPL/oppl.xml OPPL/oppl_galaxy.jar OPPL/oppl_galaxy_lib/elk-owlapi.jar OPPL/oppl_galaxy_lib/log4j-sources.jar OPPL/oppl_galaxy_lib/log4j.jar OPPL/oppl_query.jar OPPL/oppl_query.xml OPPL/oppl_query_lib/elk-owlapi.jar OPPL/oppl_query_lib/log4j-sources.jar OPPL/oppl_query_lib/log4j.jar OPPL/query.jar OPPL/query.xml OPPL/query_lib/elk-owlapi.jar OPPL/query_lib/log4j-sources.jar OPPL/query_lib/log4j.jar OPPL/src/GalaxyOWLAPI.java OPPL/src/InferenceGalaxy.java OPPL/src/OPPLGalaxy.java OPPL/src/OPPLQueryGalaxy.java OPPL/src/OWLQueryGalaxy.java OPPL/test-data/ontology/single/elk.owl
diffstat 32 files changed, 217 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/OPPL/README	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/README	Thu Sep 20 12:46:36 2012 +0200
@@ -45,11 +45,11 @@
 =================
 
 - Support for processing ontologies that import other ontologies loaded
-in galaxy (i.e. to resolve imports within galaxy).
+in Galaxy (i.e. to resolve imports within galaxy).
 
 - Entities rendering definition (URI fragment, rdfs:label, QName, etc).
 
-- OWLLink, Racer and ELK support.
+- OWLLink and Racer support.
 
 - Standalone OPPL assertions parsing (e.g. ADD phagocyte subClassOf
 cell).
@@ -107,6 +107,6 @@
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-OPPL API, OWL API, Pellet, HermiT, and FaCT++ have their own licenses.
+OPPL API, OWL API, Pellet, HermiT, Elk and FaCT++ have their own licenses.
 
 
Binary file OPPL/inference.jar has changed
--- a/OPPL/inference.xml	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/inference.xml	Thu Sep 20 12:46:36 2012 +0200
@@ -13,6 +13,7 @@
 			<option value="Pellet" selected="true">Pellet</option>
 			<option value="HermiT">HermiT</option>
 			<option value="FaCTPlusPlus">FaCT++</option>
+			<option value="Elk">Elk (Not all axioms supported)</option>
 		</param>
 		<param name="axioms" type="select" display="checkboxes" multiple="true" label="Select what axioms to add as asserted">
 		  <option value="CLASS_ASSERTIONS">CLASS_ASSERTIONS</option>
@@ -37,40 +38,16 @@
 
 **About Inference-Galaxy**
 
-  Inference galaxy offers the possibility of performing automated reasoning in an ontology and then injecting the inferred axioms as asserted axioms, generating a new OWL ontology.
-
-**Formats**
-
-  Inference-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. The output is OWL (RDF/XML).
+  Inference-Galaxy offers the possibility of performing automated reasoning in an ontology and then injecting the inferred axioms as asserted axioms, generating a new OWL ontology.
 
 **Usage**
  
-  An ontology is needed as input: load it with Get Data >> Upload File from your computer or redirect the output of another galaxy tool. In case the ontology includes imports, they should be resolvable.
-  
-  The reasoner can be Pellet, HermiT or FaCT++.  
-  
-  The inferred axioms to add as asserted axioms can be chosen. 
-
-**More information**
-  
-  Galaxy public instances with Inference-Galaxy pre-installed:
-  
-  http://sele.inf.um.es:8080/
+  An ontology is needed as input: load it with Get Data >> Upload File from your computer or redirect the output of another galaxy tool. Inference-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. In case the loaded ontology includes OWL imports, Inference-Galaxy will try to resolve them.
   
-  http://linkeddata2.dia.fi.upm.es:8080
-  
-  Links of interest:
-
-  http://owlapi.sourceforge.net/
-
-  http://www.w3.org/TR/owl2-manchester-syntax/
-
-  http://clarkparsia.com/pellet
-
-  http://hermit-reasoner.com/
-  
-  http://code.google.com/p/factplusplus/
-
+  The reasoner can be Pellet, HermiT, FaCT++ or Elk.  
+   
+  The inferred axioms to add as asserted axioms can be chosen.
+   
 **Contact**
 
   Please send any request or comment to mikel.egana.aranguren@gmail.com.
Binary file OPPL/inference_lib/elk-owlapi.jar has changed
Binary file OPPL/inference_lib/log4j-sources.jar has changed
Binary file OPPL/inference_lib/log4j.jar has changed
Binary file OPPL/merge.jar has changed
--- a/OPPL/merge.xml	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/merge.xml	Thu Sep 20 12:46:36 2012 +0200
@@ -27,11 +27,13 @@
 
 **About Merge-Galaxy**
 
-  Merge-Galaxy can be used to merge any imported ontologies into the main ontology, creating a new ontology.
+  Merge-Galaxy can be used to merge any (resolvable) imported ontologies into the main ontology, creating a new ontology.
 
-**Formats**
-
-  Merge-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load, provided that imports are correctly represented: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. The output is an OWL ontology in RDF/XML format.
+**Usage**
+ 
+  An ontology is needed as input: load it with Get Data >> Upload File from your computer or redirect the output of another galaxy tool. Merge-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. 
+  
+  An URI can be specified for the new merged ontology. In case non is specified, the following URI will be used: http://cbgp.upm.es/BiologicalInformatics/OPPLGalaxy/merged.owl.
 
 **Contact**
 
Binary file OPPL/merge_lib/elk-owlapi.jar has changed
Binary file OPPL/merge_lib/log4j-sources.jar has changed
Binary file OPPL/merge_lib/log4j.jar has changed
--- a/OPPL/oppl.xml	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/oppl.xml	Thu Sep 20 12:46:36 2012 +0200
@@ -11,20 +11,18 @@
 	
 	<!-- For big ontologies I use -Xmx3000M -Xms250M -DentityExpansionLimit=1000000000 If that's too much for your machine simply delete or modify at will, but since Galaxy is usually used in a server setting it makes sense to use a big chunk of memory -->
 
-	<command>
-		java -Xmx3000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy.jar $input $reasoner $OPPL $format > $output 2>/dev/null
-	</command>
-	
-	
+	<!--<command>
+	  java -Xmx3000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy.jar $input $reasoner $OPPL $format > $output 2>/dev/null 
+	</command>-->
 	
 	<!-- FACT++ -->
 	
 	<!-- If you are planning to use FaCT++ you have to uncomment bellow (And comment the default settings above) and replace the -Djava.library.path with the appropiate JNI library path for your platform:FaCT++-linux-v1.5.2/64bit, FaCT++-linux-v1.5.2/32bit, FaCT++-OSX-v1.5.2/64bit, ...... -->
 	<!-- Using this setting doesn't upset the rest of the reasoners so you may as well leave it on if you plan to switch between FaCT++, Pellet and HermiT -->
 	
-	<!--<command>
+	<command>
 		java -Djava.library.path=${__tool_data_path__}/shared/jars/FaCT++-linux-v1.5.2/64bit -Xmx3000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy.jar $input $reasoner $OPPL $format > $output 2>/dev/null
-	</commadn>-->
+	</command>
 
 	
 	
@@ -42,12 +40,13 @@
 
 	<inputs>
 		<param name="input" type="data" label="Input ontology file"/>
+		<param format="text" name="OPPL" type="data" label="OPPL file"/>
 		<param name="reasoner" type="select" label="Choose reasoner">
 			<option value="Pellet" selected="true">Pellet</option>
 			<option value="HermiT">HermiT</option>
 			<option value="FaCTPlusPlus">FaCT++</option>
+			<option value="Elk">Elk (Not all axioms supported)</option>
 		</param>
-		<param format="text" name="OPPL" type="data" label="OPPL file"/>
 		<param name="format" type="select" label="Choose ontology output format">
 			<option value="OWL" selected="true">OWL</option>
 			<option value="OBO">OBO</option>
@@ -69,29 +68,21 @@
 
 **About OPPL-Galaxy**
 
-  OPPL-Galaxy can be used to execute an OPPL script against an ontology, generating a new ontology. OPPL (Ontology Pre Processor Language) is a high level scripting language, based in the Manchester OWL Syntax, to automate the manipulation of an ontology. An OPPL script (See test.oppl) defines a query to be performed against the ontology, and some actions (Adding or removing axioms) that affect the entities that will be retrieved. Those entities can be named or defined by a variable. OPPL is a powerful method for defining and executing modelling patterns that are repeated in an ontology, saving time and efforts.  
-
-**Formats**
-
-  OPPL-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. The available output formats are OBO flat file and OWL (RDF/XML).
+  OPPL-Galaxy can be used to execute an OPPL script against an ontology, generating a new ontology. OPPL (Ontology Pre Processor Language) is a high level scripting language, based in the Manchester OWL Syntax, to automate the manipulation of an ontology. An OPPL script (See test.oppl) defines a query to be performed against the ontology, and some actions (Adding or removing axioms) that affect the entities that will be retrieved. Those entities can be named or defined by a variable. OPPL is a powerful method for defining and executing modelling patterns that are repeated in an ontology, saving time and energy.  
 
 **Usage**
 
-  An ontology and an OPPL file are needed (test.owl and test.oppl can be used as samples, both available in the bundle). Load both with Get Data >> Upload File from your computer, or redirect from another Galaxy tool.
-
-  Then execute the OPPL file against the OWL file with Ontology Pre Processor Language >> Execute an OPPL file against an OWL file. A new output ontology will be generated.
+  An ontology and an OPPL file are needed (test.owl and test.oppl can be used as samples, both available in the bundle). Load both with Get Data >> Upload File from your computer, or redirect from another Galaxy tool. OPPL-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. In case the loaded ontology includes OWL imports, OPPL-Galaxy will try to resolve them.
+  
+  The reasoner can be Pellet, HermiT, FaCT++ or Elk.
 
-  In case the loaded ontology includes OWL imports, OPPL-Galaxy will try to resolve them. 
-
-  The output ontology can be OBO or OWL (RDF/XML).
-   
-  The reasoner can be Pellet, HermiT FaCT++. Sometimes, if an execution fails it can be fixed by using a different reasoner. 
+  The output ontology can be OBO or OWL (RDF/XML). 
 
 **More information**
 
   Galaxy public instances with OPPL-Galaxy pre-installed:
   
-  http://sele.inf.um.es:8080/
+  http://sele.inf.um.es:9080/
   
   http://linkeddata2.dia.fi.upm.es:8080
   
@@ -107,8 +98,6 @@
 
   http://oppl.sf.net/
 
-  http://owlapi.sourceforge.net/
-
   http://www.w3.org/TR/owl2-manchester-syntax/
 
   http://clarkparsia.com/pellet
@@ -117,9 +106,13 @@
   
   http://code.google.com/p/factplusplus/
   
+  http://code.google.com/p/elk-reasoner/
+  
+  http://owlapi.sourceforge.net/
+  
 **Citation**
 
-  Mikel Egaña Aranguren, Jesualdo Tomás Fernández-Breis and Erick Antezana. OPPL-Galaxy: Enhancing ontology exploitation in Galaxy with OPPL. SWAT4LS 2011.
+  Mikel Egaña Aranguren, Jesualdo Tomás Fernández-Breis, Erick Antezana. OPPL-Galaxy: Enhancing ontology exploitation in Galaxy with OPPL. In Proceedings of the 4th International Workshop on Semantic Web Applications and Tools for the Life Sciences, SWAT4LS 2011, pages 12–19, ACM 2012.
 
 **Contact**
 
Binary file OPPL/oppl_galaxy.jar has changed
Binary file OPPL/oppl_galaxy_lib/elk-owlapi.jar has changed
Binary file OPPL/oppl_galaxy_lib/log4j-sources.jar has changed
Binary file OPPL/oppl_galaxy_lib/log4j.jar has changed
Binary file OPPL/oppl_query.jar has changed
--- a/OPPL/oppl_query.xml	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/oppl_query.xml	Thu Sep 20 12:46:36 2012 +0200
@@ -20,7 +20,7 @@
 	
 	<!--<command>
 		java -Djava.library.path=${__tool_data_path__}/shared/jars/FaCT++-linux-v1.5.2/64bit -Xmx3000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_query.jar $ontology $reasoner $answer_format "$query" > $output 2>/dev/null
-	</commadn>-->
+	</command>-->
 	
 
 	<inputs>
@@ -30,6 +30,7 @@
 			<option value="Pellet" selected="true">Pellet</option>
 			<option value="HermiT">HermiT</option>
 			<option value="FaCTPlusPlus">FaCT++</option>
+			<option value="Elk">Elk (Not all axioms supported)</option>
 		</param>
 		<param name="answer_format" type="select" label="Choose how to render the retrieved entities">
 			<option value="URI" selected="true">URI</option>
@@ -53,11 +54,17 @@
 
 **About OPPL-Query-Galaxy**
 
-  OPPL-Query-Galaxy can be used to execute an OPPL query against an OWL ontology (?whole:CLASS, ?part:CLASS SELECT ?part SubClassOf part_of some ?whole WHERE ?part != Nothing). The result is a two column table with the entities that have been bound by the variables. 
+  OPPL-Query-Galaxy can be used to execute an OPPL query against an OWL ontology. The result is a two column table with the entities that have been bound by the variables. 
+  
+**Usage**
+ 
+  An ontology is needed as input: load it with Get Data >> Upload File from your computer or redirect the output of another galaxy tool. OPPL-Query-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. In case the loaded ontology includes OWL imports, OPPL-Query-Galaxy will try to resolve them.
   
-**Formats**
-
-  OPPL-Query-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. The output is a list of terms.
+  An OPPL query must be provided, e.g. ?whole:CLASS, ?part:CLASS SELECT ?part SubClassOf part_of some ?whole WHERE ?part != Nothing.
+  
+  The reasoner can be Pellet, HermiT, FaCT++ or Elk.  
+   
+  The returned entities can be rendered using their URI, their URI fragment, or OBO type URI fragment (e.g. GO_0000022 to GO:0000022).
 
 **Contact**
 
Binary file OPPL/oppl_query_lib/elk-owlapi.jar has changed
Binary file OPPL/oppl_query_lib/log4j-sources.jar has changed
Binary file OPPL/oppl_query_lib/log4j.jar has changed
Binary file OPPL/query.jar has changed
--- a/OPPL/query.xml	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/query.xml	Thu Sep 20 12:46:36 2012 +0200
@@ -16,7 +16,7 @@
 	
 	<!--<command>
 		java -Djava.library.path=${__tool_data_path__}/shared/jars/FaCT++-linux-v1.5.2/64bit -Xmx3000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/query.jar $ontology $reasoner $answer_type $answer_format "$query" > $output 
-	</commadn>-->
+	</command>-->
 	
 
 	<inputs>
@@ -26,6 +26,7 @@
 			<option value="Pellet" selected="true">Pellet</option>
 			<option value="HermiT">HermiT</option>
 			<option value="FaCTPlusPlus">FaCT++</option>
+			<option value="Elk">Elk (Not all axioms supported)</option>
 		</param>
 		<param name="answer_type" type="select" label="Choose answer type">
 			<option value="Descendants">Descendant classes</option>
@@ -58,11 +59,19 @@
 
 **About Query-Galaxy**
 
-  Query-Galaxy can be used to execute a DL query against an OWL ontology (e.g. GO_0007049 or part_of some GO_0007049). The result is a list of entities from the target ontology. How those entities relate to the query can be chosen (A DL query is just an anonymous OWL Class).
+  Query-Galaxy can be used to execute a DL query against an OWL ontology. The result is a list of entities from the target ontology. 
 
-**Formats**
-
-  Query-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. The output is a list of terms.
+**Usage**
+ 
+  An ontology is needed as input: load it with Get Data >> Upload File from your computer or redirect the output of another galaxy tool. Query-Galaxy uses the OWL API, and therefore it can load any ontology format that such API is able to load: OBO flat file, OWL (RDF/XML, OWL/XML, Functional, Manchester), turtle, and KRSS. In case the loaded ontology includes OWL imports, Query-Galaxy will try to resolve them.
+  
+  A DL query must be provided, e.g. GO_0007049 or part_of some GO_0007049.
+  
+  The reasoner can be Pellet, HermiT, FaCT++ or Elk.  
+  
+  How the retrieved entities relate to the query can be chosen: a DL query is just an anonymous OWL Class, and the retrieved entities can be descendant classes, direct sub-classes, ancestor classes, direct super-classes, equivalent classes, or member individuals.
+   
+  The returned entities can be rendered using their URI, their URI fragment, or OBO type URI fragment (e.g. GO_0000022 to GO:0000022).
 
 **Contact**
 
Binary file OPPL/query_lib/elk-owlapi.jar has changed
Binary file OPPL/query_lib/log4j-sources.jar has changed
Binary file OPPL/query_lib/log4j.jar has changed
--- a/OPPL/src/GalaxyOWLAPI.java	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/src/GalaxyOWLAPI.java	Thu Sep 20 12:46:36 2012 +0200
@@ -12,10 +12,13 @@
 import java.util.Scanner;
 import java.util.Set;
 
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 import org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser;
 import org.coode.owlapi.obo.parser.OBOOntologyFormat;
 import org.coode.parsers.BidirectionalShortFormProviderAdapter;
 import org.semanticweb.HermiT.Reasoner;
+import org.semanticweb.elk.owlapi.ElkReasonerFactory;
 import org.semanticweb.owlapi.apibinding.OWLManager;
 import org.semanticweb.owlapi.expression.OWLEntityChecker;
 import org.semanticweb.owlapi.expression.ParserException;
@@ -110,6 +113,14 @@
 		reasonerFactory = new Reasoner.ReasonerFactory();
 		reasoner = reasonerFactory.createReasoner(ontology);
 	}
+	public void setReasonerElk (){
+	    reasonerFactory = new ElkReasonerFactory();	    
+		Logger.getLogger("org.semanticweb.elk").setLevel(Level.OFF);
+	    reasoner = reasonerFactory.createReasoner(ontology);
+	}
+	public void disposeReasoner(){
+		reasoner.dispose();
+	}
 	public void merge (String ontologyIRI) throws OWLOntologyCreationException, OWLOntologyStorageException{
 		OWLOntologyMerger merger = new OWLOntologyMerger(manager);
 //		OWLOntologyMerger merger = new OWLOntologyMerger(new OWLOntologyImportsClosureSetProvider(manager, ontology));
--- a/OPPL/src/InferenceGalaxy.java	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/src/InferenceGalaxy.java	Thu Sep 20 12:46:36 2012 +0200
@@ -11,7 +11,7 @@
 
 
 /**
- * @author Mikel Egaña Aranguren
+ * @author Mikel Ega��a Aranguren
  *
  */
 public class InferenceGalaxy {
@@ -25,7 +25,7 @@
 	public static void main(String[] args) throws OWLOntologyStorageException, OWLOntologyCreationException, IOException {
 		// Get the arguments from command-line
 		String OWLFilePath = args [0];
-		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT
+		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT|Elk
 		String axioms_to_inject = args [2]; // CLASS_ASSERTIONS,CLASS_HIERARCHY,DATA_PROPERTY_ASSERTIONS 
 				
 //		CLASS_ASSERTIONS Denotes the computation of the direct types of individuals for each individual in the signature of the imports closure of the root ontology.
@@ -54,6 +54,10 @@
 		else if (reasoner_type.equals("FaCTPlusPlus")){
 			galaxyowlapi.setReasonerFaCT();
 		}
+		// Elk
+		else if (reasoner_type.equals("Elk")){
+			galaxyowlapi.setReasonerElk();
+		}
 		// HermiT
 		else{
 			galaxyowlapi.setReasonerHermit();
@@ -70,6 +74,8 @@
 			injectAxiom (axioms_to_inject, galaxyowlapi);
 		}
 		
+		galaxyowlapi.disposeReasoner();
+		
 		// Merge imported ontologies if requested
 //		if(merge.equals("Merge")){
 //			galaxyowlapi.merge();
--- a/OPPL/src/OPPLGalaxy.java	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/src/OPPLGalaxy.java	Thu Sep 20 12:46:36 2012 +0200
@@ -7,13 +7,16 @@
 import java.io.IOException;
 import java.util.List;
 import java.util.Scanner;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
+//import org.apache.log4j.Level;
 import org.coode.oppl.ChangeExtractor;
 import org.coode.oppl.OPPLParser;
 import org.coode.oppl.OPPLScript;
 import org.coode.oppl.ParserFactory;
 import org.coode.oppl.exceptions.QuickFailRuntimeExceptionHandler;
+import org.coode.oppl.log.Logging;
 import org.coode.parsers.ErrorListener;
 import org.coode.parsers.LoggerErrorListener;
 import org.semanticweb.owlapi.model.OWLAxiomChange;
@@ -25,8 +28,9 @@
 
 
 
+
 /**
- * @author Mikel Egaña Aranguren
+ * @author Mikel Ega��a Aranguren
  *
  */
 public class OPPLGalaxy {
@@ -40,7 +44,7 @@
 	public static void main(String[] args) throws OWLOntologyCreationException, OWLOntologyStorageException, IOException {
 		// Get the arguments from command-line
 		String OWLFilePath = args [0];
-		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT
+		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|Elk|HermiT
 		
 		String OPPL_script_file = args [2];
 		String OWL = args [3]; // OWL|OBO
@@ -61,6 +65,10 @@
 		else if (reasoner_type.equals("FaCTPlusPlus")){
 			galaxyowlapi.setReasonerFaCT();
 		}
+		// Elk
+		else if (reasoner_type.equals("Elk")){
+			galaxyowlapi.setReasonerElk();
+		}
 		// HermiT
 		else{
 			galaxyowlapi.setReasonerHermit();
@@ -83,18 +91,20 @@
 		// Parse the OPPL script
 		ParserFactory parserFactory = new ParserFactory(manager, ontology, reasoner); 
 		Logger logger = Logger.getLogger(OPPLGalaxy.class.getName());
+//		logger.setLevel(Level.OFF);
 //		Logging.getQueryLogger().setLevel(Level.OFF); // The normal messages are errors for galaxy (Fixed in Galaxy by 2 > /dev/null)
+		
 		ErrorListener errorListener = (ErrorListener)new LoggerErrorListener(logger);
 		OPPLParser opplparser = parserFactory.build(errorListener);
 		OPPLScript OPPLscript = opplparser.parse(OPPL_script_source);
-		
-		
 			
 		// Execute the script
 		ChangeExtractor extractor = new ChangeExtractor(new QuickFailRuntimeExceptionHandler(), true);
 		List<OWLAxiomChange> changes = extractor.visit(OPPLscript);
 		manager.applyChanges(changes);
 		
+		galaxyowlapi.disposeReasoner();
+		
 		// Merge imported ontologies if requested
 //		if(merge.equals("Merge")){
 //			galaxyowlapi.merge();
--- a/OPPL/src/OPPLQueryGalaxy.java	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/src/OPPLQueryGalaxy.java	Thu Sep 20 12:46:36 2012 +0200
@@ -42,7 +42,7 @@
 	public static void main(String[] args) throws OWLOntologyCreationException, ParserException, FileNotFoundException {
 		// Get the arguments from command-line
 		String OWLFilePath = args [0]; // /home/mikel/UPM/OPPL_galaxy/OPPL/OPPL/test-data/ontology/single/test.owl
-		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT
+		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT|Elk
 		String Answer_render = args [2]; // URI|URIfragment|URIfragment2OBO
 		String OPPL_script_source = args [3];
 		
@@ -75,6 +75,10 @@
 		else if (reasoner_type.equals("FaCTPlusPlus")){
 			galaxyowlapi.setReasonerFaCT();
 		}
+		// Elk
+		else if (reasoner_type.equals("Elk")){
+			galaxyowlapi.setReasonerElk();
+		}
 		// HermiT
 		else{
 			galaxyowlapi.setReasonerHermit();
@@ -93,6 +97,8 @@
 		extractor.visit(OPPLscript);
 		ConstraintSystem cs = OPPLscript.getConstraintSystem();
 		Set<BindingNode> nodes =  cs.getLeaves();
+		
+		galaxyowlapi.disposeReasoner();
 				
 		Iterator NodesIterator = nodes.iterator();
 		while(NodesIterator.hasNext()){
--- a/OPPL/src/OWLQueryGalaxy.java	Mon Aug 20 11:39:56 2012 +0200
+++ b/OPPL/src/OWLQueryGalaxy.java	Thu Sep 20 12:46:36 2012 +0200
@@ -19,7 +19,7 @@
 	public static void main(String[] args) throws OWLOntologyCreationException, ParserException {
 		// Get the arguments from command-line
 		String OWLFilePath = args [0]; // /home/pik/UPM/Paper/SWAT4LS_2011/JBS/Workflows_JBS/GO_module_transitive/go_no_trans.owl
-		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT
+		String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT|Elk
 		
 		String Answer_type = args [2]; // Individuals|EquivalentClasses|DirectSuperClasses|Ancestors|DirectSubClasses|Descendants
 		String Answer_render = args [3]; // URI|URIfragment|URIfragment2OBO
@@ -41,6 +41,10 @@
 		else if (reasoner_type.equals("FaCTPlusPlus")){
 			galaxyowlapi.setReasonerFaCT();
 		}
+		// Elk
+		else if (reasoner_type.equals("Elk")){
+			galaxyowlapi.setReasonerElk();
+		}
 		// HermiT
 		else{
 			galaxyowlapi.setReasonerHermit();
@@ -52,30 +56,35 @@
 		// Execute query and print results
 		if(Answer_type.equals("Individuals")){
 			Set<OWLNamedIndividual> inds = galaxyowlapi.getIndividuals(class_expr);
+			galaxyowlapi.disposeReasoner();
 			for(OWLNamedIndividual ind : inds){
 				print_result_entity(ind.getIRI(), Answer_render);
 			}
 		}
 		else if (Answer_type.equals("EquivalentClasses")) {
 			Set<OWLClass> answer_classes = galaxyowlapi.getEquivalentClasses(class_expr);
+			galaxyowlapi.disposeReasoner();
 			for(OWLClass cls : answer_classes){
 				print_result_entity(cls.getIRI(), Answer_render);
 			}
 		}
 		else if (Answer_type.equals("DirectSuperClasses")) {
 			Set<OWLClass> answer_classes = galaxyowlapi.getDirectSuperClasses(class_expr);
+			galaxyowlapi.disposeReasoner();
 			for(OWLClass cls : answer_classes){
 				print_result_entity(cls.getIRI(), Answer_render);
 			}
 		}
 		else if (Answer_type.equals("Ancestors")) {
 			Set<OWLClass> answer_classes = galaxyowlapi.getAncestors(class_expr);
+			galaxyowlapi.disposeReasoner();
 			for(OWLClass cls : answer_classes){
 				print_result_entity(cls.getIRI(), Answer_render);
 			}
 		}
 		else if (Answer_type.equals("DirectSubClasses")) {
 			Set<OWLClass> answer_classes = galaxyowlapi.getDirectSubClasses(class_expr);
+			galaxyowlapi.disposeReasoner();
 			for(OWLClass cls : answer_classes){
 				print_result_entity(cls.getIRI(), Answer_render);
 			}
@@ -83,6 +92,7 @@
 		// Descendants
 		else {
 			Set<OWLClass> answer_classes = galaxyowlapi.getDescendants(class_expr);
+			galaxyowlapi.disposeReasoner();
 			for(OWLClass cls : answer_classes){
 				print_result_entity(cls.getIRI(), Answer_render);
 			}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OPPL/test-data/ontology/single/elk.owl	Thu Sep 20 12:46:36 2012 +0200
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE rdf:RDF [
+    <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+    <!ENTITY debug "http://www.samuelcroset.com/debug.owl#" >
+    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+]>
+
+
+<rdf:RDF xmlns="http://www.samuelcroset.com/debug.owl#"
+     xml:base="http://www.samuelcroset.com/debug.owl"
+     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+     xmlns:owl="http://www.w3.org/2002/07/owl#"
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:debug="http://www.samuelcroset.com/debug.owl#">
+    <owl:Ontology rdf:about="http://www.samuelcroset.com/debug.owl"/>
+    
+
+
+    <!-- 
+    ///////////////////////////////////////////////////////////////////////////////////////
+    //
+    // Object Properties
+    //
+    ///////////////////////////////////////////////////////////////////////////////////////
+     -->
+
+    
+
+
+    <!-- http://www.samuelcroset.com/debug.owl#eats -->
+
+    <owl:ObjectProperty rdf:about="&debug;eats"/>
+    
+
+
+    <!-- 
+    ///////////////////////////////////////////////////////////////////////////////////////
+    //
+    // Classes
+    //
+    ///////////////////////////////////////////////////////////////////////////////////////
+     -->
+
+    
+
+
+    <!-- http://www.samuelcroset.com/debug.owl#Animal -->
+
+    <owl:Class rdf:about="&debug;Animal"/>
+    
+
+
+    <!-- http://www.samuelcroset.com/debug.owl#Food -->
+
+    <owl:Class rdf:about="&debug;Food"/>
+    
+
+
+    <!-- http://www.samuelcroset.com/debug.owl#Lion -->
+
+    <owl:Class rdf:about="&debug;Lion">
+        <rdfs:subClassOf rdf:resource="&debug;Animal"/>
+        <rdfs:subClassOf>
+            <owl:Restriction>
+                <owl:onProperty rdf:resource="&debug;eats"/>
+                <owl:someValuesFrom rdf:resource="&debug;Meat"/>
+            </owl:Restriction>
+        </rdfs:subClassOf>
+    </owl:Class>
+    
+
+
+    <!-- http://www.samuelcroset.com/debug.owl#Meat -->
+
+    <owl:Class rdf:about="&debug;Meat">
+        <rdfs:subClassOf rdf:resource="&debug;Food"/>
+    </owl:Class>
+    
+
+
+    <!-- http://www.samuelcroset.com/debug.owl#MeatEater -->
+
+    <owl:Class rdf:about="&debug;MeatEater">
+        <owl:equivalentClass>
+            <owl:Class>
+                <owl:intersectionOf rdf:parseType="Collection">
+                    <rdf:Description rdf:about="&debug;Animal"/>
+                    <owl:Restriction>
+                        <owl:onProperty rdf:resource="&debug;eats"/>
+                        <owl:someValuesFrom rdf:resource="&debug;Meat"/>
+                    </owl:Restriction>
+                </owl:intersectionOf>
+            </owl:Class>
+        </owl:equivalentClass>
+    </owl:Class>
+</rdf:RDF>
+
+
+
+<!-- Generated by the OWL API (version 3.2.3.1824) http://owlapi.sourceforge.net -->
+