use of nl.knaw.huygens.timbuctoo.search.description.Property in project timbuctoo by HuygensING.
the class PropertyTest method getTraversalReturnsATraversalThatLetsTheParserDetermineTheOrder.
@Test
public void getTraversalReturnsATraversalThatLetsTheParserDetermineTheOrder() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY, "123")).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY, "1234")).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY, "254")).build().traversal().V();
Property instance = Property.localProperty().withName(PROPERTY).withParser(new IntegerParser()).build();
GraphTraversal<?, ?> orderTraversal = instance.getTraversal();
List<Vertex> vertices = traversal.order().by(orderTraversal, Order.incr).toList();
assertThat(vertices, contains(likeVertex().withTimId("id1"), likeVertex().withTimId("id3"), likeVertex().withTimId("id2")));
}
use of nl.knaw.huygens.timbuctoo.search.description.Property in project timbuctoo by HuygensING.
the class FullTextSearchDescription method createLocalFullTextSearchDescriptionWithBackupProperty.
public static FullTextSearchDescription createLocalFullTextSearchDescriptionWithBackupProperty(String name, String propertyName, String backUpPropertyName) {
Property prop1 = localProperty().withName(propertyName).build();
Property prop2 = localProperty().withName(backUpPropertyName).build();
return new FullTextSearchDescription(name, prop1, prop2);
}
use of nl.knaw.huygens.timbuctoo.search.description.Property in project timbuctoo by HuygensING.
the class FullTextSearchDescription method createDerivedFullTextSearchDescriptionWithBackupProperty.
public static FullTextSearchDescription createDerivedFullTextSearchDescriptionWithBackupProperty(String name, String propertyName, String backupPropertyName, String... relations) {
Property prop1 = derivedProperty(relations).withName(propertyName).build();
Property prop2 = derivedProperty(relations).withName(backupPropertyName).build();
return new FullTextSearchDescription(name, prop1, prop2);
}
use of nl.knaw.huygens.timbuctoo.search.description.Property in project timbuctoo by HuygensING.
the class PropertyTest method getTraversalReturnsATraversalThatOrdersByStringValue.
@Test
public void getTraversalReturnsATraversalThatOrdersByStringValue() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY, "123")).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY, "1234")).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY, "254")).build().traversal().V();
Property instance = Property.localProperty().withName(PROPERTY).build();
GraphTraversal<?, ?> orderTraversal = instance.getTraversal();
List<Vertex> vertices = traversal.order().by(orderTraversal, Order.incr).toList();
assertThat(vertices, contains(likeVertex().withTimId("id1"), likeVertex().withTimId("id2"), likeVertex().withTimId("id3")));
}
Aggregations