use of nl.knaw.huygens.timbuctoo.search.FacetValue in project timbuctoo by HuygensING.
the class RelatedListFacetDescriptionTest method filterAddsNoFilterWhenTheFacetValueHasNoValues.
@Test
public void filterAddsNoFilterWhenTheFacetValueHasNoValues() {
RelatedListFacetDescription instance = new RelatedListFacetDescription(FACET_NAME, PROPERTY, parser, RELATION);
List<FacetValue> facets = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList()));
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("v1", v -> v.withTimId("id1").withProperty(PROPERTY, VALUE1)).withVertex("v2", v -> v.withTimId("id2").withProperty(PROPERTY, VALUE2)).withVertex("v3", v -> v.withTimId("id3").withOutgoingRelation(RELATION, "v1")).withVertex("v4", v -> v.withTimId("id4").withOutgoingRelation(RELATION, "v2")).build().traversal().V();
instance.filter(traversal, facets);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("id1"), likeVertex().withTimId("id2"), likeVertex().withTimId("id3"), likeVertex().withTimId("id4")));
}
use of nl.knaw.huygens.timbuctoo.search.FacetValue in project timbuctoo by HuygensING.
the class RelatedListFacetDescriptionTest method filterAddsAFilterToTheGraphTraversal.
@Test
public void filterAddsAFilterToTheGraphTraversal() {
RelatedListFacetDescription instance = new RelatedListFacetDescription(FACET_NAME, PROPERTY, parser, RELATION);
List<FacetValue> facets = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList(VALUE1)));
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("v1", v -> v.withTimId("id1").withProperty(PROPERTY, VALUE1)).withVertex("v2", v -> v.withTimId("id2").withProperty(PROPERTY, VALUE2)).withVertex("v3", v -> v.withTimId("id3").withOutgoingRelation(RELATION, "v1")).withVertex("v4", v -> v.withTimId("id4").withOutgoingRelation(RELATION, "v2")).build().traversal().V();
instance.filter(traversal, facets);
List<Vertex> vertices = traversal.toList();
assertThat(vertices, contains(likeVertex().withTimId("id3")));
}
use of nl.knaw.huygens.timbuctoo.search.FacetValue in project timbuctoo by HuygensING.
the class RelatedMultiValueListFacetDescriptionTest method filterAddsNoFilterWhenTheFacetValueHasNoValues.
@Test
public void filterAddsNoFilterWhenTheFacetValueHasNoValues() {
RelatedMultiValueListFacetDescription instance = new RelatedMultiValueListFacetDescription(FACET_NAME, PROPERTY, RELATION);
List<FacetValue> facets = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList()));
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("v1", v -> v.withTimId("id1").withProperty(PROPERTY, VALUE1)).withVertex("v2", v -> v.withTimId("id2").withProperty(PROPERTY, VALUE2)).withVertex("v3", v -> v.withTimId("id3").withOutgoingRelation(RELATION, "v1")).withVertex("v4", v -> v.withTimId("id4").withOutgoingRelation(RELATION, "v2")).build().traversal().V();
instance.filter(traversal, facets);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("id1"), likeVertex().withTimId("id2"), likeVertex().withTimId("id3"), likeVertex().withTimId("id4")));
}
use of nl.knaw.huygens.timbuctoo.search.FacetValue 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.search.FacetValue 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