当前位置: 首页>>代码示例>>Java>>正文


Java OrientEdge类代码示例

本文整理汇总了Java中com.tinkerpop.blueprints.impls.orient.OrientEdge的典型用法代码示例。如果您正苦于以下问题:Java OrientEdge类的具体用法?Java OrientEdge怎么用?Java OrientEdge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OrientEdge类属于com.tinkerpop.blueprints.impls.orient包,在下文中一共展示了OrientEdge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addFriend

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
public OrientEdge addFriend(String outName, String inName) {
    OrientGraph database = new OrientGraph(databasePool);
    try {
        Vertex outVertex = database.addVertex(null);
        Vertex inVertex = database.addVertex(null);
        outVertex.setProperty("name", outName);
        inVertex.setProperty("name", inName);
        OrientEdge edge = database.addEdge(null, outVertex, inVertex, "knows");
        database.commit();
        return edge;
    } catch (Exception e) {
        database.rollback();
    } finally {
        database.shutdown();
    }

    return null;
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:19,代码来源:TestPeopleDao.java

示例2: createCommodityExchangeRelationshipOrientDb

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
public void createCommodityExchangeRelationshipOrientDb(Station station, Commodity commodity, int sellPrice, int buyPrice, int supply, int demand, long date) {
    
    OrientGraph graph = null;
    try {
        graph = orientDbService.getFactory().getTx();
        OrientVertex vertexStation = (OrientVertex) graph.getVertexByKey("Station.name", station.getName());
        OrientVertex vertexCommodity = (OrientVertex) graph.getVertexByKey("Commodity.name", commodity.getName());
        OrientEdge edgeExchange = graph.addEdge(station.getName() + "-" + commodity.getName(), vertexStation, vertexCommodity, "Exchange");
        edgeExchange.setProperty("sellPrice", sellPrice);
        edgeExchange.setProperty("buyPrice", buyPrice);
        edgeExchange.setProperty("supply", supply);
        edgeExchange.setProperty("demand", demand);
        edgeExchange.setProperty("date", date);
        graph.commit();
    } catch (Exception e) {
        graph.rollback();
    }
}
 
开发者ID:jrosocha,项目名称:jarvisCli,代码行数:19,代码来源:StationService.java

示例3: getClassByName

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
protected Class getClassByName(final OETLComponent iComponent, final String iClassName) {
  final Class inClass;
  if (iClassName.equals("ODocument"))
    inClass = ODocument.class;
  else if (iClassName.equals("String"))
    inClass = String.class;
  else if (iClassName.equals("Object"))
    inClass = Object.class;
  else if (iClassName.equals("OrientVertex"))
    inClass = OrientVertex.class;
  else if (iClassName.equals("OrientEdge"))
    inClass = OrientEdge.class;
  else
    try {
      inClass = Class.forName(iClassName);
    } catch (ClassNotFoundException e) {
      throw new OConfigurationException("Class '" + iClassName + "' declared as 'input' of ETL Component '"
          + iComponent.getName() + "' was not found.");
    }
  return inClass;
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:22,代码来源:OETLProcessor.java

示例4: hydrate

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
/**
     * Hidrata un objeto a partir de los atributos guardados en un Edge
     *
     * @param <T> clase del objeto a devolver
     * @param c : clase del objeto a devolver
     * @param e : Edge desde el que recuperar los datos
     * @param t Vínculo a la transacción actual
     * @return objeto completado a partir de la base de datos
     * @throws InstantiationException si no se puede instanciar. 
     * @throws IllegalAccessException si no se puede acceder
     * @throws NoSuchFieldException si no se encuentra alguno de los campos.
     */
    public <T> T hydrate(Class<T> c, OrientEdge e, Transaction t) throws InstantiationException, IllegalAccessException, NoSuchFieldException {
        T oproxied = ObjectProxyFactory.create(c, e, t);
        // recuperar la definición de la clase desde el caché
        ClassDef classdef = classCache.get(c);
        Map<String, Class<?>> fieldmap = classdef.fields;

        Field f;
        for (String prop : e.getPropertyKeys()) {
            Object value = e.getProperty(prop);

            // obtener la clase a la que pertenece el campo
            Class<?> fc = fieldmap.get(prop);
//            LOGGER.log(Level.FINER, "hidratando campo: "+prop);
            // puede darse el caso que la base cree un atributo sobre los registros (ej: @rid) 
            // y la clave podría no corresponderse con un campo.
            if (fc != null) {
                f = ReflectionUtils.findField(c, prop);

                boolean acc = f.isAccessible();
                f.setAccessible(true);
                f.set(oproxied, value);
                f.setAccessible(acc);
            }
        }

        return oproxied;
    }
 
开发者ID:mdre,项目名称:odbogm,代码行数:40,代码来源:ObjectMapper.java

示例5: clearState

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
/**
 * Vuelve  establecer el punto de verificación.
 */
public void clearState() {
    this.entitiesState.clear();
    this.keyState.clear();
    Map<Object, OrientEdge> newOE  = new ConcurrentHashMap<>();
    
    for (Entry<Object, Object> entry : this.entrySet()) {
        Object k = entry.getKey();
        Object o = entry.getValue();
        
        this.keyState.put(k, ObjectCollectionState.REMOVED);
        
        // verificar si existe una relación con en Edge
        if (this.keyToEdge.get(k)!=null)
            newOE.put(k,this.keyToEdge.get(k));
        
        // como puede estar varias veces un objecto agregado al map con distintos keys
        // primero verificamos su existencia para no duplicarlos.
        if (this.entitiesState.get(o) == null) {
            // se asume que todos fueron borrados
            this.entitiesState.put(o, ObjectCollectionState.REMOVED);
        }
        
    }
    this.keyToEdge = newOE;
    this.dirty = false;
}
 
开发者ID:mdre,项目名称:odbogm,代码行数:30,代码来源:HashMapLazyProxy.java

示例6: remove

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Override
public void remove() {
    OrientEdge e = get();
    if (e != null) {
        graph().removeEdge(e);
    }
}
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:8,代码来源:ODBEdge.java

示例7: get

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
protected OrientEdge get() {
        // Object ret = orientGraph.command(new OCommandGremlin("g.v('9:68128').both().both()")).execute();
        String oSqlCommand = "SELECT * FROM " + NAME + " where out()";
        Object ret = graph().command(new OCommandSQL(oSqlCommand)).execute();
//        return (Iterable<Edge>) ret;
        return null;
    }
 
开发者ID:imotSpot,项目名称:imotSpot,代码行数:8,代码来源:ODBEdge.java

示例8: getEdgesFromQuery

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
/** 
 * Runs SQL query to get edges.
 * 
 * @throws StuccoDBException on bad query
 * 
 * @return Zero or more edges
 * */
private List<OrientEdge> getEdgesFromQuery(String query) {
    OrientDynaElementIterable qiterable = executeSQL(query);
    List<OrientEdge> edgeList = new ArrayList<OrientEdge>(1);
    if (qiterable != null) { // Don't know if this can happen, but just in case
        Iterator<Object> iter = qiterable.iterator();
        while (iter.hasNext()) {
            edgeList.add((OrientEdge) iter.next());
        }
    }
    return edgeList;
}
 
开发者ID:stucco,项目名称:graph-db-connection,代码行数:19,代码来源:OrientDBConnection.java

示例9: getOutEdges

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Override
public List<Map<String, Object>> getOutEdges(String outVertID) {
    if(outVertID == null || outVertID.equals("") ){
        throw new IllegalArgumentException("cannot get edge with missing or invalid outVertID");
    }
    
    Object query_ret = getVertByID(outVertID);
    if(query_ret == null){
        logger.warn("getOutVertIDs could not find inVertID:" + outVertID);
        throw new IllegalArgumentException("missing or invalid outVertID");
    }
    
    String query = String.format("SELECT expand(outE()) FROM %s", outVertID); 
    List<OrientEdge>results = getEdgesFromQuery(query);

    List<Map<String,Object> > edgePropertyList = new ArrayList<Map<String,Object>>();
    for(OrientEdge item : results){
        Map<String,Object> edgeProperties = new HashMap<String, Object>();
        String relation = item.getLabel();
        String inVertID = item.getInVertex().getIdentity().toString();
        
        edgeProperties.put("inVertID", inVertID);
        edgeProperties.put("outVertID", outVertID);
        edgeProperties.put("relation", relation);
        edgePropertyList.add(edgeProperties);
    }
    
    return edgePropertyList;
}
 
开发者ID:stucco,项目名称:graph-db-connection,代码行数:30,代码来源:OrientDBConnection.java

示例10: getInEdges

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Override
public List<Map<String, Object>> getInEdges(String inVertID) {
    if(inVertID == null || inVertID.equals("") ){
        throw new IllegalArgumentException("cannot get edge with missing or invalid inVertID");
    }

    Object query_ret = getVertByID(inVertID);
    if(query_ret == null){
        logger.warn("getInVertIDs could not find inVertID:" + inVertID);
        throw new IllegalArgumentException("missing or invalid inVertID");
    }

    String query = String.format("SELECT expand(inE()) FROM %s", inVertID); 
    List<OrientEdge>results = getEdgesFromQuery(query);

    List<Map<String,Object> > edgePropertyList = new ArrayList<Map<String,Object>>();
    for(OrientEdge item : results){
        Map<String,Object> edgeProperties = new HashMap<String, Object>();
        String relation = item.getLabel();
        String outVertID = item.getOutVertex().getIdentity().toString();

        edgeProperties.put("inVertID", inVertID);
        edgeProperties.put("outVertID", outVertID);
        edgeProperties.put("relation", relation);
        edgePropertyList.add(edgeProperties);
    }

    return edgePropertyList;
}
 
开发者ID:stucco,项目名称:graph-db-connection,代码行数:30,代码来源:OrientDBConnection.java

示例11: getOutEdgesPage

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Override
public List<Map<String, Object>> getOutEdgesPage(String outVertID, int offset, int limit) {
    if(outVertID == null || outVertID.equals("") ){
        throw new IllegalArgumentException("cannot get edge with missing or invalid outVertID");
    }
    
    Object query_ret = getVertByID(outVertID);
    if(query_ret == null){
        logger.warn("getOutVertIDs could not find inVertID:" + outVertID);
        throw new IllegalArgumentException("missing or invalid outVertID");
    }
    
    String query = String.format("SELECT expand(outE()) FROM %s", outVertID); 
    List<OrientEdge>results = getEdgesFromQuery(query);
    List<Map<String,Object> > edgePropertyList = new ArrayList<Map<String,Object>>();
    if (results.size() > offset) {
        int end = Math.min(results.size(), offset + limit);
        for (int i = offset; i < end; i++) {
            OrientEdge item = results.get(i);
            Map<String,Object> edgeProperties = new HashMap<String, Object>();
            String relation = item.getLabel();
            String inVertID = item.getInVertex().getIdentity().toString();
            
            edgeProperties.put("inVertID", inVertID);
            edgeProperties.put("outVertID", outVertID);
            edgeProperties.put("relation", relation);
            edgePropertyList.add(edgeProperties);
        }
    }
    
    return edgePropertyList;
}
 
开发者ID:stucco,项目名称:graph-db-connection,代码行数:33,代码来源:OrientDBConnection.java

示例12: getInEdgesPage

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Override
public List<Map<String, Object>> getInEdgesPage(String inVertID, int offset, int limit) {
    if(inVertID == null || inVertID.equals("") ){
        throw new IllegalArgumentException("cannot get edge with missing or invalid inVertID");
    }

    Object query_ret = getVertByID(inVertID);
    if(query_ret == null){
        logger.warn("getInVertIDs could not find inVertID:" + inVertID);
        throw new IllegalArgumentException("missing or invalid inVertID");
    }

    String query = String.format("SELECT expand(inE()) FROM %s", inVertID); 
    List<OrientEdge>results = getEdgesFromQuery(query);

    List<Map<String,Object> > edgePropertyList = new ArrayList<Map<String,Object>>();
    if (results.size() > offset) {
        int end = Math.min(results.size(), offset + limit);
        for (int i = offset; i < end; i++) {
            OrientEdge item = results.get(i);
            Map<String,Object> edgeProperties = new HashMap<String, Object>();
            String relation = item.getLabel();
            String outVertID = item.getOutVertex().getIdentity().toString();

            edgeProperties.put("inVertID", inVertID);
            edgeProperties.put("outVertID", outVertID);
            edgeProperties.put("relation", relation);
            edgePropertyList.add(edgeProperties);
        }
    }

    return edgePropertyList;
}
 
开发者ID:stucco,项目名称:graph-db-connection,代码行数:34,代码来源:OrientDBConnection.java

示例13: setOrientEdge

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
public void setOrientEdge(OrientEdge oe) {
	if(this.oe != null) {
		// TODO
		throw new RuntimeException(new Exception("TODO"));
	}
	
	this.oe = oe;
}
 
开发者ID:e-baloo,项目名称:it-keeps,代码行数:9,代码来源:eRelation.java

示例14: shouldAddAFriendshipToTheGraph

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Test
public void shouldAddAFriendshipToTheGraph() {
    String firstName = "test-name-" + LocalTime.now();
    String secondName = "test-name-" + LocalTime.now();
    OrientEdge edge = statefulTestBean.addFriend(firstName, secondName);
    assertEquals(firstName, edge.getVertex(Direction.OUT).getProperty("name"));
    assertEquals(secondName, edge.getVertex(Direction.IN).getProperty("name"));
    assertEquals("knows", edge.getLabel());

    List<Edge> edges = statefulTestBean.getFriends();
    assertEquals(1, edges.size());
    assertEquals(edge, edges.get(0));
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:14,代码来源:OrientDBArquillianTest.java

示例15: createEdge

import com.tinkerpop.blueprints.impls.orient.OrientEdge; //导入依赖的package包/类
@Override
public <T> T createEdge(final Class<T> edgeClass, final Object from, final Object to, final ODocument edge) {
    final OrientEdge edgeImpl = createEdgeImpl(edgeClass, from, to);
    for (String key : edge.fieldNames()) {
        final Object val = edge.field(key);
        if (key.charAt(0) != '@' && val != null) {
            edgeImpl.setProperty(key, val);
        }
    }
    edgeImpl.save();
    return objectDb.get().load(edgeImpl.getIdentity());
}
 
开发者ID:xvik,项目名称:guice-persist-orient,代码行数:13,代码来源:EdgesSupportDelegate.java


注:本文中的com.tinkerpop.blueprints.impls.orient.OrientEdge类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。