@Override public EdgeLabel getEdgeLabel(String name) { RelationType el = getRelationType(name); Preconditions.checkArgument(el==null || el.isEdgeLabel(), "The relation type with name [%s] is not an edge label",name); return (EdgeLabel)el; }
@Override public boolean containsEdgeLabel(String name) { RelationType type = getRelationType(name); return type!=null && type.isEdgeLabel(); }
@Override public EdgeLabel getOrCreateEdgeLabel(String name) { RelationType et = getRelationType(name); if (et == null) { return config.getAutoSchemaMaker().makeEdgeLabel(makeEdgeLabel(name)); } else if (et.isEdgeLabel()) { return (EdgeLabel) et; } else throw new IllegalArgumentException("The type of given name is not a label: " + name); }
if (type.isEdgeLabel()) { StandardEdgeLabelMaker lm = (StandardEdgeLabelMaker) transaction.makeEdgeLabel(composedName); lm.unidirected(direction);
RelationType type = tx.getRelationType("test" + i); if (i < numTypes / 2) assertTrue(type.isPropertyKey()); else assertTrue(type.isEdgeLabel());
JanusGraphRelation findRelation(JanusGraphTransaction tx) { JanusGraphVertex v = ((StandardJanusGraphTx)tx).getInternalVertex(outVertexId); if (v == null || v.isRemoved()) return null; JanusGraphVertex typeVertex = tx.getVertex(typeId); if (typeVertex == null) return null; if (!(typeVertex instanceof RelationType)) throw new IllegalArgumentException("Invalid RelationIdentifier: typeID does not reference a type"); RelationType type = (RelationType) typeVertex; Iterable<? extends JanusGraphRelation> relations; if (((RelationType) typeVertex).isEdgeLabel()) { Direction dir = Direction.OUT; JanusGraphVertex other = ((StandardJanusGraphTx)tx).getInternalVertex(inVertexId); if (other==null || other.isRemoved()) return null; if (((StandardJanusGraphTx) tx).isPartitionedVertex(v) && !((StandardJanusGraphTx) tx).isPartitionedVertex(other)) { //Swap for likely better performance JanusGraphVertex tmp = other; other = v; v = tmp; dir = Direction.IN; } relations = ((VertexCentricQueryBuilder) v.query()).noPartitionRestriction().types((EdgeLabel) type).direction(dir).adjacent(other).edges(); } else { relations = ((VertexCentricQueryBuilder) v.query()).noPartitionRestriction().types((PropertyKey) type).properties(); } for (JanusGraphRelation r : relations) { //Find current or previous relation if (r.longId() == relationId || ((r instanceof StandardRelation) && ((StandardRelation) r).getPreviousID() == relationId)) return r; } return null; }
int startKeyPos = in.getPosition(); int endKeyPos = 0; if (relationType.isEdgeLabel()) { long otherVertexId; if (multiplicity.isConstrained()) {
tv.property(card, type.name(), value, T.id, relation.relationId); } else { assert type.isEdgeLabel();
tv.property(card, type.name(), value, T.id, relation.relationId); } else { assert type.isEdgeLabel();