Package com.tinkerpop.blueprints.pgm

Examples of com.tinkerpop.blueprints.pgm.Vertex


   */
  @Override
  public DataType findById(final Object... id) {
    // make sure entered type is a valid one
    String vertexIdValue = strategy.getAsId(id[0]);
    Vertex rootVertex = loadVertexFor(vertexIdValue, containedClass.getName());
    if (rootVertex == null) {
            // root vertex couldn't be found directly, mostly due to
            // https://github.com/Riduidel/gaedo/issues/11
            // So perform the longer (but always working) query
            return find().matching(new QueryBuilder<InformerType>() {
View Full Code Here


          TransactionalOperation<Boolean, DataType, InformerType> operation = new TransactionalOperation<Boolean, DataType, InformerType>(this) {

            @Override
            protected Boolean doPerform() {
              String idVertexId = getIdVertexId(value, strategy.isIdGenerationRequired());
              Vertex returned = getDriver().createEmptyVertex(value.getClass(), idVertexId, value);
              getDriver().setValue(returned, idVertexId);
              return true;
            }
          };
          return operation.perform();
View Full Code Here

   *            database in which vertex will be stored
   * @param value
   * @return
   */
  public static Vertex getVertexForLiteral(GraphDatabaseDriver database, Object value) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if (Literals.containsKey(valueClass)) {
      LiteralTransformer transformer = Literals.get(valueClass);
      returned = transformer.getVertexFor(database, valueClass.cast(value));
View Full Code Here

   *            object
   * @return the
   */
  public static Vertex getVertexForTuple(AbstractBluePrintsBackedFinderService<? extends Graph, ?, ?> service, ServiceRepository repository, Object value,
          Map<String, Object> objectsBeingUpdated) {
    Vertex returned = null;
    // Now distinct behaviour between known objects and unknown ones
    Class<? extends Object> valueClass = value.getClass();
    if (Tuples.containsKey(valueClass)) {
      TupleTransformer transformer = Tuples.get(valueClass);
      returned = transformer.getVertexFor(service, valueClass.cast(value), objectsBeingUpdated);
View Full Code Here

      database.removeEdge(toRemove);
    }
  }

  public static void removeSafely(Graph database, Vertex existing) {
    Vertex toRemove = null;
    if((toRemove = database.getVertex(existing.getId()))==null) {
      if (logger.isLoggable(Level.INFO)) {
        logger.log(Level.INFO, "We tried to remove non existing vertex "+toString(existing));
      }
    } else {
View Full Code Here

    String vertexId = getIdVertexId(toDelete, false /*
                                   * no id
                                   * generation
                                   * on delete
                                   */);
    Vertex objectVertex = loadVertexFor(vertexId, toDelete.getClass().getName());
    if (objectVertex != null) {
      Map<Property, Collection<CascadeType>> containedProperties = strategy.getContainedProperties(toDelete, objectVertex, CascadeType.REMOVE);
      persister.performDelete(this, vertexId, objectVertex, containedClass, containedProperties, toDelete, CascadeType.REMOVE, objectsBeingAccessed);
    }
  }
View Full Code Here

   */
  private DataType doUpdate(DataType toUpdate, CascadeType cascade, Map<String, Object> treeMap) {
    boolean generatesId = strategy.isIdGenerationRequired() ? (CascadeType.PERSIST == cascade) : false;
    String objectVertexId = getIdVertexId(toUpdate, generatesId);
    Class<? extends Object> toUpdateClass = toUpdate.getClass();
    Vertex objectVertex = loadVertexFor(objectVertexId, toUpdateClass.getName());
    Map<Property, Collection<CascadeType>> containedProperties = strategy.getContainedProperties(toUpdate, objectVertex, cascade);
    return (DataType) persister.performUpdate(this, objectVertexId, objectVertex, toUpdateClass, containedProperties, toUpdate, cascade,
            treeMap);
  }
View Full Code Here

   * @param allowIdGeneration true if null id should be replaced by a new one
   * @return a vertex for an instance of the given object
   */
  protected Vertex getVertexForInstanceOfDataType(Object value, CascadeType cascade, Map<String, Object> objectsBeingUpdated, boolean allowIdGeneration) {
    // was there any vertex prior to that call ? (don't worry, it will be used later)
    Vertex existing = getIdVertexFor(containedClass.cast(value), false);
    Vertex returned = null;
    if(existing==null) {
      returned = getIdVertexFor(containedClass.cast(value), allowIdGeneration);
    } else {
      returned = existing;
    }
View Full Code Here

   *            during loading, but is absolutely NOT a persistent cache
   * @see #loadObject(String, Vertex, Map)
   */
  public DataType loadObject(String objectVertexId, Map<String, Object> objectsBeingAccessed) {
    // If cast fails, well, that's some fuckin mess, no ?
    Vertex objectVertex = loadVertexFor(objectVertexId, containedClass.getName());
    return persister.loadObject(this, objectVertexId, objectVertex, objectsBeingAccessed);
  }
View Full Code Here

   */
  @Override
  public DataType findById(final Object... id) {
    // make sure entered type is a valid one
    String vertexIdValue = strategy.getAsId(id[0]);
    Vertex rootVertex = loadVertexFor(vertexIdValue, containedClass.getName());
    if (rootVertex == null) {
            // root vertex couldn't be found directly, mostly due to
            // https://github.com/Riduidel/gaedo/issues/11
            // So perform the longer (but always working) query
            return find().matching(new QueryBuilder<InformerType>() {
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.pgm.Vertex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.