use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.DateRangeFacetValue in project timbuctoo by HuygensING.
the class RelatedDatableRangeFacetDescriptionTest method filterAddFiltersTheVertices.
@Test
public void filterAddFiltersTheVertices() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("target1", v -> v.withTimId("id4").withProperty(PROPERTY_NAME, asSerializedDatable("2015-01"))).withVertex("target2", v -> v.withTimId("id5").withProperty(PROPERTY_NAME, asSerializedDatable("0015-01"))).withVertex("target3", v -> v.withTimId("id6").withProperty(PROPERTY_NAME, asSerializedDatable("0190-01"))).withVertex("source1", v -> v.withTimId("id1").withOutgoingRelation(RELATION, "target1")).withVertex("source2", v -> v.withTimId("id2").withOutgoingRelation(RELATION, "target2")).withVertex("source3", v -> v.withTimId("id3").withOutgoingRelation(RELATION, "target3")).build().traversal().V();
List<FacetValue> facetValues = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 101101L, 10001231L));
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("id2"), likeVertex().withTimId("id3")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.DateRangeFacetValue in project timbuctoo by HuygensING.
the class RelatedDatableRangeFacetDescriptionTest method filterIncludesTheVerticesWhereOnlyTheStartFallsInTheRange.
@Test
public void filterIncludesTheVerticesWhereOnlyTheStartFallsInTheRange() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("target1", v -> v.withTimId("id4").withProperty(PROPERTY_NAME, asSerializedDatable("2015/2020"))).withVertex("target2", v -> v.withTimId("id5").withProperty(PROPERTY_NAME, asSerializedDatable("0015-01"))).withVertex("target3", v -> v.withTimId("id6").withProperty(PROPERTY_NAME, asSerializedDatable("0190-01"))).withVertex("source1", v -> v.withTimId("id1").withOutgoingRelation(RELATION, "target1")).withVertex("source2", v -> v.withTimId("id2").withOutgoingRelation(RELATION, "target2")).withVertex("source3", v -> v.withTimId("id3").withOutgoingRelation(RELATION, "target3")).build().traversal().V();
List<FacetValue> facetValues = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 20140101L, 20160101L));
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), contains(likeVertex().withTimId("id1")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.DateRangeFacetValue in project timbuctoo by HuygensING.
the class RelatedDatableRangeFacetDescriptionTest method filterAddsAFilterThatIgnoresInvalidDatables.
@Test
public void filterAddsAFilterThatIgnoresInvalidDatables() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("target1", v -> v.withTimId("id4").withProperty(PROPERTY_NAME, asSerializedDatable("2015-01"))).withVertex("target2", v -> v.withTimId("id5").withProperty(PROPERTY_NAME, asSerializedDatable("invalid"))).withVertex("target3", v -> v.withTimId("id6").withProperty(PROPERTY_NAME, asSerializedDatable("0190-01"))).withVertex("source1", v -> v.withTimId("id1").withOutgoingRelation(RELATION, "target1")).withVertex("source2", v -> v.withTimId("id2").withOutgoingRelation(RELATION, "target2")).withVertex("source3", v -> v.withTimId("id3").withOutgoingRelation(RELATION, "target3")).build().traversal().V();
List<FacetValue> facets = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 20151001L, 20160101L));
instance.filter(traversal, facets);
assertThat(traversal.toList(), contains(likeVertex().withTimId("id1")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.DateRangeFacetValue in project timbuctoo by HuygensING.
the class DatableRangeFacetDescriptionTest method filterAddFiltersTheVertices.
@Test
public void filterAddFiltersTheVertices() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY_NAME, asSerializedDatable("2015-01"))).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY_NAME, asSerializedDatable("0015-01"))).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY_NAME, asSerializedDatable("0190-01"))).build().traversal().V();
List<FacetValue> facetValues = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, 101101L, 10001231L));
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("id2"), likeVertex().withTimId("id3")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.DateRangeFacetValue in project timbuctoo by HuygensING.
the class DutchCaribbeanArchiveAndArchiverPeriodFacetDescriptionTest method shouldContainNothing.
private void shouldContainNothing(GraphTraversal<Vertex, Vertex> traversal, long startYear, long endYear) {
List<FacetValue> facetValues = Lists.newArrayList(new DateRangeFacetValue(FACET_NAME, startYear * 10_000, endYear * 10_000));
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), empty());
}
Aggregations