/** * Returns the name of the vertex label for this vertex. * * @return */ @Override public default String label() { return vertexLabel().name(); }
private static IDManager.VertexIDType getVertexIDType(TitanVertex v) { return getVertexIDType(v.vertexLabel()); }
public boolean matchesConstraint(TitanSchemaType type, TitanElement element) { Preconditions.checkArgument(type != null && element!=null); assert isInstance(element); assert isValidConstraint(type); switch(this) { case VERTEX: return ((TitanVertex)element).vertexLabel().equals(type); case EDGE: return ((TitanEdge)element).edgeLabel().equals(type); case PROPERTY: return ((TitanVertexProperty)element).propertyKey().equals(type); default: throw new IllegalArgumentException(); } }
@Test public void testIndexQueryWithLabelsAndContainsIN() { // This test is based on the steps to reproduce #882 String labelName = "labelName"; VertexLabel label = mgmt.makeVertexLabel(labelName).make(); PropertyKey uid = mgmt.makePropertyKey("uid").dataType(String.class).make(); TitanGraphIndex uidCompositeIndex = mgmt.buildIndex("uidIndex", Vertex.class).indexOnly(label).addKey(uid).unique().buildCompositeIndex(); mgmt.setConsistency(uidCompositeIndex, ConsistencyModifier.LOCK); finishSchema(); TitanVertex foo = graph.addVertex(labelName); TitanVertex bar = graph.addVertex(labelName); foo.property("uid", "foo"); bar.property("uid", "bar"); graph.tx().commit(); Iterable<TitanVertex> vertexes = graph.query() .has("uid", Contain.IN, ImmutableList.of("foo", "bar")) .has(LABEL_NAME, labelName) .vertices(); assertEquals(2, Iterables.size(vertexes)); for (TitanVertex v : vertexes) { assertEquals(labelName, v.vertexLabel().name()); } }
/** * Returns the name of the vertex label for this vertex. * * @return */ @Override public default String label() { return vertexLabel().name(); }
private static IDManager.VertexIDType getVertexIDType(TitanVertex v) { return getVertexIDType(v.vertexLabel()); }
public boolean matchesConstraint(TitanSchemaType type, TitanElement element) { Preconditions.checkArgument(type != null && element!=null); assert isInstance(element); assert isValidConstraint(type); switch(this) { case VERTEX: return ((TitanVertex)element).vertexLabel().equals(type); case EDGE: return ((TitanEdge)element).edgeLabel().equals(type); case PROPERTY: return ((TitanVertexProperty)element).propertyKey().equals(type); default: throw new IllegalArgumentException(); } }