Package com.tinkerpop.blueprints.impls.orient

Examples of com.tinkerpop.blueprints.impls.orient.OrientEdge


          boolean reloaded = false;

          for (int retry = 0;; retry++) {
            try {

              final OrientEdge e = g.addEdge(id, vOut, vIn, label);

              addInCache(vOut.getProperty(keyFieldName), vOut);
              addInCache(vIn.getProperty(keyFieldName), vIn);

              edgesCreated.incrementAndGet();

              return e;

            } catch (OConcurrentModificationException e) {
              concurrentException.incrementAndGet();
              reloadVertices(vOut, vIn, label, retry, e);
              reloaded = true;
            } catch (ORecordDuplicatedException e) {
              indexUniqueException.incrementAndGet();
              reloadVertices(vOut, vIn, label, retry, e);
              reloaded = true;
            } catch (Exception e) {
              unknownException.incrementAndGet();
              OLogManager.instance().warn(
                  this,
                  "Error on addEdge(" + id + "," + outVertex + "," + inVertex + "," + label + "), retrying (retry=" + retry + "/"
                      + maxRetries + ") Thread: " + Thread.currentThread().getId());
              e.printStackTrace();
            }
          }
        } finally {
          g.shutdown();
          endAsynchOperation();
View Full Code Here


              for (Entry<String, Object> f : fields.entrySet()) {
                if (f.getValue() instanceof OSQLFunctionRuntime)
                  fields.put(f.getKey(), ((OSQLFunctionRuntime) f.getValue()).getValue(to, null, context));
              }

            OrientEdge edge = null;
            for (int r = 0; r < retry; ++r) {
              try {
                edge = fromVertex.addEdge(null, toVertex, clsName, clusterName, fields);

                if (fields != null && !fields.isEmpty()) {
                  if (!edge.getRecord().getIdentity().isValid())
                    edge.convertToDocument();

                  OSQLHelper.bindParameters(edge.getRecord(), fields, new OCommandParameters(iArgs), context);
                }

                if (content != null) {
                  if (!edge.getRecord().getIdentity().isValid())
                    // LIGHTWEIGHT EDGE, TRANSFORM IT BEFORE
                    edge.convertToDocument();
                  edge.getRecord().merge(content, true, false);
                }

                edge.save(clusterName);

                // OK
                break;

              } catch (OConcurrentModificationException e) {
View Full Code Here

    final ODocument rec = iRecord.getRecord();

    if (rec.getSchemaClass() != null)
      if (rec.getSchemaClass().isSubClassOf(OrientEdgeType.CLASS_NAME)) {
        // EDGE
        final OrientEdge edge = graph.getEdge(rec);
        if (edge != null) {
          final OrientVertex out = (OrientVertex) edge.getVertex(iDirection);

          return out;
        }
      }
View Full Code Here

      final OrientVertex vertex = graph.getVertex(iCurrentRecord);
      return vertex.getLabel();

    } else if (rec.getSchemaClass().isSubClassOf(OrientEdgeType.CLASS_NAME)) {
      // EDGE
      final OrientEdge edge = graph.getEdge(iCurrentRecord);
      return edge.getLabel();

    } else
      throw new OCommandExecutionException("Invalid record: is neither a vertex nor an edge. Found class: " + rec.getSchemaClass());
  }
View Full Code Here

              return false;

            final ODocument document = (ODocument) iCurrentRecord;
            if (document.getSchemaClass() != null && document.getSchemaClass().isSubClassOf("E")) {
              // EDGE TYPE, CREATE THE BLUEPRINTS'S WRAPPER
              OrientEdge graphElement = (OrientEdge) new OrientElementIterable<OrientEdge>(iGraph, Arrays
                  .asList(new ODocument[] { document })).iterator().next();
              iEngine.getBindings(ScriptContext.ENGINE_SCOPE).put("current", graphElement);
              iEngine.getBindings(ScriptContext.ENGINE_SCOPE).put("it", graphElement); // FRAMES LIKE SYNTAX

            } else {
View Full Code Here

TOP

Related Classes of com.tinkerpop.blueprints.impls.orient.OrientEdge

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.