1 | package jp.ac.osaka_u.sanken.sparql;
|
---|
2 |
|
---|
3 |
|
---|
4 | import jp.ac.osaka_u.sanken.sparql.edit.AllegroEditor;
|
---|
5 |
|
---|
6 | import com.franz.agraph.jena.AGModel;
|
---|
7 | import com.franz.agraph.jena.AGQuery;
|
---|
8 | import com.franz.agraph.jena.AGQueryExecutionFactory;
|
---|
9 | import com.franz.agraph.jena.AGQueryFactory;
|
---|
10 | import com.hp.hpl.jena.query.QueryExecution;
|
---|
11 | /**
|
---|
12 | * AllegroAccessor繧「繧ッ繧サ繝�し
|
---|
13 | * @author kato
|
---|
14 | *
|
---|
15 | */
|
---|
16 | public class AllegroAccessor extends PlainSparqlAccessor {
|
---|
17 | public AllegroAccessor(EndpointSettings endpoint, SparqlQueryListener queryListener){
|
---|
18 | super(endpoint, queryListener);
|
---|
19 | }
|
---|
20 |
|
---|
21 | public AllegroAccessor(EndpointSettings endpoint){
|
---|
22 | this(endpoint, null);
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * query繧貞娼縺�※邨先棡繧定ソ斐☆
|
---|
27 | * @param query
|
---|
28 | * @return
|
---|
29 | */
|
---|
30 | protected QueryExecution makeQuery(String queryString){
|
---|
31 | QueryExecution qe = null;
|
---|
32 | if (this.getSetting().isEditable()){
|
---|
33 | System.out.println("query:["+queryString+"]");
|
---|
34 | // TODO 譛ャ譚・縺ェ繧影ndpoint縺ョ螳溯」�↓蠢懊§縺ヲfactory縺九i蝗コ譛峨�Accessor繧貞叙蠕励☆繧句ス「縺ォ縺吶∋縺阪□縺後� |
---|
35 | // 迴セ迥カ縺ッ縲憩ditable=true縲阪�蝣エ蜷医�AllegroGraph縺ォ豎コ繧∵遠縺。縺励※縺�k縲� |
---|
36 | AllegroEditor ae;
|
---|
37 | try {
|
---|
38 | ae = new AllegroEditor(this, this.getSetting().getRepositoryURL(), getSetting().getRepository(), getSetting().getUser(), getSetting().getPass());
|
---|
39 | AGQuery sparql = AGQueryFactory.create(queryString);
|
---|
40 | qe = AGQueryExecutionFactory.create(sparql, (AGModel)ae.getModel());
|
---|
41 | } catch (Exception e) {
|
---|
42 | e.printStackTrace();
|
---|
43 | }
|
---|
44 | } else {
|
---|
45 | qe = super.makeQuery(queryString);
|
---|
46 | }
|
---|
47 |
|
---|
48 | return qe;
|
---|
49 | }
|
---|
50 | }
|
---|