# HG changeset patch # User Mikel EgaƱa Aranguren # Date 1316022726 -7200 # Node ID 4f60202c58d9448f58ebd038ef5443ca06d37ff3 # Parent 5255f1333cc4a1d77837179c56c21401e61facf7 Added option to push inferred subsumption axioms into output ontology diff -r 5255f1333cc4 -r 4f60202c58d9 OPPL/README --- a/OPPL/README Wed Sep 07 10:46:29 2011 +0200 +++ b/OPPL/README Wed Sep 14 19:52:06 2011 +0200 @@ -49,6 +49,17 @@ >> Execute an OPPL file against an OWL file +FORESEEN FEATURES +================= + +OWL import closure. + +Choose which inferred axioms to add to the output ontology (Right now +only subsumption is available). + +Choose reasoner (Right now only Pellet is available). + + TESTS ===== diff -r 5255f1333cc4 -r 4f60202c58d9 OPPL/Tool.java --- a/OPPL/Tool.java Wed Sep 07 10:46:29 2011 +0200 +++ b/OPPL/Tool.java Wed Sep 14 19:52:06 2011 +0200 @@ -25,6 +25,7 @@ import java.io.OutputStream; import java.io.PipedOutputStream; import java.io.PrintStream; +import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.logging.Level; @@ -44,13 +45,18 @@ import org.semanticweb.owlapi.io.RDFXMLOntologyFormat; import org.semanticweb.owlapi.io.SystemOutDocumentTarget; import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLAxiom; import org.semanticweb.owlapi.model.OWLAxiomChange; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyCreationException; import org.semanticweb.owlapi.model.OWLOntologyManager; import org.semanticweb.owlapi.model.OWLOntologyStorageException; +import org.semanticweb.owlapi.reasoner.InferenceType; import org.semanticweb.owlapi.reasoner.OWLReasoner; import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; +import org.semanticweb.owlapi.util.InferredAxiomGenerator; +import org.semanticweb.owlapi.util.InferredOntologyGenerator; +import org.semanticweb.owlapi.util.InferredSubClassAxiomGenerator; import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory; @@ -74,6 +80,7 @@ String OWLFilePath = args [0]; String OPPL_script_file = args [1]; String Output_format = args [2]; + String Add_inferred = args [3]; String OPPL_script_source = ""; // Load the flat file with script in memory @@ -107,15 +114,22 @@ List changes = extractor.visit(OPPLscript); manager.applyChanges(changes); + // Add the inferred axioms as asserted axioms to the original ontology + if(Add_inferred.equals("Add_inferred")){ + reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY); + List> gens = new ArrayList>(); + gens.add(new InferredSubClassAxiomGenerator()); + InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, gens); + 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(); - + OWLOntologyDocumentTarget documentTarget = new SystemOutDocumentTarget(); if(Output_format.equals("OBO")){ manager.saveOntology(OWL_ontology, new OBOOntologyFormat(), new SystemOutDocumentTarget()); } else{ manager.saveOntology(OWL_ontology, new RDFXMLOntologyFormat(), new SystemOutDocumentTarget()); } - } } diff -r 5255f1333cc4 -r 4f60202c58d9 OPPL/oppl.xml --- a/OPPL/oppl.xml Wed Sep 07 10:46:29 2011 +0200 +++ b/OPPL/oppl.xml Wed Sep 14 19:52:06 2011 +0200 @@ -1,6 +1,7 @@ - + It executes an OPPL script against the input ontology and generates a new ontology with the changes described in the OPPL script - java -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format > $output + java -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred > $output + @@ -8,6 +9,7 @@ + @@ -18,6 +20,7 @@ + @@ -50,7 +53,7 @@ **More information** - http://oppl2.sourceforge.net/ + http://oppl.sf.net/ http://owlapi.sourceforge.net/ @@ -58,12 +61,6 @@ http://clarkparsia.com/pellet -**Features that will be implemented soon** - - OWL import closure. - - Choose reasoner (Right now only Pellet is available). - **Contact** Please send any request or comment to mikel.egana.aranguren@gmail.com. diff -r 5255f1333cc4 -r 4f60202c58d9 OPPL/oppl_galaxy_tool.jar Binary file OPPL/oppl_galaxy_tool.jar has changed diff -r 5255f1333cc4 -r 4f60202c58d9 OPPL/test.owl --- a/OPPL/test.owl Wed Sep 07 10:46:29 2011 +0200 +++ b/OPPL/test.owl Wed Sep 14 19:52:06 2011 +0200 @@ -38,6 +38,12 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -64,7 +119,9 @@ - + + +