use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method studies.
@Test
public void studies() throws IOException {
CypherQuery source = new ReportController().studies(null, null);
assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START report = node:reports('source:*') " + "WHERE exists(report.title) " + "RETURN report.citation as study_citation, " + "report.externalId as study_url, " + "report.doi as study_doi, " + "report.source as study_source_citation, " + "report.nInteractions as number_of_interactions, " + "report.nTaxa as number_of_distinct_taxa, " + "report.nStudies as number_of_studies, " + "report.nSources as number_of_sources, " + "report.nTaxaNoMatch as number_of_distinct_taxa_no_match " + "SKIP 0 " + "LIMIT 1024"));
assertThat(source.getParams().size(), is(0));
validate(source);
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method distinctSourceNoPrefix.
@Test
public void distinctSourceNoPrefix() throws IOException {
CypherQuery source = new ReportController().sources("someSourceId", null);
assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START report = node:reports(sourceId={sourceId}) " + "RETURN report.citation as study_citation, " + "report.externalId as study_url, " + "report.doi as study_doi, " + "null as study_source_citation, " + "report.nInteractions as number_of_interactions, " + "report.nTaxa as number_of_distinct_taxa, " + "report.nStudies as number_of_studies, " + "report.nSources as number_of_sources, " + "report.nTaxaNoMatch as number_of_distinct_taxa_no_match, " + "report.sourceId as study_source_id " + "SKIP 0 " + "LIMIT 1024"));
assertThat(source.getParams().get("sourceId"), is("globi:someSourceId"));
validate(source);
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method collections.
@Test
public void collections() throws IOException {
CypherQuery source = new ReportController().collections();
assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START " + "report = node:reports('collection:*') " + "WHERE " + "not(exists(report.title)) " + "RETURN " + "null as study_citation, " + "null as study_url, " + "null as study_doi, " + "null as study_source_citation, " + "report.nInteractions as number_of_interactions, " + "report.nTaxa as number_of_distinct_taxa, " + "report.nStudies as number_of_studies, " + "report.nSources as number_of_sources, " + "report.nTaxaNoMatch as number_of_distinct_taxa_no_match"));
validate(source);
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class ReportControllerTest method distinctSourceOrgName.
@Test
public void distinctSourceOrgName() throws IOException {
CypherQuery source = new ReportController().sourceOrgName("some", "name", null);
assertThat(source.getVersionedQuery(), is(CYPHER_VERSION + "START " + "dataset = node:datasets(namespace={namespace}), " + "report = node:reports('sourceId:*') " + "WHERE ('globi:' + dataset.namespace) = report.sourceId " + "RETURN report.citation as study_citation, " + "report.externalId as study_url, " + "report.doi as study_doi, " + "dataset.citation as study_source_citation, " + "report.nInteractions as number_of_interactions, " + "report.nTaxa as number_of_distinct_taxa, " + "report.nStudies as number_of_studies, " + "report.nSources as number_of_sources, " + "report.nTaxaNoMatch as number_of_distinct_taxa_no_match, " + "report.sourceId as study_source_id, " + "dataset.doi as study_source_doi, " + "dataset.format as study_source_format, " + "dataset.archiveURI as study_source_archive_uri, " + "dataset.lastSeenAt as study_source_last_seen_at " + "SKIP 0 " + "LIMIT 1024"));
assertThat(source.getParams().get("namespace"), is("some/name"));
validate(source);
}
use of org.eol.globi.util.CypherQuery in project eol-globi-data by jhpoelen.
the class TaxonSearchUtilTest method createQueryWithSupportedId2.
@Test
public void createQueryWithSupportedId2() {
CypherQuery query = TaxonSearchUtil.getCypherQuery("http://taxon-concept.plazi.org/id/Animalia/Caridae_Dana_1852", new HashMap());
assertThat(query.getVersionedQuery(), Is.is("CYPHER 2.3 START someTaxon = node:taxons({pathQuery}) MATCH someTaxon-[:SAME_AS*0..1]->taxon WHERE exists(taxon.externalId) WITH DISTINCT(taxon.externalId) as externalId, taxon.externalUrl as externalUrl RETURN externalId as taxon_external_id,externalUrl as taxon_external_url"));
assertThat(query.getParams().toString(), Is.is("{pathQuery=externalId:\"http://taxon-concept.plazi.org/id/Animalia/Caridae_Dana_1852\"}"));
validate(query);
}
Aggregations