Mercurial > repos > mikel-egana-aranguren > oppl
annotate OPPL/src/OWLQueryGalaxy.java @ 15:622cde484f4c draft
Add new tool to perform OPPL queries
author | Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu> |
---|---|
date | Thu, 12 Jul 2012 17:12:00 +0200 |
parents | 7e6604a5ee55 |
children | d3616fac4ca5 |
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 |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
22 String reasoner_type = args [1]; // Pellet|FaCTPlusPlus|HermiT |
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 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
44 // HermiT |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
45 else{ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
46 galaxyowlapi.setReasonerHermit(); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
47 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
48 |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
49 // 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
|
50 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
|
51 |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
52 // 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
|
53 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
|
54 Set<OWLNamedIndividual> inds = galaxyowlapi.getIndividuals(class_expr); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
55 for(OWLNamedIndividual ind : inds){ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
56 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
|
57 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
58 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
59 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
|
60 Set<OWLClass> answer_classes = galaxyowlapi.getEquivalentClasses(class_expr); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
61 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
|
62 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
|
63 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
64 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
65 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
|
66 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSuperClasses(class_expr); |
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("Ancestors")) { |
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.getAncestors(class_expr); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
73 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
|
74 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
|
75 } |
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 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
|
78 Set<OWLClass> answer_classes = galaxyowlapi.getDirectSubClasses(class_expr); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
79 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
|
80 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
|
81 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
82 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
83 // Descendants |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
84 else { |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
85 Set<OWLClass> answer_classes = galaxyowlapi.getDescendants(class_expr); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
86 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
|
87 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
|
88 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
89 } |
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 //URI|URIfragment|URIfragment2OBO |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
93 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
|
94 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
|
95 System.out.println(iri); |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
96 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
97 |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
98 // 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
|
99 // done manually |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
100 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
|
101 if(iri.toString().contains("#")){ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
102 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
|
103 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
104 else{ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
105 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
|
106 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
|
107 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
108 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
109 else{ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
110 if(iri.toString().contains("#")){ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
111 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
|
112 } |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
113 else{ |
7e6604a5ee55
New query tool added
Mikel Egaña Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu>
parents:
diff
changeset
|
114 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
|
115 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
|
116 } |
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 } |