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; } }
public VertexLabelDefinition(VertexLabel vl) { this(vl.name(),vl.longId(),vl.isPartitioned(),vl.isStatic()); }
if (!vertex.hasId()) { assert !(vertex instanceof TitanSchemaVertex); //Those are assigned ids immediately in the transaction if (vertex.vertexLabel().isPartitioned())
@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; }
@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(); }
assertFalse(person.isPartitioned()); assertEquals(Integer.class,uid.dataType());
assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic()); assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.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; } }
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; } }
public VertexLabelDefinition(VertexLabel vl) { this(vl.name(),vl.longId(),vl.isPartitioned(),vl.isStatic()); }
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.getVertexLabel().isPartitioned())
if (!vertex.hasId()) { assert !(vertex instanceof TitanSchemaVertex); //Those are assigned ids immediately in the transaction if (vertex.vertexLabel().isPartitioned())
@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.getLongId()); return vertex; }
@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; }
@Test @Category({ OrderedKeyStoreTests.class }) public void testVLabelOnOrderedStorage() { final String label = "pl"; mgmt.makeVertexLabel(label).partition().make(); mgmt.commit(); graph.rollback(); graph.addVertexWithLabel(label); graph.commit(); mgmt = graph.getManagementSystem(); VertexLabel vl = mgmt.getVertexLabel(label); assertTrue(vl.isPartitioned()); mgmt.rollback(); }
assertFalse(person.isPartitioned()); assertEquals(Integer.class,uid.getDataType());
assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic()); assertTrue(mgmt.containsVertexLabel("person")); assertFalse(mgmt.containsVertexLabel("bla")); assertFalse(person.isPartitioned()); assertFalse(person.isStatic()); assertFalse(tag.isPartitioned()); assertTrue(tweet.isStatic());