Repository 'oppl'
hg clone https://toolshed.g2.bx.psu.edu/repos/mikel-egana-aranguren/oppl

Changeset 6:3740505b579c (2011-09-18)
Previous changeset 5:68935f90c2db (2011-09-17) Next changeset 7:756f1f5798bf (2011-09-18)
Commit message:
Added reasoner option: Pellet or HermiT
modified:
OPPL/README
OPPL/Tool.java
OPPL/oppl.xml
OPPL/oppl_galaxy_tool.jar
b
diff -r 68935f90c2db -r 3740505b579c OPPL/README
--- a/OPPL/README Sat Sep 17 13:41:28 2011 +0200
+++ b/OPPL/README Sun Sep 18 12:35:18 2011 +0200
b
@@ -27,11 +27,6 @@
 
 6.- Start galaxy.
 
-Note that if you want you can use any java parameter by editing oppl.xml
-, eg: <command>java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 
--jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL 
-$format > $output </command>
-
 
 
 USAGE
@@ -56,7 +51,7 @@
 Choose which inferred axioms to add to the output ontology (Right now 
 only subsumption is available).
 
-Choose reasoner (Right now only Pellet is available).
+FaCT++ and OWLLink support.
 
 
 
b
diff -r 68935f90c2db -r 3740505b579c OPPL/Tool.java
--- a/OPPL/Tool.java Sat Sep 17 13:41:28 2011 +0200
+++ b/OPPL/Tool.java Sun Sep 18 12:35:18 2011 +0200
[
@@ -17,14 +17,8 @@
 
 package es.upm.fi.dia.oeg.oppl.galaxy;
 
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FilterOutputStream;
-import java.io.OutputStream;
-import java.io.PipedOutputStream;
-import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Scanner;
@@ -41,7 +35,6 @@
 import org.coode.parsers.ErrorListener;
 import org.coode.parsers.LoggerErrorListener;
 import org.semanticweb.owlapi.apibinding.OWLManager;
-import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget;
 import org.semanticweb.owlapi.io.RDFXMLOntologyFormat;
 import org.semanticweb.owlapi.io.SystemOutDocumentTarget;
 import org.semanticweb.owlapi.model.IRI;
@@ -63,6 +56,8 @@
 
 import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;
 
+import org.semanticweb.HermiT.Reasoner;
+
 /**
  * @author Mikel EgaƱa Aranguren
  */
@@ -80,6 +75,7 @@
  String Output_format = args [2]; // OWL|OBO
  String Add_inferred = args [3]; // Add_inferred|Whatever
  String imports_file_path = args [4]; // Flat tab delimited file: URI Document URI
+ String reasoner_type = args [5]; // Pellet|HermiT
 
  // Load the main ontology
  File owl_file = new File(OWLFilePath);
@@ -92,11 +88,7 @@
  while(imports_input.hasNext()){
      String nextLine = imports_input.nextLine();
      if(!nextLine.startsWith("#")){
-     String [] URI_documentURI = nextLine.split("\t");
- //     System.out.println(URI_documentURI[0]);
- //     System.out.println(URI_documentURI[1]);
- // IRI ontology_IRI = IRI.create("http://purl.obolibrary.org/obo/CHEBI_ONTOLOGY_chebi_ontology");
- // IRI document_IRI = IRI.create("file://" + "/home/pik/UPM/OPPL_galaxy/SWAT4LS_2011/GONG/chebi.owl");
+     String [] URI_documentURI = nextLine.split("\t");
      IRI ontology_IRI = IRI.create(URI_documentURI[0]);
  IRI document_IRI = IRI.create("file://" + URI_documentURI[1]);
  OWLOntologyIRIMapper iriMapper = new SimpleIRIMapper(ontology_IRI,document_IRI);
@@ -109,9 +101,16 @@
  OWLOntology OWL_ontology = manager.loadOntologyFromOntologyDocument(owl_file);
 
  // Reasoner
- OWLReasonerFactory reasonerFactory = new PelletReasonerFactory(); 
- OWLReasoner reasoner = reasonerFactory.createReasoner(OWL_ontology);
- reasoner.isConsistent();
+ OWLReasonerFactory reasonerFactory = null;
+ OWLReasoner reasoner = null;
+ if(reasoner_type.equals("Pellet")){
+ reasonerFactory = new PelletReasonerFactory(); 
+ reasoner = reasonerFactory.createReasoner(OWL_ontology);
+ }
+ else{
+ reasonerFactory = new Reasoner.ReasonerFactory();
+ reasoner = reasonerFactory.createReasoner(OWL_ontology);
+ }
 
  // Load the flat file with script in memory
  String OPPL_script_source = "";
@@ -126,7 +125,7 @@
  // Parse the OPPL script
  ParserFactory parserFactory = new ParserFactory(manager, OWL_ontology, reasoner); 
  Logger logger = Logger.getLogger(Tool.class.getName());
- Logging.getQueryLogger().setLevel(Level.OFF); // The normal messages are errors for galaxy
+ 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);
@@ -142,11 +141,10 @@
  List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
  gens.add(new InferredSubClassAxiomGenerator());
  InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, gens);
- iog.fillOntology(manager, OWL_ontology);
+ iog.fillOntology(manager, OWL_ontology);
  }
 
