Revision 50781539
Added by Andreas Kohlbecker over 8 years ago
src/main/java/org/cybertaxonomy/utis/checklist/EEA_BDC_Client.java | ||
---|---|---|
46 | 46 |
public static final String DOC_URL = "http://semantic.eea.europa.eu/documentation"; |
47 | 47 |
public static final String COPYRIGHT_URL = "http://www.eea.europa.eu/legal/eea-data-policy"; |
48 | 48 |
|
49 |
private static final String SPECIES_RDF_FILE_URL = "http://localhost/download/species.rdf.gz"; // http://eunis.eea.europa.eu/rdf/species.rdf.gz |
|
50 |
private static final String TAXONOMY_RDF_FILE_URL = "http://localhost/download/taxonomy.rdf.gz"; // http://eunis.eea.europa.eu/rdf/taxonomy.rdf.gz |
|
51 |
private static final String LEGALREFS_RDF_FILE_URL = "http://localhost/download/legalrefs.rdf.gz"; // http://eunis.eea.europa.eu/rdf/legalrefs.rdf.gz |
|
52 |
private static final String REFERENCES_RDF_FILE_URL = "http://localhost/download/references.rdf.gz"; // http://eunis.eea.europa.eu/rdf/references.rdf.gz |
|
49 |
// private static final String DOWNLOAD_BASE_URL = "http://localhost/download/"; |
|
50 |
private static final String DOWNLOAD_BASE_URL = "http://eunis.eea.europa.eu/rdf/"; |
|
51 |
|
|
52 |
private static final String SPECIES_RDF_FILE_URL = DOWNLOAD_BASE_URL + "species.rdf.gz"; |
|
53 |
private static final String TAXONOMY_RDF_FILE_URL = DOWNLOAD_BASE_URL + "taxonomy.rdf.gz"; |
|
54 |
private static final String LEGALREFS_RDF_FILE_URL = DOWNLOAD_BASE_URL + "legalrefs.rdf.gz"; |
|
55 |
private static final String REFERENCES_RDF_FILE_URL = DOWNLOAD_BASE_URL + "references.rdf.gz"; |
|
53 | 56 |
|
54 | 57 |
/** |
55 | 58 |
* check for updates once a day |
... | ... | |
384 | 387 |
|
385 | 388 |
GremlinPipeline<Graph, Vertex> pipe = null; |
386 | 389 |
|
387 |
Profiler profiler = Profiler.newCpuProfiler(false); |
|
390 |
// Profiler profiler = Profiler.newCpuProfiler(false);
|
|
388 | 391 |
|
389 | 392 |
logger.debug("Neo4jINDEX"); |
390 | 393 |
|
... | ... | |
392 | 395 |
pipe = new GremlinPipeline<Graph, Vertex>(hitVs); |
393 | 396 |
|
394 | 397 |
List<Vertex> vertices = new ArrayList<Vertex>(); |
395 |
pipe.in(RdfSchema.EUNIS_SPECIES.property("binomialName")).fill(vertices); |
|
398 |
pipe.in(RdfSchema.EUNIS_SPECIES.property("binomialName"), |
|
399 |
RdfSchema.DWC.property("subgenus"), // EUNIS has no subgenera but this is added for future compatibility |
|
400 |
RdfSchema.DWC.property("genus") |
|
401 |
// no taxa for higher ranks in EUNIS |
|
402 |
).fill(vertices); |
|
396 | 403 |
|
397 | 404 |
updateQueriesWithResponse(vertices, null, null, checklistInfo, query); |
398 |
profiler.end(System.err); |
|
405 |
// profiler.end(System.err);
|
|
399 | 406 |
} |
400 | 407 |
} |
401 | 408 |
|
src/main/java/org/cybertaxonomy/utis/query/TinkerPopClient.java | ||
---|---|---|
202 | 202 |
public ArrayList<Vertex> vertexIndexQuery(String luceneQuery) { |
203 | 203 |
Neo4j2Graph graph = (Neo4j2Graph)graph(); |
204 | 204 |
AutoIndexer<Node> nodeAutoIndex = graph.getRawGraph().index().getNodeAutoIndexer(); |
205 |
graph.autoStartTransaction(false); |
|
205 | 206 |
IndexHits<Node> nodes = nodeAutoIndex.getAutoIndex().query(luceneQuery); |
206 | 207 |
ArrayList<Vertex> hitVs = new ArrayList<Vertex>(); |
207 | 208 |
while(nodes.hasNext()) { |
208 | 209 |
hitVs.add(new Neo4j2Vertex(nodes.next(), graph)); |
209 | 210 |
} |
211 |
graph.commit(); |
|
210 | 212 |
return hitVs; |
211 | 213 |
} |
212 | 214 |
|
src/main/java/org/cybertaxonomy/utis/store/Store.java | ||
---|---|---|
35 | 35 |
*/ |
36 | 36 |
public abstract class Store { |
37 | 37 |
|
38 |
protected Logger logger = LoggerFactory.getLogger(Neo4jStore.class);
|
|
38 |
protected Logger logger = LoggerFactory.getLogger(Store.class); |
|
39 | 39 |
private static final File tmpDir = new File(System.getProperty("java.io.tmpdir")); |
40 | 40 |
private static final File userHomeDir = new File(System.getProperty("user.home")); |
41 | 41 |
private static final File utisHome = new File(userHomeDir, ".utis"); |
src/test/java/org/cybertaxonomy/utis/checklist/EEA_BDC_ClientTest.java | ||
---|---|---|
3 | 3 |
import static org.junit.Assert.assertEquals; |
4 | 4 |
import static org.junit.Assert.assertTrue; |
5 | 5 |
|
6 |
import org.cybertaxonomy.utis.checklist.DRFChecklistException; |
|
7 |
import org.cybertaxonomy.utis.checklist.EEA_BDC_Client; |
|
8 |
import org.cybertaxonomy.utis.checklist.SearchMode; |
|
9 | 6 |
import org.cybertaxonomy.utis.tnr.msg.Classification; |
10 | 7 |
import org.cybertaxonomy.utis.tnr.msg.NameType; |
11 | 8 |
import org.cybertaxonomy.utis.tnr.msg.Response; |
... | ... | |
59 | 56 |
assertEquals("Animalia", c.getKingdom()); |
60 | 57 |
} |
61 | 58 |
|
59 |
@Test |
|
60 |
public void genus_Test() throws DRFChecklistException, TnrMsgException { |
|
61 |
|
|
62 |
TnrMsg tnrMsg = TnrMsgUtils.createRequest(SearchMode.scientificNameExact, "Prionus", true); |
|
63 |
client.queryChecklist(tnrMsg); |
|
64 |
String outputXML = TnrMsgUtils.convertTnrMsgToXML(tnrMsg); |
|
65 |
System.out.println(outputXML); |
|
66 |
assertEquals(8, tnrMsg.getQuery().get(0).getResponse().size()); |
|
67 |
Response response = tnrMsg.getQuery().get(0).getResponse().get(0); |
|
68 |
assertEquals("Prionus", response.getMatchingNameString()); |
|
69 |
assertEquals("Prionus", response.getTaxon().getTaxonName().getCanonicalName()); |
|
70 |
Classification c = response.getTaxon().getClassification(); |
|
71 |
assertEquals("Cerambycidae", c.getFamily()); |
|
72 |
assertEquals("Coleoptera", c.getOrder()); |
|
73 |
assertEquals("Arthropoda", c.getPhylum()); |
|
74 |
assertEquals("Animalia", c.getKingdom()); |
|
75 |
} |
|
76 |
|
|
77 |
|
|
78 |
@Test |
|
79 |
public void family_Test() throws DRFChecklistException, TnrMsgException { |
|
80 |
|
|
81 |
TnrMsg tnrMsg = TnrMsgUtils.createRequest(SearchMode.scientificNameExact, "Cerambycidae", true); |
|
82 |
client.queryChecklist(tnrMsg); |
|
83 |
String outputXML = TnrMsgUtils.convertTnrMsgToXML(tnrMsg); |
|
84 |
System.out.println(outputXML); |
|
85 |
assertTrue(tnrMsg.getQuery().get(0).getResponse().size() > 20); |
|
86 |
Response response = tnrMsg.getQuery().get(0).getResponse().get(0); |
|
87 |
Classification c = response.getTaxon().getClassification(); |
|
88 |
assertEquals("Cerambycidae", c.getFamily()); |
|
89 |
assertEquals("Coleoptera", c.getOrder()); |
|
90 |
assertEquals("Arthropoda", c.getPhylum()); |
|
91 |
assertEquals("Animalia", c.getKingdom()); |
|
92 |
} |
|
93 |
|
|
62 | 94 |
@Test |
63 | 95 |
public void scientificNameLikeTest_1() throws DRFChecklistException, TnrMsgException { |
64 | 96 |
String queryString = "Cani"; |
Also available in: Unified diff
easier switching between rdf download locations & adding support for genus resolution