Mercurial > repos > mikel-egana-aranguren > sparql_galaxy
comparison src/es/cbgp/galaxy/sparql/main/Main.java @ 0:137f9a4a6337 draft
First version to init the repo, still README etc to add but it works
author | mikel-egana-aranguren |
---|---|
date | Thu, 25 Oct 2012 12:17:40 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:137f9a4a6337 |
---|---|
1 package es.cbgp.galaxy.sparql.main; | |
2 | |
3 import java.io.File; | |
4 | |
5 import es.cbgp.galaxy.sparql.jena.OntologyManager; | |
6 | |
7 public class Main { | |
8 | |
9 public Main(String args[]) { | |
10 Result r = check(args); | |
11 if (r.getBoolValue()) { | |
12 String ontFile = args[0]; | |
13 String sparqlFile = args[1]; | |
14 run(ontFile, sparqlFile); | |
15 } else { | |
16 System.err.println("Error: " + r.getMessage()); | |
17 } | |
18 } | |
19 | |
20 private void run(String ontFile, String sparqlFile) { | |
21 try { | |
22 OntologyManager om = new OntologyManager(ontFile, sparqlFile); | |
23 om.executeQuery(); | |
24 } catch (Exception e) { | |
25 e.printStackTrace(); | |
26 } | |
27 } | |
28 | |
29 private Result check(String[] args) { | |
30 if (args.length == 2) { | |
31 String fo = args[0]; | |
32 String fs = args[1]; | |
33 if (new File(fo).exists()) { | |
34 if (new File(fs).exists()) { | |
35 return new Result(true); | |
36 } else { | |
37 return new Result(false, | |
38 "Ontology file exists. SPARQL file not!"); | |
39 } | |
40 } | |
41 return new Result(false, "Ontology file not exists!"); | |
42 } | |
43 return new Result(false, | |
44 "Incorrect number of parameters. Necessary 2: " + args.length); | |
45 } | |
46 | |
47 public static void main(String[] args) { | |
48 /* | |
49 * Input: ontologia "SELECT .... blala" | |
50 */ | |
51 new Main(args); | |
52 } | |
53 | |
54 } |