private Edge getEdge(final Object id1, final Object id2) { return g.V(id1) .bothE().filter(__.otherV().hasId(id2)) .next(); } }
assertNumStep(5, 1, gts.V(sv[0]).local(__.outE("knows").has("weight", 1).has("weight", 1).order().by("weight", incr).range(10, 15)), LocalStep.class); assertNumStep(1, 1, gts.V(sv[0]).outE("knows").filter(__.inV().is(vs[50])), TitanVertexStep.class); assertNumStep(1, 1, gts.V(sv[0]).outE("knows").filter(__.otherV().is(vs[50])), TitanVertexStep.class); assertNumStep(1, 1, gts.V(sv[0]).bothE("knows").filter(__.otherV().is(vs[50])), TitanVertexStep.class); assertNumStep(1, 2, gts.V(sv[0]).bothE("knows").filter(__.inV().is(vs[50])), TitanVertexStep.class, TraversalFilterStep.class);
assertNumStep(1, 1, gts.V(sv[0]).outE("knows").filter(__.otherV().is(vs[50])), JanusGraphVertexStep.class); assertNumStep(1, 1, gts.V(sv[0]).bothE("knows").filter(__.otherV().is(vs[50])), JanusGraphVertexStep.class); assertNumStep(1, 2, gts.V(sv[0]).bothE("knows").filter(__.inV().is(vs[50])), JanusGraphVertexStep.class, TraversalFilterStep.class);
private Edge getEdge(final Object id1, final Object id2) { return g.V(id1) .bothE().filter(__.otherV().hasId(id2)) .next(); } }
private void retractPredicateAndValueType(RdfProperty property, Vertex entity) { traversal.V(entity.id()).inE(Collection.APPLIES_TO_RELATION_NAME ).where(__.otherV().has("typeUri", property.getTypeUri())).forEachRemaining( edge -> { Vertex valueType = edge.outVertex(); edge.remove(); if (!valueType.edges(Direction.OUT, Collection.APPLIES_TO_RELATION_NAME).hasNext()) { Vertex predicateVertex = traversal.V(valueType.id()).in(Collection.HAS_VALUE_TYPE_RELATION_NAME) .has("predicateUri", property.getPredicateUri()) .next(); valueType.edges(Direction.IN, Collection.HAS_VALUE_TYPE_RELATION_NAME).forEachRemaining( valueTypeEdge -> valueType.remove() ); if (!predicateVertex.edges(Direction.OUT, Collection.HAS_VALUE_TYPE_RELATION_NAME).hasNext()) { predicateVertex.edges(Direction.BOTH).forEachRemaining( predicateEdge -> predicateEdge.remove() ); predicateVertex.remove(); } valueType.remove(); } }); }