private static IDManager.VertexIDType getVertexIDType(VertexLabel vertexLabel) { if (vertexLabel.isPartitioned()) { return IDManager.VertexIDType.PartitionedVertex; } else if (vertexLabel.isStatic()) { return IDManager.VertexIDType.UnmodifiableVertex; } else { return IDManager.VertexIDType.NormalVertex; } }
private String printVertexLabels(boolean calledDirectly) { StringBuilder sb = new StringBuilder(); String pattern = "%-30s | %-11s | %-50s |%n"; Iterable<VertexLabel> labels = getVertexLabels(); boolean hasResults = false; sb.append(FIRSTDASH); sb.append(String.format(pattern, "Vertex Label Name", "Partitioned", "Static")); sb.append(DASHBREAK); for(VertexLabel label: labels) { hasResults = true; sb.append(String.format(pattern, label.name(), label.isPartitioned(), label.isStatic())); } if (hasResults && calledDirectly) { sb.append(DASHBREAK); } return sb.toString(); }
public VertexLabelDefinition(VertexLabel vl) { this(vl.name(),vl.longId(),vl.isPartitioned(),vl.isStatic()); }
if (!vertex.hasId()) { assert !(vertex instanceof JanusGraphSchemaVertex); //Those are assigned ids immediately in the transaction if (vertex.vertexLabel().isPartitioned())
@Override public JanusGraphVertex 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, 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());