# HG changeset patch # User Mikel Egaña Aranguren # Date 1316342118 -7200 # Node ID 3740505b579cc41df170ab489b4221f1e99defef # Parent 68935f90c2db8f6abde923f4abfbae9a640bb1ed Added reasoner option: Pellet or HermiT 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 @@ -27,11 +27,6 @@ 6.- Start galaxy. -Note that if you want you can use any java parameter by editing oppl.xml -, eg: java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 --jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL -$format > $output - 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. 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> gens = new ArrayList>(); 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()); } 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 @@ -1,15 +1,17 @@ It executes an OPPL script against the input ontology and generates a new ontology with the changes described in the OPPL script - + + + - #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 - + @@ -29,6 +31,10 @@ + + + + @@ -38,9 +44,10 @@ + - + @@ -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. diff -r 68935f90c2db -r 3740505b579c OPPL/oppl_galaxy_tool.jar Binary file OPPL/oppl_galaxy_tool.jar has changed