return predicate.equals(GraphSONTokens.AND) ? new AndP((List<P>) value) : new OrP((List<P>) value); } else if (predicate.equals(GraphSONTokens.NOT) && value instanceof P) { return P.not((P<?>) value); } else { try {
return predicate.equals(GraphSONTokens.AND) ? new AndP((List<P>) value) : new OrP((List<P>) value); } else if (predicate.equals(GraphSONTokens.NOT) && value instanceof P) { return P.not((P<?>) value); } else { try {
@Override public Traversal<Vertex, Vertex> get_g_VX1X_out_aggregateXxX_out_whereXnotXwithinXaXXX(final Object v1Id) { return g.V(v1Id).out().aggregate("x").out().where(not(within("x"))); }
@Test public void testQueryWithMultiLayerConditions() { HugeGraph graph = graph(); initPersonIndex(false); init5Persons(); List<Object> vertices = graph.traversal().V().hasLabel("person").has( "age", P.not(P.lte(10).and(P.not(P.between(11, 20)))) .and(P.lt(29).or(P.eq(35)).or(P.gt(45))) ).values("name").toList(); Assert.assertEquals(4, vertices.size()); Set<String> names = ImmutableSet.of("Hebe", "James", "Tom Cat", "Lisa"); for (Object name : vertices) { Assert.assertTrue(names.contains(name)); } }
@Override public Traversal<Vertex, Map<String, Object>> get_g_V_asXaX_outXcreatedX_asXbX_inXcreatedX_asXcX_bothXknowsX_bothXknowsX_asXdX_whereXc__notXeqXaX_orXeqXdXXXX_selectXa_b_c_dX() { return g.V().as("a").out("created").as("b").in("created").as("c").both("knows").both("knows").as("d").where("c", P.not(P.eq("a").or(P.eq("d")))).select("a", "b", "c", "d"); }
@Override public Traversal<Vertex, Map<String, Object>> get_g_V_asXaX_out_asXbX_whereXandXasXaX_outXknowsX_asXbX__orXasXbX_outXcreatedX_hasXname_rippleX__asXbX_inXknowsX_count_isXnotXeqX0XXXXX_selectXa_bX() { return g.V().as("a").out().as("b").where(and(as("a").out("knows").as("b"), or(as("b").out("created").has("name", "ripple"), as("b").in("knows").count().is(not(eq(0)))))).select("a", "b"); }
@Override public Traversal<Vertex, String> getClassicRecommendation() { return g.V().has("name", "DARK STAR").as("a").out("followedBy").aggregate("stash"). in("followedBy").where(neq("a").and(P.not(P.within("stash")))). groupCount(). unfold(). project("x", "y", "z"). by(select(keys).values("name")). by(select(keys).values("performances")). by(select(values)). order(). by(select("z"), Order.desc). by(select("y"), Order.asc). limit(5).store("m").select("x"); }
checkResults(Arrays.asList("baltimore", "oakland", "seattle", "aachen"), sg.V().values("location")); sg = g.withStrategies(SubgraphStrategy.build().vertices(has("name", P.not(P.within("stephen", "daniel")))).vertexProperties(has("startTime", P.gt(2005))).create()); checkResults(Arrays.asList("baltimore", "oakland", "seattle"), sg.V().properties("location").value()); checkResults(Arrays.asList("baltimore", "oakland", "seattle"), sg.V().values("location"));
return predicate.equals(GraphSONTokens.AND) ? new AndP((List<P>) value) : new OrP((List<P>) value); } else if (predicate.equals(GraphSONTokens.NOT) && value instanceof P) { return P.not((P<?>) value); } else { try {
return predicate.equals(GraphSONTokens.AND) ? new AndP((List<P>) value) : new OrP((List<P>) value); } else if (predicate.equals(GraphSONTokens.NOT) && value instanceof P) { return P.not((P<?>) value); } else { try {
@Override public Traversal<Vertex, Vertex> get_g_VX1X_out_aggregateXxX_out_whereXnotXwithinXaXXX(final Object v1Id) { return g.V(v1Id).out().aggregate("x").out().where(not(within("x"))); }
@Override public Traversal<Vertex, Map<String, Object>> get_g_V_asXaX_outXcreatedX_asXbX_inXcreatedX_asXcX_bothXknowsX_bothXknowsX_asXdX_whereXc__notXeqXaX_orXeqXdXXXX_selectXa_b_c_dX() { return g.V().as("a").out("created").as("b").in("created").as("c").both("knows").both("knows").as("d").where("c", P.not(P.eq("a").or(P.eq("d")))).select("a", "b", "c", "d"); }
@Override public Traversal<Vertex, Map<String, Object>> get_g_V_asXaX_out_asXbX_whereXandXasXaX_outXknowsX_asXbX__orXasXbX_outXcreatedX_hasXname_rippleX__asXbX_inXknowsX_count_isXnotXeqX0XXXXX_selectXa_bX() { return g.V().as("a").out().as("b").where(and(as("a").out("knows").as("b"), or(as("b").out("created").has("name", "ripple"), as("b").in("knows").count().is(not(eq(0)))))).select("a", "b"); }
@Override public Traversal<Vertex, String> getClassicRecommendation() { return g.V().has("name", "DARK STAR").as("a").out("followedBy").aggregate("stash"). in("followedBy").where(neq("a").and(P.not(P.within("stash")))). groupCount(). unfold(). project("x", "y", "z"). by(select(keys).values("name")). by(select(keys).values("performances")). by(select(values)). order(). by(select("z"), Order.desc). by(select("y"), Order.asc). limit(5).store("m").select("x"); }
checkResults(Arrays.asList("baltimore", "oakland", "seattle", "aachen"), sg.V().values("location")); sg = g.withStrategies(SubgraphStrategy.build().vertices(has("name", P.not(P.within("stephen", "daniel")))).vertexProperties(has("startTime", P.gt(2005))).create()); checkResults(Arrays.asList("baltimore", "oakland", "seattle"), sg.V().properties("location").value()); checkResults(Arrays.asList("baltimore", "oakland", "seattle"), sg.V().values("location"));