Mercurial > repos > mikel-egana-aranguren > sparql_galaxy
comparison src/es/cbgp/galaxy/sparql/jena/OntologyManager.java @ 2:b8bf1af83841 draft
Paste query added, query engine improved, examples added
author | Mikel Egana Aranguren <mikel-egana-aranguren@toolshed.g2.bx.psu.edu> |
---|---|
date | Wed, 04 Dec 2013 08:17:00 +0100 |
parents | 137f9a4a6337 |
children |
comparison
equal
deleted
inserted
replaced
1:117a4b4c002d | 2:b8bf1af83841 |
---|---|
1 package es.cbgp.galaxy.sparql.jena; | 1 package es.cbgp.galaxy.sparql.jena; |
2 | 2 |
3 import java.io.File; | 3 import java.io.File; |
4 | 4 |
5 import com.hp.hpl.jena.ontology.OntModel; | 5 import com.hp.hpl.jena.rdf.model.Model; |
6 import com.hp.hpl.jena.rdf.model.ModelFactory; | 6 import com.hp.hpl.jena.rdf.model.ModelFactory; |
7 | 7 |
8 public class OntologyManager { | 8 public class OntologyManager { |
9 | 9 |
10 private String ontFile; | 10 private String ontFile; |
11 private String sparqlFile; | 11 private String sparqlFile; |
12 private OntModel model; | 12 private Model model; |
13 private SPARQLQueryEngine sqe; | 13 private SPARQLQueryEngine sqe; |
14 | 14 |
15 public OntologyManager(String of, String sf) throws Exception { | 15 public OntologyManager(String of, String sf) throws Exception { |
16 this.ontFile = of; | 16 this.ontFile = of; |
17 this.sparqlFile = sf; | 17 this.sparqlFile = sf; |
18 init(); | 18 init(); |
19 } | 19 } |
20 | 20 |
21 private void init() throws Exception { | 21 private void init() throws Exception { |
22 this.model = ModelFactory.createOntologyModel(); | 22 this.model = ModelFactory.createDefaultModel(); |
23 this.model.read(new File(ontFile).toURI().toString()); | 23 this.model.read(new File(ontFile).toURI().toString()); |
24 } | 24 } |
25 | 25 |
26 public void executeQuery() throws Exception { | 26 public void executeQuery() throws Exception { |
27 this.sqe = new SPARQLQueryEngine(model); | 27 this.sqe = new SPARQLQueryEngine(model); |