public SchemaContainer(TitanGraph graph) { vertexLabels = Maps.newHashMap(); relationTypes = Maps.newHashMap(); TitanManagement mgmt = graph.openManagement(); try { for (VertexLabel vl : mgmt.getVertexLabels()) { VertexLabelDefinition vld = new VertexLabelDefinition(vl); vertexLabels.put(vld.getName(),vld); } for (EdgeLabel el : mgmt.getRelationTypes(EdgeLabel.class)) { EdgeLabelDefinition eld = new EdgeLabelDefinition(el); relationTypes.put(eld.getName(),eld); } for (PropertyKey pk : mgmt.getRelationTypes(PropertyKey.class)) { PropertyKeyDefinition pkd = new PropertyKeyDefinition(pk); relationTypes.put(pkd.getName(), pkd); } } finally { mgmt.rollback(); } }
assertEquals(6, Iterables.size(mgmt.getRelationTypes(EdgeLabel.class))); assertEquals(11, Iterables.size(mgmt.getRelationTypes(RelationType.class))); assertEquals(3, Iterables.size(mgmt.getVertexLabels())); assertEquals(6, Iterables.size(mgmt.getRelationTypes(EdgeLabel.class))); assertEquals(11, Iterables.size(mgmt.getRelationTypes(RelationType.class))); assertEquals(3, Iterables.size(mgmt.getVertexLabels()));
public SchemaContainer(TitanGraph graph) { vertexLabels = Maps.newHashMap(); relationTypes = Maps.newHashMap(); TitanManagement mgmt = graph.openManagement(); try { for (VertexLabel vl : mgmt.getVertexLabels()) { VertexLabelDefinition vld = new VertexLabelDefinition(vl); vertexLabels.put(vld.getName(),vld); } for (EdgeLabel el : mgmt.getRelationTypes(EdgeLabel.class)) { EdgeLabelDefinition eld = new EdgeLabelDefinition(el); relationTypes.put(eld.getName(),eld); } for (PropertyKey pk : mgmt.getRelationTypes(PropertyKey.class)) { PropertyKeyDefinition pkd = new PropertyKeyDefinition(pk); relationTypes.put(pkd.getName(), pkd); } } finally { mgmt.rollback(); } }
public SchemaContainer(TitanGraph graph) { vertexLabels = Maps.newHashMap(); relationTypes = Maps.newHashMap(); TitanManagement mgmt = graph.getManagementSystem(); try { for (VertexLabel vl : mgmt.getVertexLabels()) { VertexLabelDefinition vld = new VertexLabelDefinition(vl); vertexLabels.put(vld.getName(),vld); } for (EdgeLabel el : mgmt.getRelationTypes(EdgeLabel.class)) { EdgeLabelDefinition eld = new EdgeLabelDefinition(el); relationTypes.put(eld.getName(),eld); } for (PropertyKey pk : mgmt.getRelationTypes(PropertyKey.class)) { PropertyKeyDefinition pkd = new PropertyKeyDefinition(pk); relationTypes.put(pkd.getName(), pkd); } } finally { mgmt.rollback(); } }
assertEquals(6,Iterables.size(mgmt.getRelationTypes(EdgeLabel.class))); assertEquals(11,Iterables.size(mgmt.getRelationTypes(RelationType.class))); assertEquals(3,Iterables.size(mgmt.getVertexLabels())); assertEquals(6,Iterables.size(mgmt.getRelationTypes(EdgeLabel.class))); assertEquals(11,Iterables.size(mgmt.getRelationTypes(RelationType.class))); assertEquals(3,Iterables.size(mgmt.getVertexLabels()));