annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
1 package es.upm.fi.dia.oeg.oppl.galaxy;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
2
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
3 import java.util.Set;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
4
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
5 import org.semanticweb.owlapi.expression.ParserException;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
6 import org.semanticweb.owlapi.model.IRI;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
7 import org.semanticweb.owlapi.model.OWLClass;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
8 import org.semanticweb.owlapi.model.OWLClassExpression;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
9 import org.semanticweb.owlapi.model.OWLNamedIndividual;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
10 import org.semanticweb.owlapi.model.OWLOntologyCreationException;
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
11
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
12 public class OWLQueryGalaxy {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
14 /**
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
15 * @param args
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
16 * @throws OWLOntologyCreationException
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
17 * @throws ParserException
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
18 */
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
19 public static void main(String[] args) throws OWLOntologyCreationException, ParserException {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
20 // Get the arguments from command-line
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
21 String OWLFilePath = args [0]; // /home/pik/UPM/Paper/SWAT4LS_2011/JBS/Workflows_JBS/GO_module_transitive/go_no_trans.owl
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
22 String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT|Elk
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
23
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
24 String Answer_type = args [2]; // Individuals|EquivalentClasses|DirectSuperClasses|Ancestors|DirectSubClasses|Descendants
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
25 String Answer_render = args [3]; // URI|URIfragment|URIfragment2OBO
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
26 String MOS_query = args [4]; // GO_0007049 or part_of some GO_0007049
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
27
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
28 // Create the manager
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
29 GalaxyOWLAPI galaxyowlapi = new GalaxyOWLAPI();
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
30
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
31 // Load the main ontology and hope for the imported URIs to be resolvable
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
32 galaxyowlapi.loadMainOntology(OWLFilePath);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
33
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
34 // Set the reasoner
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
35
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
36 // Pellet
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
37 if(reasoner_type.equals("Pellet")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
38 galaxyowlapi.setReasonerPellet();
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
39 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
40 // FaCTPlusPlus
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
41 else if (reasoner_type.equals("FaCTPlusPlus")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
42 galaxyowlapi.setReasonerFaCT();
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
43 }
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
44 // Elk
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
45 else if (reasoner_type.equals("Elk")){
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
46 galaxyowlapi.setReasonerElk();
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
47 }
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
48 // HermiT
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
49 else{
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
50 galaxyowlapi.setReasonerHermit();
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
51 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
52
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
53 // Parse the expression to an OWLexpression
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
54 OWLClassExpression class_expr = galaxyowlapi.parseMOSClassExpression(MOS_query);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
55
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
56 // Execute query and print results
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
57 if(Answer_type.equals("Individuals")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
58 Set<OWLNamedIndividual> inds = galaxyowlapi.getIndividuals(class_expr);
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
59 galaxyowlapi.disposeReasoner();
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
60 for(OWLNamedIndividual ind : inds){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
61 print_result_entity(ind.getIRI(), Answer_render);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
62 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
63 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
64 else if (Answer_type.equals("EquivalentClasses")) {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
65 Set<OWLClass> answer_classes = galaxyowlapi.getEquivalentClasses(class_expr);
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
66 galaxyowlapi.disposeReasoner();
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
67 for(OWLClass cls : answer_classes){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
68 print_result_entity(cls.getIRI(), Answer_render);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
69 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
70 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
71 else if (Answer_type.equals("DirectSuperClasses")) {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
72 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSuperClasses(class_expr);
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
73 galaxyowlapi.disposeReasoner();
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
74 for(OWLClass cls : answer_classes){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
75 print_result_entity(cls.getIRI(), Answer_render);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
76 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
77 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
78 else if (Answer_type.equals("Ancestors")) {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
79 Set<OWLClass> answer_classes = galaxyowlapi.getAncestors(class_expr);
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
80 galaxyowlapi.disposeReasoner();
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
81 for(OWLClass cls : answer_classes){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
82 print_result_entity(cls.getIRI(), Answer_render);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
83 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
84 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
85 else if (Answer_type.equals("DirectSubClasses")) {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
86 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSubClasses(class_expr);
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
87 galaxyowlapi.disposeReasoner();
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
88 for(OWLClass cls : answer_classes){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
89 print_result_entity(cls.getIRI(), Answer_render);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
90 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
91 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
92 // Descendants
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
93 else {
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
94 Set<OWLClass> answer_classes = galaxyowlapi.getDescendants(class_expr);
18
d3616fac4ca5 Elk support added
Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents: 13
diff changeset
95 galaxyowlapi.disposeReasoner();
13
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
96 for(OWLClass cls : answer_classes){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
97 print_result_entity(cls.getIRI(), Answer_render);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
98 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
99 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
100 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
101
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
102 //URI|URIfragment|URIfragment2OBO
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
103 private static void print_result_entity (IRI iri, String Answer_render){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
104 if(Answer_render.equals("URI")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
105 System.out.println(iri);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
106 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
107
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
108 // Weird bug: in eclipse it can print out the IRIs of every entity, but in Galaxy it can't!
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
109 // done manually
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
110 else if(Answer_render.equals("URIfragment")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
111 if(iri.toString().contains("#")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
112 System.out.println(iri.getFragment());
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
113 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
114 else{
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
115 String [] iri_tokens = iri.toString().split("/");
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
116 System.out.println(iri_tokens[iri_tokens.length-1]);
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
117 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
118 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
119 else{
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
120 if(iri.toString().contains("#")){
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
121 System.out.println((iri.getFragment()).replace("_", ":"));
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
122 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
123 else{
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
124 String [] iri_tokens = iri.toString().split("/");
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
125 System.out.println((iri_tokens[iri_tokens.length-1]).replace("_", ":"));
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
126 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
127 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
128 }
7e6604a5ee55 New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff changeset
129 }