public AtomList createAtomList() { return framedGraph.frame(this.getPropertyGraph().addVertex(null), AtomList.class); }
/** * Create a new vertex, add it to the graph, and return the newly created vertex. * * @param id the identifier of the vertex * @param mappingFunc the function to create a new dedicated vertex from another * @param <V> the type of the vertex after mapping * * @return the newly created vertex * * @see #addVertex(Object) */ @Nonnull public <V extends Vertex> V addVertex(@Nullable Object id, BiFunction<Vertex, G, V> mappingFunc) { final Vertex base = baseGraph.addVertex(null); if (supportVertexIds) { Object v = checkNotNull(id, "id"); base.setProperty(ID, v); } return mappingFunc.apply(base, me()); }
public Vertex addVertex(final Object id) { if (uniqueIds && null != id && null != getVertex(id)) { throw new IllegalArgumentException("vertex with given id already exists: '" + id + "'"); } final Vertex base = baseGraph.addVertex(null); if (supportVertexIds) { Object v = null == id ? vertexIdFactory.createId() : id; if (null != v) { base.setProperty(ID, v); } } return new IdVertex(base, this); }
public Atom createAtom(final Filter filter, final String id) { Atom a = framedGraph.frame(this.getPropertyGraph().addVertex(id), Atom.class); a.setCreated(new Date().getTime()); a.setSharability(filter.getDefaultSharability()); a.setWeight(filter.getDefaultWeight()); return a; }
/** * Add a plain vertex to the graph. * * Note: this is not an eventable vertex thus no versioning will occur if * this element will be modified. * * @param id The id of the vertex to set, if null, new id will be generated. * @return plain created vertex. */ private Vertex addPlainVertexToGraph(Object id) { validateNewId(id, Vertex.class); final Vertex vertex; Object idVal = id == null ? vertexIdFactory.createId() : id; if (isNaturalIds()) { // we create an id just in case the underline doesn't ignore // supplied ids // and cannot recieve null but we ignore this id in the logic. vertex = getUneventableGraph().addVertex(vertexIdFactory.createId()); vertex.setProperty(VEProps.NATURAL_VERTEX_ID_PROP_KEY, idVal); } else { vertex = getUneventableGraph().addVertex(idVal); } return vertex; }