public VertexLabelDefinition(VertexLabel vl) { this(vl.name(),vl.longId(),vl.isPartitioned(),vl.isStatic()); }
private static IDManager.VertexIDType getVertexIDType(VertexLabel vlabel) { if (vlabel.isPartitioned()) { return IDManager.VertexIDType.PartitionedVertex; } else if (vlabel.isStatic()) { return IDManager.VertexIDType.UnmodifiableVertex; } else { return IDManager.VertexIDType.NormalVertex; } }
assertEquals(3, Iterables.size(mgmt.getVertexLabels())); assertEquals("tweet", tweet.name()); assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic()); assertEquals(3, Iterables.size(mgmt.getVertexLabels())); assertEquals("tweet", tweet.name()); assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic());
/** * Returns the name of the vertex label for this vertex. * * @return */ @Override public default String label() { return vertexLabel().name(); }
public VertexLabelDefinition(VertexLabel vl) { this(vl.getName(),vl.getLongId(),vl.isPartitioned(),vl.isStatic()); }
if (!vertex.hasId()) { assert !(vertex instanceof TitanSchemaVertex); //Those are assigned ids immediately in the transaction if (vertex.vertexLabel().isPartitioned())
assertEquals("person",person.name()); assertEquals("uid",uid.name()); assertFalse(person.isPartitioned()); assertEquals(Integer.class,uid.dataType());
assertEquals(3,Iterables.size(mgmt.getVertexLabels())); assertEquals("tweet",tweet.getName()); assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic()); assertEquals(3,Iterables.size(mgmt.getVertexLabels())); assertEquals("tweet",tweet.getName()); assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic());
assertEquals("person",person.getName()); assertEquals("uid",uid.getName()); assertFalse(person.isPartitioned()); assertEquals(Integer.class,uid.getDataType());
@Override public String getLabel() { return getVertexLabel().getName(); }
private static IDManager.VertexIDType getVertexIDType(VertexLabel vlabel) { if (vlabel.isPartitioned()) { return IDManager.VertexIDType.PartitionedVertex; } else if (vlabel.isStatic()) { return IDManager.VertexIDType.UnmodifiableVertex; } else { return IDManager.VertexIDType.NormalVertex; } }
@Override public String label() { return vertexLabel().name(); }
@Override public TitanVertex addVertex(Long vertexId, VertexLabel label) { verifyWriteAccess(); if (label==null) label=BaseVertexLabel.DEFAULT_VERTEXLABEL; if (vertexId != null && !graph.getConfiguration().allowVertexIdSetting()) { log.info("Provided vertex id [{}] is ignored because vertex id setting is not enabled", vertexId); vertexId = null; } Preconditions.checkArgument(vertexId != null || !graph.getConfiguration().allowVertexIdSetting(), "Must provide vertex id"); Preconditions.checkArgument(vertexId == null || IDManager.VertexIDType.NormalVertex.is(vertexId), "Not a valid vertex id: %s", vertexId); Preconditions.checkArgument(vertexId == null || ((InternalVertexLabel)label).hasDefaultConfiguration(), "Cannot only use default vertex labels: %s",label); Preconditions.checkArgument(vertexId == null || !config.hasVerifyExternalVertexExistence() || !containsVertex(vertexId), "Vertex with given id already exists: %s", vertexId); StandardVertex vertex = new StandardVertex(this, IDManager.getTemporaryVertexID(IDManager.VertexIDType.NormalVertex, temporaryIds.nextID()), ElementLifeCycle.New); if (vertexId != null) { vertex.setId(vertexId); } else if (config.hasAssignIDsImmediately() || label.isPartitioned()) { graph.assignID(vertex,label); } addProperty(vertex, BaseKey.VertexExists, Boolean.TRUE); if (label!=BaseVertexLabel.DEFAULT_VERTEXLABEL) { //Add label Preconditions.checkArgument(label instanceof VertexLabelVertex); addEdge(vertex, (VertexLabelVertex) label, BaseLabel.VertexLabelEdge); } vertexCache.add(vertex, vertex.longId()); return vertex; }
@Override public String getLabel() { return getVertexLabel().getName(); }
public VertexLabelDefinition(VertexLabel vl) { this(vl.name(),vl.longId(),vl.isPartitioned(),vl.isStatic()); }
private static IDManager.VertexIDType getVertexIDType(VertexLabel vlabel) { if (vlabel.isPartitioned()) { return IDManager.VertexIDType.PartitionedVertex; } else if (vlabel.isStatic()) { return IDManager.VertexIDType.UnmodifiableVertex; } else { return IDManager.VertexIDType.NormalVertex; } }
@Override public String label() { return vertexLabel().name(); }
@Test public void testVLabelOnOrderedStorage() { final String label = "pl"; mgmt.makeVertexLabel(label).partition().make(); mgmt.commit(); graph.tx().rollback(); graph.addVertex(label); graph.tx().commit(); mgmt = graph.openManagement(); VertexLabel vl = mgmt.getVertexLabel(label); assertTrue(vl.isPartitioned()); mgmt.rollback(); }
@Override public String getLabel() { return getVertexLabel().getName(); }
tv = getOrCreateVertex(vertexId, vl.name(), tg);