public Object vertexIds() { final List<Object> list = new ArrayList<Object>(); for (final Vertex vertex : this.vertices()) { list.add(vertex.getId()); } return list; }
public void setProperty(final Vertex vertex, final String key, final Object value) { Map<String, Object> map = this.memory.get(vertex.getId()); if (null == map) { map = new HashMap<String, Object>(); this.memory.put(vertex.getId(), map); } final String bspKey = generateSetKey(key); if (isConstantKey(key) && map.containsKey(bspKey)) throw new IllegalStateException("The constant property " + bspKey + " has already been set for vertex " + vertex); else map.put(bspKey, value); }
@Override public void print(Vertex instance, RipplePrintStream p, ModelConnection mc) throws RippleException { p.print("[vertex " + instance.getId() + "]"); } }
private void writeGraphEdges(OutputStream os) throws IOException { IOUtils.write(GexfConstants.EDGES_OPEN, os); for(Edge edge : graph.getEdges()) { String id = ""+edge.getId().hashCode(); String source = ""+edge.getVertex(Direction.IN).getId().hashCode(); String target = ""+edge.getVertex(Direction.OUT).getId().hashCode(); writeGraphEdge(id, source, target, os); } IOUtils.write(GexfConstants.EDGES_CLOSE, os); }
private void writeGraphEdges(OutputStream os) throws IOException { IOUtils.write(GexfConstants.EDGES_OPEN, os); for(Edge edge : graph.getEdges()) { String id = ""+edge.getId().hashCode(); String source = ""+edge.getVertex(Direction.IN).getId().hashCode(); String target = ""+edge.getVertex(Direction.OUT).getId().hashCode(); writeGraphEdge(id, source, target, os); } IOUtils.write(GexfConstants.EDGES_CLOSE, os); }
private void setTypeOf(final Atom a, final BottomUpType type) { BottomUpType existingType = typeOfAtom.get(a); if (null == existingType) { typeOfAtom.put(a, type); changed = true; } else if (existingType != type) { LOGGER.warning("conflicting types for atom " + a.asVertex().getId() + ": {" + existingType.getName() + ", " + type.getName() + "}. Only the former will be used."); } }
private void writeGraphNodes(OutputStream os) throws IOException { //iterate the nodes. for(Vertex vertex : graph.getVertices()) { String id = ""+vertex.getId().hashCode(); String label = vertex.getProperty(vertexLabelProperty); if(StringUtils.isBlank(label)) { label = vertex.toString(); } writeGraphNode(id, label, os); } }
private void writeGraphNodes(OutputStream os) throws IOException { //iterate the nodes. for(Vertex vertex : graph.getVertices()) { String id = ""+vertex.getId().hashCode(); String label = vertex.getProperty(vertexLabelProperty); if(StringUtils.isBlank(label)) { label = vertex.toString(); } writeGraphNode(id, label, os); } }
private void writeGraphEdges(OutputStream os) throws IOException { for(Edge edge : graph.getEdges()) { String label = edge.getLabel(); String source = ""+edge.getVertex(Direction.IN).getId().hashCode(); String target = ""+edge.getVertex(Direction.OUT).getId().hashCode(); writeGraphEdge(label, source, target, os); } }
private AddDecompiledItemsToGraph(ArchiveModel archiveModel, GraphContext context) { this.context = context; this.archiveModelID = archiveModel.asVertex().getId(); this.fileService = new FileService(context); }
/** * Write a vertex with the given id. * Note: This does not currently write the vertex's properties. * @param vertex */ public void writeVertex(Vertex vertex) { Mutators.apply(getWriter(), new AddVertexMutator(vertex.getId().toString())); globals.checkedFlush(); }
@Override protected boolean containsReference(PersistentEObject object, EReference reference, PersistentEObject value) { Vertex v = backend.getOrCreateVertex(object); for (Vertex vOut : v.getVertices(Direction.OUT, reference.getName())) { if (Objects.equals(vOut.getId(), value.id().toString())) { return true; } } return false; }
private void migrateProperty(Vertex vertex, String oldPropertyKey, String newPropertyKey) { log.info("Migrating vertex: " + vertex.getId()); String value = vertex.getProperty(oldPropertyKey); vertex.removeProperty(oldPropertyKey); if (value != null) { vertex.setProperty(newPropertyKey, value); } }
private void writeVertexProperties(final Writer writer, final Vertex e) throws IOException { final Object blueprintsId = e.getId(); if (!useId) { writeKey(writer, vertexIdKey); if (blueprintsId instanceof Number) { writeNumberProperty(writer, (Number) blueprintsId); } else { writeStringProperty(writer, blueprintsId); } } writeProperties(writer, e); }
@Test public void idsAreTranslated() { TinkerGraphUtil tgu = new TinkerGraphUtil(graph, curieUtil); Vertex v = tgu.addNode(node); assertThat(v.getId(), is((Object)"0")); }