Java Code Examples for org.apache.tinkerpop.gremlin.structure.Direction#BOTH
The following examples show how to use
org.apache.tinkerpop.gremlin.structure.Direction#BOTH .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AtlasJanusObjectFactory.java From atlas with Apache License 2.0 | 5 votes |
/** * Retrieves the Janus direction corresponding to the given * AtlasEdgeDirection. * * @param dir * @return */ public static Direction createDirection(AtlasEdgeDirection dir) { switch(dir) { case IN: return Direction.IN; case OUT: return Direction.OUT; case BOTH: return Direction.BOTH; default: throw new RuntimeException("Unrecognized direction: " + dir); } }
Example 2
Source File: DirectionCondition.java From grakn with GNU Affero General Public License v3.0 | 5 votes |
@Override public boolean evaluate(E element) { if (direction == Direction.BOTH) return true; if (element instanceof CacheEdge) { return direction == ((CacheEdge) element).getVertexCentricDirection(); } else if (element instanceof JanusGraphEdge) { return ((JanusGraphEdge) element).vertex(direction).equals(baseVertex); } else if (element instanceof JanusGraphVertexProperty) { return direction == Direction.OUT; } return false; }
Example 3
Source File: RelationTypeIndexWrapper.java From titan1withtp3.1 with Apache License 2.0 | 5 votes |
@Override public Direction getDirection() { if (type.isUnidirected(Direction.BOTH)) return Direction.BOTH; else if (type.isUnidirected(Direction.OUT)) return Direction.OUT; else if (type.isUnidirected(Direction.IN)) return Direction.IN; throw new AssertionError(); }
Example 4
Source File: RelationTypeIndexWrapper.java From grakn with GNU Affero General Public License v3.0 | 5 votes |
@Override public Direction getDirection() { if (type.isUnidirected(Direction.BOTH)) { return Direction.BOTH; } else if (type.isUnidirected(Direction.OUT)) { return Direction.OUT; } else if (type.isUnidirected(Direction.IN)) { return Direction.IN; } throw new AssertionError(); }
Example 5
Source File: JavaTypeIllegalVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Incidence(label = "implements", direction = Direction.BOTH) public void addImplementsTwoDirectionsEdge(ClassInitializer<? extends JavaInterfaceVertex> vertexInitializer);
Example 6
Source File: JavaClassVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "implements", direction = Direction.BOTH, operation = Adjacency.Operation.GET) List<VertexFrame> getImplementedInterfacesVertexFramesBothList();
Example 7
Source File: StandardEdgeLabelMaker.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
@Override public StandardEdgeLabelMaker directed() { unidirectionality = Direction.BOTH; return this; }
Example 8
Source File: JavaClassVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "implements", direction = Direction.BOTH, operation = Adjacency.Operation.GET) <V extends JavaInterfaceVertex> Set<V> getImplementedInterfacesBothSet(Class<V> types);
Example 9
Source File: BaseVertexCentricQuery.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
/** * Construct an empty query */ protected BaseVertexCentricQuery() { this(new FixedCondition<TitanRelation>(false), Direction.BOTH, new ArrayList<BackendQueryHolder<SliceQuery>>(0),OrderList.NO_ORDER,0); }
Example 10
Source File: JavaClassVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "implements", direction = Direction.BOTH, operation = Adjacency.Operation.GET) VertexFrame getAnyImplementedInterfaceBoth();
Example 11
Source File: ComputerVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "connects", direction = Direction.BOTH) VertexFrame addAndConnectBothDefault();
Example 12
Source File: JavaTypeIllegalVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Incidence(label = "extends", direction = Direction.BOTH) public void addExtendsBothDirections(JavaClassVertex other, ClassInitializer<? extends ExtendsEdge> edgeInitializer);
Example 13
Source File: JavaClassVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "implements", direction = Direction.BOTH, operation = Adjacency.Operation.GET) <V extends JavaInterfaceVertex> List<V> getImplementedInterfacesBothList(Class<V> types);
Example 14
Source File: ComputerVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "connects", direction = Direction.BOTH) <V extends NetworkDeviceVertex> V addAndConnectBoth(V vertex);
Example 15
Source File: JavaInterfaceVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Incidence(label = "implements", direction = Direction.BOTH, operation = Incidence.Operation.GET) EdgeFrame getAnyImplementsEdge();
Example 16
Source File: EdgeSerializer.java From grakn with GNU Affero General Public License v3.0 | 4 votes |
public SliceQuery getQuery(InternalRelationType type, Direction dir, TypedInterval[] sortKey) { Preconditions.checkNotNull(type); Preconditions.checkNotNull(dir); Preconditions.checkArgument(type.isUnidirected(Direction.BOTH) || type.isUnidirected(dir)); StaticBuffer sliceStart = null, sliceEnd = null; RelationCategory rt = type.isPropertyKey() ? RelationCategory.PROPERTY : RelationCategory.EDGE; if (dir == Direction.BOTH) { sliceStart = IDHandler.getRelationType(type.longId(), getDirID(Direction.OUT, rt), type.isInvisibleType()); sliceEnd = IDHandler.getRelationType(type.longId(), getDirID(Direction.IN, rt), type.isInvisibleType()); sliceEnd = BufferUtil.nextBiggerBuffer(sliceEnd); } else { DirectionID dirID = getDirID(dir, rt); DataOutput colStart = serializer.getDataOutput(DEFAULT_COLUMN_CAPACITY); DataOutput colEnd = serializer.getDataOutput(DEFAULT_COLUMN_CAPACITY); IDHandler.writeRelationType(colStart, type.longId(), dirID, type.isInvisibleType()); IDHandler.writeRelationType(colEnd, type.longId(), dirID, type.isInvisibleType()); long[] sortKeyIDs = type.getSortKey(); Preconditions.checkArgument(sortKey.length >= sortKeyIDs.length); int keyStartPos = colStart.getPosition(); int keyEndPos = -1; for (int i = 0; i < sortKey.length && sortKey[i] != null; i++) { PropertyKey propertyKey = sortKey[i].key; Interval interval = sortKey[i].interval; if (i >= sortKeyIDs.length) { keyEndPos = colStart.getPosition(); } if (interval == null || interval.isEmpty()) { break; // lol, beaut } if (interval.isPoints()) { if (propertyKey == ImplicitKey.JANUSGRAPHID || propertyKey == ImplicitKey.ADJACENT_ID) { VariableLong.writePositiveBackward(colStart, (Long) interval.getStart()); VariableLong.writePositiveBackward(colEnd, (Long) interval.getEnd()); } else { writeInline(colStart, propertyKey, interval.getStart(), InlineType.KEY); writeInline(colEnd, propertyKey, interval.getEnd(), InlineType.KEY); } } else { if (interval.getStart() != null) { writeInline(colStart, propertyKey, interval.getStart(), InlineType.KEY); } if (interval.getEnd() != null) { writeInline(colEnd, propertyKey, interval.getEnd(), InlineType.KEY); } switch (type.getSortOrder()) { case ASC: sliceStart = colStart.getStaticBuffer(); sliceEnd = colEnd.getStaticBuffer(); if (!interval.startInclusive()) sliceStart = BufferUtil.nextBiggerBuffer(sliceStart); if (interval.endInclusive()) sliceEnd = BufferUtil.nextBiggerBuffer(sliceEnd); break; case DESC: sliceEnd = colStart.getStaticBufferFlipBytes(keyStartPos, colStart.getPosition()); sliceStart = colEnd.getStaticBufferFlipBytes(keyStartPos, colEnd.getPosition()); if (interval.startInclusive()) sliceEnd = BufferUtil.nextBiggerBuffer(sliceEnd); if (!interval.endInclusive()) sliceStart = BufferUtil.nextBiggerBuffer(sliceStart); break; default: throw new AssertionError(type.getSortOrder().toString()); } break; } } if (sliceStart == null) { if (keyEndPos < 0) keyEndPos = colStart.getPosition(); switch (type.getSortOrder()) { case ASC: sliceStart = colStart.getStaticBuffer(); break; case DESC: sliceStart = colStart.getStaticBufferFlipBytes(keyStartPos, keyEndPos); break; default: throw new AssertionError(type.getSortOrder().toString()); } sliceEnd = BufferUtil.nextBiggerBuffer(sliceStart); } } return new SliceQuery(sliceStart, sliceEnd); }
Example 17
Source File: EdgeDirection.java From titan1withtp3.1 with Apache License 2.0 | 4 votes |
public static boolean impliedBy(Direction sub, Direction sup) { return sup==sub || sup==Direction.BOTH; }
Example 18
Source File: ComputerVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "connects", direction = Direction.BOTH) <T extends NetworkDeviceVertex> void setTwoWayConnectionsWithIterable(Iterable<T> connectees);
Example 19
Source File: ComputerVertex.java From Ferma with Apache License 2.0 | 4 votes |
@Adjacency(label = "connects", direction = Direction.BOTH) <V extends ComputerVertex, E extends NetworkConnectionEdge> V addAndConnectBothVertexTypedEdgeTyped( ClassInitializer<V> vertexInitializer, ClassInitializer<E> edgeInitializer);
Example 20
Source File: ShortestPathQueryBuilder.java From graph-examples with Apache License 2.0 | 4 votes |
public ShortestPathQueryBuilder(GraphTraversal<S, E> traversal) { this.traversal = traversal; this.direction = Direction.BOTH; this.edgeLabels = new String[0]; }