public Iterable<? extends Element> sortOnCount() { // --------------------------------------------------------- final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new Sort.Builder() .comparators(new ElementPropertyComparator.Builder() .groups("entity", "edge") .property("count") .reverse(false) .build()) .resultLimit(10) .build()) .build(); // --------------------------------------------------------- return runExample(opChain, null); }
public Iterable<?> extractDestinationVertex() { // --------------------------------------------------------- final OperationChain<Set<?>> opChain = new Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.OUTGOING) .view(new View.Builder() .edge("edge") .build()) .build()) .then(new ToVertices.Builder() .edgeVertices(ToVertices.EdgeVertices.DESTINATION) .build()) .then(new ToSet<>()) .build(); // --------------------------------------------------------- return runExample(opChain, null); }
public CloseableIterable<? extends Element> getEntitiesRelatedTo2WithCountLessThan2OrMoreThan5() { // --------------------------------------------------------- final GetElements operation = new GetElements.Builder() .input(new EntitySeed(2), new EdgeSeed(2, 3, DirectedType.EITHER)) .view(new View.Builder() .entity("entity", new ViewElementDefinition.Builder() .preAggregationFilter( new ElementFilter.Builder() .select("count") .execute(new Or<>(new IsLessThan(2), new IsMoreThan(5))) .build()) .build()) .build()) .build(); // --------------------------------------------------------- return runExample(operation, "When using an Or predicate with a single selected value you can just do 'select(propertyName)' then 'execute(new Or(predicates))'"); }
public Iterable<? extends Element> sortOnCountWithoutDeduplicating() { // --------------------------------------------------------- final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new Sort.Builder() .comparators(new ElementPropertyComparator.Builder() .groups("entity", "edge") .property("count") .reverse(false) .build()) .resultLimit(10) .deduplicate(false) .build()) .build(); // --------------------------------------------------------- return runExample(opChain, "Deduplication is true by default."); }
public Iterable<? extends Map<String, Object>> toMapExample() { // --------------------------------------------------------- final OperationChain<Iterable<? extends Map<String, Object>>> opChain = new Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new ToMap.Builder() .generator(new MapGenerator.Builder() .group("group") .vertex("vertex") .source("source") .property("count", "total count") .build()) .build()) .build(); // --------------------------------------------------------- return runExample(opChain, null); } }
public Iterable<?> extractEntityVertices() { // --------------------------------------------------------- final OperationChain<Set<?>> opChain = new Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .view(new View.Builder() .entity("entity") .build()) .build()) .then(new ToVertices.Builder() .edgeVertices(ToVertices.EdgeVertices.NONE) .build()) .then(new ToSet<>()) .build(); // --------------------------------------------------------- return runExample(opChain, null); }
public Element minCount() { // --------------------------------------------------------- final OperationChain<Element> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new Min.Builder() .comparators(new ElementPropertyComparator.Builder() .groups("entity", "edge") .property("count") .build()) .build()) .build(); // --------------------------------------------------------- return runExample(opChain, null); }
public Element maxCount() { // --------------------------------------------------------- final OperationChain<Element> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new Max.Builder() .comparators(new ElementPropertyComparator.Builder() .groups("entity", "edge") .property("count") .build()) .build()) .build(); // --------------------------------------------------------- return runExample(opChain, null); }
public Set<? extends Element> withToSetOperation() { // --------------------------------------------------------- final OperationChain<Set<? extends Element>> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new ToSet<>()) .build(); // --------------------------------------------------------- return runExample(opChain, null); } }
public Stream<? extends Element> toStreamExample() { // --------------------------------------------------------- final OperationChain<Stream<? extends Element>> opChain = new Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new ToStream<>()) .build(); // --------------------------------------------------------- return runExample(opChain, null); } }
public CloseableIterable<? extends Element> withoutToSetOperation() { // --------------------------------------------------------- final GetElements operation = new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build(); // --------------------------------------------------------- return runExample(operation, null); }
public Element[] toArrayExample() { // --------------------------------------------------------- final OperationChain<? extends Element[]> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new ToArray<>()) .build(); // --------------------------------------------------------- return runExample(opChain, null); } }
public CloseableIterable<Element> getEntitiesAndEdgesByEntitySeed2AndEdgeSeed2to3() { // --------------------------------------------------------- final GetElements<ElementSeed, Element> operation = new GetElements.Builder<>() .addSeed(new EntitySeed(2)) .addSeed(new EdgeSeed(2, 3, true)) .build(); // --------------------------------------------------------- return runExample(operation); }
public CloseableIterable<Element> getEntitiesAndEdgesThatAreRelatedToVertex2() { // --------------------------------------------------------- final GetElements<EntitySeed, Element> operation = new GetElements.Builder<EntitySeed, Element>() .addSeed(new EntitySeed(2)) .build(); // --------------------------------------------------------- return runExample(operation); }
public CloseableIterable<? extends Element> getAllEntitiesAndEdgesThatAreRelatedToEdge1to2() { // --------------------------------------------------------- final GetElements operation = new GetElements.Builder() .input(new EdgeSeed(1, 2, DirectedType.EITHER)) .build(); // --------------------------------------------------------- return runExample(operation, null); }
public Iterable<? extends EntitySeed> toStreamExample() { // --------------------------------------------------------- final OperationChain<Iterable<? extends EntitySeed>> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new ToEntitySeeds()) .build(); // --------------------------------------------------------- return runExample(opChain, null); } }
public List<? extends Element> toListExample() { // --------------------------------------------------------- final OperationChain<List<? extends Element>> opChain = new OperationChain.Builder() .first(new GetElements.Builder() .input(new EntitySeed(1), new EntitySeed(2)) .build()) .then(new ToList<>()) .build(); // --------------------------------------------------------- return runExample(opChain, null); } }
public CloseableIterable<Element> getAllEntitiesAndEdgesThatAreRelatedToEdge1to2() { // --------------------------------------------------------- final GetElements<EdgeSeed, Element> operation = new GetElements.Builder<EdgeSeed, Element>() .addSeed(new EdgeSeed(1, 2, true)) .build(); // --------------------------------------------------------- return runExample(operation); }
public CloseableIterable<? extends Element> getEntitiesAndEdgesByEntityId2AndEdgeId2to3() { // --------------------------------------------------------- final GetElements operation = new GetElements.Builder() .input(new EntitySeed(2), new EdgeSeed(2, 3, DirectedType.EITHER)) .build(); // --------------------------------------------------------- return runExample(operation, null); }
public CloseableIterable<? extends Element> getEntitiesAndEdgesThatAreRelatedToVertex2() { // --------------------------------------------------------- final GetElements operation = new GetElements.Builder() .input(new EntitySeed(2)) .build(); // --------------------------------------------------------- return runExample(operation, null); }