Mercurial > repos > mikel-egana-aranguren > oppl
comparison OPPL/src/InferenceGalaxy.java @ 11:6ca67b155e32
Imports simplified, new tool for inference added
author | Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu> |
---|---|
date | Fri, 09 Mar 2012 16:15:27 +0100 |
parents | |
children | d3616fac4ca5 |
comparison
equal
deleted
inserted
replaced
10:3f31c0eb7539 | 11:6ca67b155e32 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package es.upm.fi.dia.oeg.oppl.galaxy; | |
5 | |
6 | |
7 import java.io.IOException; | |
8 | |
9 import org.semanticweb.owlapi.model.OWLOntologyCreationException; | |
10 import org.semanticweb.owlapi.model.OWLOntologyStorageException; | |
11 | |
12 | |
13 /** | |
14 * @author Mikel EgaƱa Aranguren | |
15 * | |
16 */ | |
17 public class InferenceGalaxy { | |
18 | |
19 /** | |
20 * @param args | |
21 * @throws IOException | |
22 * @throws OWLOntologyCreationException | |
23 * @throws OWLOntologyStorageException | |
24 */ | |
25 public static void main(String[] args) throws OWLOntologyStorageException, OWLOntologyCreationException, IOException { | |
26 // Get the arguments from command-line | |
27 String OWLFilePath = args [0]; | |
28 String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT | |
29 String axioms_to_inject = args [2]; // CLASS_ASSERTIONS,CLASS_HIERARCHY,DATA_PROPERTY_ASSERTIONS | |
30 | |
31 // 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. | |
32 // CLASS_HIERARCHY Denotes the computation of the class hierarchy. | |
33 // DATA_PROPERTY_ASSERTIONS Denotes the computation of relationships between individuals and data property values for each individual in the signature of the imports closure of the root ontology. | |
34 // DATA_PROPERTY_HIERARCHY Denotes the computation of the data property hierarchy. | |
35 // DIFFERENT_INDIVIDUALS Denotes the computation of sets of individuals that are different from each individual in the signature of the imports closure of the root ontology. | |
36 // DISJOINT_CLASSES Denotes the computation of sets of classes that are disjoint for each class in the signature of the imports closure of the root ontology. | |
37 // OBJECT_PROPERTY_ASSERTIONS Denotes the computation of relationships between individuals in the signature of the imports closure of the root ontology. | |
38 // OBJECT_PROPERTY_HIERARCHY Denotes the computation of the object property hierarchy. | |
39 // SAME_INDIVIDUAL Denotes the computation of individuals that are interpreted as the same object for each individual in the imports closure of the root ontology. | |
40 | |
41 // Create the manager | |
42 GalaxyOWLAPI galaxyowlapi = new GalaxyOWLAPI(); | |
43 | |
44 // Load the main ontology | |
45 galaxyowlapi.loadMainOntology(OWLFilePath); | |
46 | |
47 // Set the reasoner | |
48 | |
49 // Pellet | |
50 if(reasoner_type.equals("Pellet")){ | |
51 galaxyowlapi.setReasonerPellet(); | |
52 } | |
53 // FaCTPlusPlus | |
54 else if (reasoner_type.equals("FaCTPlusPlus")){ | |
55 galaxyowlapi.setReasonerFaCT(); | |
56 } | |
57 // HermiT | |
58 else{ | |
59 galaxyowlapi.setReasonerHermit(); | |
60 } | |
61 | |
62 // Add the inferred axioms as asserted axioms to the original ontology | |
63 | |
64 if(axioms_to_inject.contains(",")){ | |
65 String[] axioms = axioms_to_inject.split(","); | |
66 for(int i =0; i < axioms.length ; i++) | |
67 injectAxiom (axioms[i], galaxyowlapi); | |
68 } | |
69 else{ | |
70 injectAxiom (axioms_to_inject, galaxyowlapi); | |
71 } | |
72 | |
73 // Merge imported ontologies if requested | |
74 // if(merge.equals("Merge")){ | |
75 // galaxyowlapi.merge(); | |
76 // } | |
77 | |
78 // Save the ontology in OWL | |
79 galaxyowlapi.saveOntology(true); | |
80 | |
81 } | |
82 | |
83 static void injectAxiom (String axiom_to_inject, GalaxyOWLAPI galaxyowlapi){ | |
84 if(axiom_to_inject.equals("CLASS_HIERARCHY")){ | |
85 galaxyowlapi.addCLASS_HIERARCHY(); | |
86 // System.out.println("CLASS_HIERARCHY"); | |
87 } | |
88 if(axiom_to_inject.equals("CLASS_ASSERTIONS")){ | |
89 galaxyowlapi.addCLASS_ASSERTIONS(); | |
90 // System.out.println("CLASS_ASSERTIONS"); | |
91 } | |
92 if(axiom_to_inject.equals("DATA_PROPERTY_HIERARCHY")){ | |
93 galaxyowlapi.addDATA_PROPERTY_HIERARCHY(); | |
94 // System.out.println("DATA_PROPERTY_HIERARCHY"); | |
95 } | |
96 if(axiom_to_inject.equals("DISJOINT_CLASSES")){ | |
97 galaxyowlapi.addDISJOINT_CLASSES(); | |
98 // System.out.println("DISJOINT_CLASSES"); | |
99 } | |
100 if(axiom_to_inject.equals("OBJECT_PROPERTY_HIERARCHY")){ | |
101 galaxyowlapi.addOBJECT_PROPERTY_HIERARCHY(); | |
102 // System.out.println("OBJECT_PROPERTY_HIERARCHY"); | |
103 } | |
104 } | |
105 } |