Mercurial > repos > mikel-egana-aranguren > oppl
changeset 4:4f60202c58d9
Added option to push inferred subsumption axioms into output ontology
author | Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu> |
---|---|
date | Wed, 14 Sep 2011 19:52:06 +0200 |
parents | 5255f1333cc4 |
children | 68935f90c2db |
files | OPPL/README OPPL/Tool.java OPPL/oppl.xml OPPL/oppl_galaxy_tool.jar OPPL/test.owl |
diffstat | 5 files changed, 92 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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 =====
--- 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<OWLAxiomChange> 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<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>(); + 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()); } - } }
--- 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 @@ -<tool id="oppl" name="Execute an OPPL file against an ontology" version="1.0.1"> +<tool id="oppl" name="Execute an OPPL file against an ontology" version="1.0.2"> <description>It executes an OPPL script against the input ontology and generates a new ontology with the changes described in the OPPL script</description> - <command>java -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format > $output </command> + <command>java -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format $inferred > $output </command> + <!--<command>java -Xmx7000M -Xms250M -DentityExpansionLimit=1000000000 -jar ${__tool_data_path__}/shared/jars/oppl_galaxy_tool.jar $input $OPPL $format > $output </command>--> <inputs> <param format="text" name="input" type="data" label="Input ontology file"/> <param format="text" name="OPPL" type="data" label="OPPL file"/> @@ -8,6 +9,7 @@ <option value="OWL" selected="true">OWL</option> <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"/> </inputs> <outputs> <data format="text" name="output" /> @@ -18,6 +20,7 @@ <param name="input" value="test.owl"/> <param name="OPPL" value="test.oppl"/> <param name="format" value="OWL"/> + <param name="inferred" value="False"/> <output name="out_file" file="test_new.owl"/> </test> </tests> @@ -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.
--- 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 @@ + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/prop --> + + <owl:ObjectProperty rdf:about="&Ontology1314715036188;prop"/> + + + <!-- /////////////////////////////////////////////////////////////////////////////////////// // @@ -49,9 +55,58 @@ + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/OPPL_test --> + + <owl:Class rdf:about="&Ontology1314715036188;OPPL_test"/> + + + + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/Taxonomy_test --> + + <owl:Class rdf:about="&Ontology1314715036188;Taxonomy_test"/> + + + + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/child_class --> + + <owl:Class rdf:about="&Ontology1314715036188;child_class"> + <rdfs:subClassOf rdf:resource="&Ontology1314715036188;Taxonomy_test"/> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="&Ontology1314715036188;prop"/> + <owl:someValuesFrom rdf:resource="&Ontology1314715036188;filler"/> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + + + + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/filler --> + + <owl:Class rdf:about="&Ontology1314715036188;filler"> + <rdfs:subClassOf rdf:resource="&Ontology1314715036188;Taxonomy_test"/> + </owl:Class> + + + + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/parent_class --> + + <owl:Class rdf:about="&Ontology1314715036188;parent_class"> + <owl:equivalentClass> + <owl:Restriction> + <owl:onProperty rdf:resource="&Ontology1314715036188;prop"/> + <owl:someValuesFrom rdf:resource="&Ontology1314715036188;filler"/> + </owl:Restriction> + </owl:equivalentClass> + <rdfs:subClassOf rdf:resource="&Ontology1314715036188;Taxonomy_test"/> + </owl:Class> + + + <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/part --> <owl:Class rdf:about="&Ontology1314715036188;part"> + <rdfs:subClassOf rdf:resource="&Ontology1314715036188;OPPL_test"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="&Ontology1314715036188;part_of"/> @@ -64,7 +119,9 @@ <!-- http://www.semanticweb.org/ontologies/2011/7/Ontology1314715036188.owl/whole --> - <owl:Class rdf:about="&Ontology1314715036188;whole"/> + <owl:Class rdf:about="&Ontology1314715036188;whole"> + <rdfs:subClassOf rdf:resource="&Ontology1314715036188;OPPL_test"/> + </owl:Class> </rdf:RDF>