Mercurial > repos > mikel-egana-aranguren > sparql_galaxy
comparison src/es/cbgp/galaxy/sparql/jena/OntologyManager.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 | b8bf1af83841 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:137f9a4a6337 |
---|---|
1 package es.cbgp.galaxy.sparql.jena; | |
2 | |
3 import java.io.File; | |
4 | |
5 import com.hp.hpl.jena.ontology.OntModel; | |
6 import com.hp.hpl.jena.rdf.model.ModelFactory; | |
7 | |
8 public class OntologyManager { | |
9 | |
10 private String ontFile; | |
11 private String sparqlFile; | |
12 private OntModel model; | |
13 private SPARQLQueryEngine sqe; | |
14 | |
15 public OntologyManager(String of, String sf) throws Exception { | |
16 this.ontFile = of; | |
17 this.sparqlFile = sf; | |
18 init(); | |
19 } | |
20 | |
21 private void init() throws Exception { | |
22 this.model = ModelFactory.createOntologyModel(); | |
23 this.model.read(new File(ontFile).toURI().toString()); | |
24 } | |
25 | |
26 public void executeQuery() throws Exception { | |
27 this.sqe = new SPARQLQueryEngine(model); | |
28 this.sqe.setQueryFile(sparqlFile); | |
29 String ret = sqe.executeQuery(); | |
30 System.out.println(ret); | |
31 } | |
32 } |