comparison src/InferenceGalaxy.java @ 19:cc270db37d33 draft

Directories re-arranged
author Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
date Sat, 06 Oct 2012 21:50:39 +0200
parents OPPL/src/InferenceGalaxy.java@d3616fac4ca5
children
comparison
equal deleted inserted replaced
18:d3616fac4ca5 19:cc270db37d33
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|Elk
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 // Elk
58 else if (reasoner_type.equals("Elk")){
59 galaxyowlapi.setReasonerElk();
60 }
61 // HermiT
62 else{
63 galaxyowlapi.setReasonerHermit();
64 }
65
66 // Add the inferred axioms as asserted axioms to the original ontology
67
68 if(axioms_to_inject.contains(",")){
69 String[] axioms = axioms_to_inject.split(",");
70 for(int i =0; i < axioms.length ; i++)
71 injectAxiom (axioms[i], galaxyowlapi);
72 }
73 else{
74 injectAxiom (axioms_to_inject, galaxyowlapi);
75 }
76
77 galaxyowlapi.disposeReasoner();
78
79 // Merge imported ontologies if requested
80 // if(merge.equals("Merge")){
81 // galaxyowlapi.merge();
82 // }
83
84 // Save the ontology in OWL
85 galaxyowlapi.saveOntology(true);
86
87 }
88
89 static void injectAxiom (String axiom_to_inject, GalaxyOWLAPI galaxyowlapi){
90 if(axiom_to_inject.equals("CLASS_HIERARCHY")){
91 galaxyowlapi.addCLASS_HIERARCHY();
92 // System.out.println("CLASS_HIERARCHY");
93 }
94 if(axiom_to_inject.equals("CLASS_ASSERTIONS")){
95 galaxyowlapi.addCLASS_ASSERTIONS();
96 // System.out.println("CLASS_ASSERTIONS");
97 }
98 if(axiom_to_inject.equals("DATA_PROPERTY_HIERARCHY")){
99 galaxyowlapi.addDATA_PROPERTY_HIERARCHY();
100 // System.out.println("DATA_PROPERTY_HIERARCHY");
101 }
102 if(axiom_to_inject.equals("DISJOINT_CLASSES")){
103 galaxyowlapi.addDISJOINT_CLASSES();
104 // System.out.println("DISJOINT_CLASSES");
105 }
106 if(axiom_to_inject.equals("OBJECT_PROPERTY_HIERARCHY")){
107 galaxyowlapi.addOBJECT_PROPERTY_HIERARCHY();
108 // System.out.println("OBJECT_PROPERTY_HIERARCHY");
109 }
110 }
111 }