comparison OPPL/src/OWLQueryGalaxy.java @ 18:d3616fac4ca5 draft

Elk support added
author Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
date Thu, 20 Sep 2012 12:46:36 +0200
parents 7e6604a5ee55
children
comparison
equal deleted inserted replaced
17:c9e01f86b07c 18:d3616fac4ca5
17 * @throws ParserException 17 * @throws ParserException
18 */ 18 */
19 public static void main(String[] args) throws OWLOntologyCreationException, ParserException { 19 public static void main(String[] args) throws OWLOntologyCreationException, ParserException {
20 // Get the arguments from command-line 20 // Get the arguments from command-line
21 String OWLFilePath = args [0]; // /home/pik/UPM/Paper/SWAT4LS_2011/JBS/Workflows_JBS/GO_module_transitive/go_no_trans.owl 21 String OWLFilePath = args [0]; // /home/pik/UPM/Paper/SWAT4LS_2011/JBS/Workflows_JBS/GO_module_transitive/go_no_trans.owl
22 String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT 22 String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT|Elk
23 23
24 String Answer_type = args [2]; // Individuals|EquivalentClasses|DirectSuperClasses|Ancestors|DirectSubClasses|Descendants 24 String Answer_type = args [2]; // Individuals|EquivalentClasses|DirectSuperClasses|Ancestors|DirectSubClasses|Descendants
25 String Answer_render = args [3]; // URI|URIfragment|URIfragment2OBO 25 String Answer_render = args [3]; // URI|URIfragment|URIfragment2OBO
26 String MOS_query = args [4]; // GO_0007049 or part_of some GO_0007049 26 String MOS_query = args [4]; // GO_0007049 or part_of some GO_0007049
27 27
39 } 39 }
40 // FaCTPlusPlus 40 // FaCTPlusPlus
41 else if (reasoner_type.equals("FaCTPlusPlus")){ 41 else if (reasoner_type.equals("FaCTPlusPlus")){
42 galaxyowlapi.setReasonerFaCT(); 42 galaxyowlapi.setReasonerFaCT();
43 } 43 }
44 // Elk
45 else if (reasoner_type.equals("Elk")){
46 galaxyowlapi.setReasonerElk();
47 }
44 // HermiT 48 // HermiT
45 else{ 49 else{
46 galaxyowlapi.setReasonerHermit(); 50 galaxyowlapi.setReasonerHermit();
47 } 51 }
48 52
50 OWLClassExpression class_expr = galaxyowlapi.parseMOSClassExpression(MOS_query); 54 OWLClassExpression class_expr = galaxyowlapi.parseMOSClassExpression(MOS_query);
51 55
52 // Execute query and print results 56 // Execute query and print results
53 if(Answer_type.equals("Individuals")){ 57 if(Answer_type.equals("Individuals")){
54 Set<OWLNamedIndividual> inds = galaxyowlapi.getIndividuals(class_expr); 58 Set<OWLNamedIndividual> inds = galaxyowlapi.getIndividuals(class_expr);
59 galaxyowlapi.disposeReasoner();
55 for(OWLNamedIndividual ind : inds){ 60 for(OWLNamedIndividual ind : inds){
56 print_result_entity(ind.getIRI(), Answer_render); 61 print_result_entity(ind.getIRI(), Answer_render);
57 } 62 }
58 } 63 }
59 else if (Answer_type.equals("EquivalentClasses")) { 64 else if (Answer_type.equals("EquivalentClasses")) {
60 Set<OWLClass> answer_classes = galaxyowlapi.getEquivalentClasses(class_expr); 65 Set<OWLClass> answer_classes = galaxyowlapi.getEquivalentClasses(class_expr);
66 galaxyowlapi.disposeReasoner();
61 for(OWLClass cls : answer_classes){ 67 for(OWLClass cls : answer_classes){
62 print_result_entity(cls.getIRI(), Answer_render); 68 print_result_entity(cls.getIRI(), Answer_render);
63 } 69 }
64 } 70 }
65 else if (Answer_type.equals("DirectSuperClasses")) { 71 else if (Answer_type.equals("DirectSuperClasses")) {
66 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSuperClasses(class_expr); 72 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSuperClasses(class_expr);
73 galaxyowlapi.disposeReasoner();
67 for(OWLClass cls : answer_classes){ 74 for(OWLClass cls : answer_classes){
68 print_result_entity(cls.getIRI(), Answer_render); 75 print_result_entity(cls.getIRI(), Answer_render);
69 } 76 }
70 } 77 }
71 else if (Answer_type.equals("Ancestors")) { 78 else if (Answer_type.equals("Ancestors")) {
72 Set<OWLClass> answer_classes = galaxyowlapi.getAncestors(class_expr); 79 Set<OWLClass> answer_classes = galaxyowlapi.getAncestors(class_expr);
80 galaxyowlapi.disposeReasoner();
73 for(OWLClass cls : answer_classes){ 81 for(OWLClass cls : answer_classes){
74 print_result_entity(cls.getIRI(), Answer_render); 82 print_result_entity(cls.getIRI(), Answer_render);
75 } 83 }
76 } 84 }
77 else if (Answer_type.equals("DirectSubClasses")) { 85 else if (Answer_type.equals("DirectSubClasses")) {
78 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSubClasses(class_expr); 86 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSubClasses(class_expr);
87 galaxyowlapi.disposeReasoner();
79 for(OWLClass cls : answer_classes){ 88 for(OWLClass cls : answer_classes){
80 print_result_entity(cls.getIRI(), Answer_render); 89 print_result_entity(cls.getIRI(), Answer_render);
81 } 90 }
82 } 91 }
83 // Descendants 92 // Descendants
84 else { 93 else {
85 Set<OWLClass> answer_classes = galaxyowlapi.getDescendants(class_expr); 94 Set<OWLClass> answer_classes = galaxyowlapi.getDescendants(class_expr);
95 galaxyowlapi.disposeReasoner();
86 for(OWLClass cls : answer_classes){ 96 for(OWLClass cls : answer_classes){
87 print_result_entity(cls.getIRI(), Answer_render); 97 print_result_entity(cls.getIRI(), Answer_render);
88 } 98 }
89 } 99 }
90 } 100 }