- // Print the ontology to the standard output so other galaxy tools can operate on the output
- OWLOntologyDocumentTarget documentTarget = new SystemOutDocumentTarget();
+ // Print the ontology to the standard output so other galaxy tools can operate on the output
  if(Output_format.equals("OBO")){
  manager.saveOntology(OWL_ontology, new OBOOntologyFormat(), new SystemOutDocumentTarget());
  }
b
diff -r 68935f90c2db -r 3740505b579c OPPL/oppl.xml
--- a/OPPL/oppl.xml Sat Sep 17 13:41:28 2011 +0200
+++ b/OPPL/oppl.xml Sun Sep 18 12:35:18 2011 +0200
b
@@ -1,15 +1,17 @@
 <tool id="oppl" name="Execute an OPPL file against an ontology" version="1.0.3">
  <description>It executes an OPPL script against the input ontology and generates a new ontology with the changes described in the OPPL script</description>
 
- <!-- The conditional is tacky, I think, but it works! -->
+ <!-- The command execution of the conditional is tacky, I think, but it works! -->
+ <!-- Galaxy is not happy with OPPL throwing info into stderr, and I have redirected stderr to /dev/null, which is a bad solution since OPPL galaxy does not inform properly when it fails -->
+ <!-- More info on the stderr issue: http://wiki.g2.bx.psu.edu/Future/Job%20Failure%20When%20stderr -->
 
  <command>
- #if $import_opts.imports_select==False #java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred NoImports > $output 2>/dev/null
- #else #java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred $imports > $output 2>/dev/null
+ #if $import_opts.imports_select==False #java -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred NoImports $reasoner > $output 2>/dev/null
+ #else #java -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred $imports $reasoner > $output 2>/dev/null
  #end if
  </command>
 
- <!--<command>java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred $imports > $output 2>/dev/null</command>-->
+ <!-- For big ontologies use something like java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 -jar-->
 
  <inputs>
  <param format="text" name="input" type="data" label="Input ontology file"/>
@@ -29,6 +31,10 @@
  <option value="OBO">OBO</option>
  </param>
  <param name="inferred" type="boolean" value="False" truevalue="Add_inferred" falsevalue="Gora_ni" label="Add inferred subsumption axioms to output ontology"/>
+ <param name="reasoner" type="select" label="Choose reasoner">
+ <option value="Pellet" selected="true">Pellet</option>
+ <option value="HermiT">HermiT</option>
+ </param>
 
  </inputs>
  <outputs>
@@ -38,9 +44,10 @@
  <test>
  <param name="input" value="test.owl"/>
  <param name="OPPL" value="test.oppl"/>
+ <param name="imports" value="NoImports"/>
  <param name="format" value="OWL"/>
  <param name="inferred" value="False"/>
- <param name="imports" value="NoImports"/>
+ <param name="reasoner" value="Pellet"/>
  <output name="out_file" file="test_new.owl"/>
  </test>
  </tests>
@@ -48,7 +55,7 @@
 
 **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 (Adding or removing axioms). An OPPL script (See bellow or test.oppl) defines a query to be performed against the ontology, and some actions 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 a given ontology, saving time and effort.  
+  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 effort.  
 
 **Formats**
 
@@ -70,6 +77,8 @@
  
   The inferred subsumption axioms can be added to the output ontology as asserted axioms. 
 
+  The reasoner can be Pellet or HermiT. Sometimes, if an execution fails it can be fixed by using a different reasoner. 
+
 **More information**
 
   http://oppl.sf.net/
@@ -80,6 +89,8 @@
 
   http://clarkparsia.com/pellet
 
+  http://hermit-reasoner.com/
+
 **Contact**
 
   Please send any request or comment to mikel.egana.aranguren@gmail.com.
b
diff -r 68935f90c2db -r 3740505b579c OPPL/oppl_galaxy_tool.jar
b
Binary file OPPL/oppl_galaxy_tool.jar has changed