Revision a93145b5
Added by Andreas Kohlbecker over 8 years ago
src/main/java/org/bgbm/biovel/drf/checklist/EEA_BDC_Client.java | ||
---|---|---|
11 | 11 |
import org.apache.jena.rdf.model.Resource; |
12 | 12 |
import org.apache.lucene.queryParser.QueryParser; |
13 | 13 |
import org.bgbm.biovel.drf.client.ServiceProviderInfo; |
14 |
import org.bgbm.biovel.drf.query.IQueryClient; |
|
15 |
import org.bgbm.biovel.drf.query.SparqlClient; |
|
16 | 14 |
import org.bgbm.biovel.drf.query.TinkerPopClient; |
17 | 15 |
import org.bgbm.biovel.drf.store.Neo4jStore; |
18 | 16 |
import org.bgbm.biovel.drf.store.Store; |
19 |
import org.bgbm.biovel.drf.store.TDBStore; |
|
20 | 17 |
import org.bgbm.biovel.drf.tnr.msg.NameType; |
21 | 18 |
import org.bgbm.biovel.drf.tnr.msg.Query; |
22 | 19 |
import org.bgbm.biovel.drf.tnr.msg.Query.Request; |
... | ... | |
51 | 48 |
public static final String DOC_URL = "http://semantic.eea.europa.eu/documentation"; |
52 | 49 |
public static final String COPYRIGHT_URL = "http://www.eea.europa.eu/legal/eea-data-policy"; |
53 | 50 |
|
54 |
private static final String SPARQL_ENDPOINT_URL = "http://semantic.eea.europa.eu/sparql"; |
|
55 |
private static final boolean USE_REMOTE_SERVICE = false; |
|
56 |
|
|
57 | 51 |
private static final String SPECIES_RDF_FILE_URL = "http://localhost/download/species.rdf.gz"; // http://eunis.eea.europa.eu/rdf/species.rdf.gz |
58 | 52 |
private static final String LEGALREFS_RDF_FILE_URL = "http://localhost/download/legalrefs.rdf.gz"; // http://eunis.eea.europa.eu/rdf/legalrefs.rdf.gz |
59 | 53 |
private static final String REFERENCES_RDF_FILE_URL = "http://localhost/download/references.rdf.gz"; // http://eunis.eea.europa.eu/rdf/references.rdf.gz |
60 | 54 |
private static final boolean REFRESH_TDB = false; |
61 | 55 |
|
62 |
private static final Class<? extends IQueryClient> clientClass = TinkerPopClient.class; |
|
63 |
|
|
64 |
private static final int MAX_PAGING_LIMIT = 50; |
|
65 |
|
|
66 | 56 |
public static final EnumSet<SearchMode> SEARCH_MODES = EnumSet.of( |
67 | 57 |
SearchMode.scientificNameExact, |
68 | 58 |
SearchMode.scientificNameLike, |
... | ... | |
142 | 132 |
@Override |
143 | 133 |
public void initQueryClient() { |
144 | 134 |
|
145 |
if(SparqlClient.class.isAssignableFrom(clientClass)) { |
|
146 |
if(USE_REMOTE_SERVICE) { |
|
147 |
// use SPARQL end point |
|
148 |
//FIXME queryClient = new SparqlClient(SPARQL_ENDPOINT_URL); |
|
149 |
} else { |
|
150 |
TDBStore tripleStore; |
|
151 |
try { |
|
152 |
tripleStore = new TDBStore(); |
|
153 |
} catch (Exception e1) { |
|
154 |
throw new RuntimeException("Creation of TripleStore failed", e1); |
|
155 |
} |
|
156 |
if(REFRESH_TDB) { |
|
157 |
updateStore(tripleStore); |
|
158 |
} |
|
159 |
//FIXME queryClient = new SparqlClient(tripleStore); |
|
160 |
|
|
135 |
Neo4jStore neo4jStore; |
|
136 |
try { |
|
137 |
neo4jStore = new Neo4jStore(); |
|
138 |
} catch (Exception e1) { |
|
139 |
throw new RuntimeException("Creation of Neo4jStore failed", e1); |
|
161 | 140 |
} |
162 |
} else if(TinkerPopClient.class.isAssignableFrom(clientClass)) { |
|
163 |
if(USE_REMOTE_SERVICE) { |
|
164 |
throw new RuntimeException("USE_REMOTE_SERVICE not suported by QueryClient class "+ clientClass); |
|
165 |
} else { |
|
166 |
Neo4jStore neo4jStore; |
|
167 |
try { |
|
168 |
neo4jStore = new Neo4jStore(); |
|
169 |
} catch (Exception e1) { |
|
170 |
throw new RuntimeException("Creation of Neo4jStore failed", e1); |
|
171 |
} |
|
172 |
if(REFRESH_TDB) { |
|
173 |
updateStore(neo4jStore); |
|
174 |
} |
|
175 |
queryClient = new TinkerPopClient(neo4jStore); |
|
176 |
|
|
141 |
if(REFRESH_TDB) { |
|
142 |
updateStore(neo4jStore); |
|
177 | 143 |
} |
178 |
|
|
179 |
} else { |
|
180 |
throw new RuntimeException("Unsuported QueryClient class "+ clientClass); |
|
181 |
} |
|
144 |
queryClient = new TinkerPopClient(neo4jStore); |
|
182 | 145 |
} |
183 | 146 |
|
184 | 147 |
/** |
Also available in: Unified diff
cleaning up: removing remains from SPARQL client implementations