當前位置: 首頁>>代碼示例>>Java>>正文


Java Edge.getVertex方法代碼示例

本文整理匯總了Java中com.tinkerpop.blueprints.Edge.getVertex方法的典型用法代碼示例。如果您正苦於以下問題:Java Edge.getVertex方法的具體用法?Java Edge.getVertex怎麽用?Java Edge.getVertex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.tinkerpop.blueprints.Edge的用法示例。


在下文中一共展示了Edge.getVertex方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: killedDefinitions

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public static Set<ReachingDefinitionAnalyser.Definition> killedDefinitions(
		final Vertex vertex) {
	Set<ReachingDefinitionAnalyser.Definition> killSet = new HashSet<>();
	GremlinPipeline<Vertex, Edge> pipe = new GremlinPipeline<>();
	pipe.start(vertex)
	    .out("WRITE")
	    .out("BELONGS_TO")
	    .in("BELONGS_TO")
	    .inE("WRITE");
	for (Edge writeEdge : pipe) {
		Vertex genVertex = writeEdge.getVertex(Direction.OUT);
		Vertex aloc = writeEdge.getVertex(Direction.IN);
		GremlinPipeline<Vertex, Object> pipe2 = new
				GremlinPipeline<>();
		pipe2.start(aloc)
		     .out("BELONGS_TO")
		     .in("BELONGS_TO")
		     .property("name");
		for (Object identifier : pipe2) {
			killSet.add(new ReachingDefinitionAnalyser.Definition(
					genVertex, identifier));
		}
	}
	return killSet;
}
 
開發者ID:octopus-platform,項目名稱:bjoern,代碼行數:26,代碼來源:DataDependencePlugin.java

示例2: getStationBuyCommodities

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public Map<String, Commodity> getStationBuyCommodities(Vertex stationVertex, Ship ship) {
    Map<String, Commodity> stationBuyCommodities = new HashMap<>();
    for (Edge exchange: stationVertex.getEdges(Direction.OUT, "Exchange")) {            

        int sellPrice = exchange.getProperty("sellPrice");
        int buyPrice = exchange.getProperty("buyPrice");
        int supply = exchange.getProperty("supply");
        int demand = exchange.getProperty("demand");
                   
        if (buyPrice > 0 && supply >= ship.getCargoSpace() && (buyPrice * ship.getCargoSpace()) <= ship.getCash()) {
            Vertex commodityVertex = exchange.getVertex(Direction.IN);
            Commodity commodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand);
            commodity.setGroup(commodityService.getCommodityGroup(commodity.getName()));
            stationBuyCommodities.put(commodity.getName(), commodity);
        }
    }
    return stationBuyCommodities;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:19,代碼來源:StationService.java

示例3: getReleventStationSellCommodities

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public Map<String, Commodity> getReleventStationSellCommodities(Vertex stationVertex, Map<String, Commodity> buyCommodities, Ship ship) {
    Map<String, Commodity> stationSellReleventCommodities = new HashMap<>();
    for (Edge exchange: stationVertex.getEdges(Direction.OUT, "Exchange")) {            

        int sellPrice = exchange.getProperty("sellPrice");
        int buyPrice = exchange.getProperty("buyPrice");
        int supply = exchange.getProperty("supply");
        int demand = exchange.getProperty("demand");
        
        if (demand > ship.getCargoSpace() && sellPrice > 0) {
            Vertex commodityVertex = exchange.getVertex(Direction.IN);
            Commodity sellCommodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand);
            sellCommodity.setGroup(commodityService.getCommodityGroup(sellCommodity.getName()));
            Commodity boughtCommodity = buyCommodities.get(sellCommodity.getName());
            
            if (boughtCommodity != null && boughtCommodity.getBuyPrice() < sellCommodity.getSellPrice()) {
                stationSellReleventCommodities.put(sellCommodity.getName(), sellCommodity);
            }
        }
    }
    
    return stationSellReleventCommodities;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:24,代碼來源:StationService.java

示例4: getStationCommodities

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public List<Commodity> getStationCommodities(Vertex stationVertex) {
    
    List<Commodity> stationCommodities = new ArrayList<>();
    
    for (Edge exchange: stationVertex.getEdges(Direction.OUT, "Exchange")) {            

        int sellPrice = exchange.getProperty("sellPrice");
        int buyPrice = exchange.getProperty("buyPrice");
        int supply = exchange.getProperty("supply");
        int demand = exchange.getProperty("demand");
        long date = exchange.getProperty("date");
        
        if ( (demand > 0 && sellPrice > 0) || (supply > 0 && buyPrice > 0)) {
            Vertex commodityVertex = exchange.getVertex(Direction.IN);
            Commodity commodity = new Commodity(commodityVertex.getProperty("name"), buyPrice, supply, sellPrice, demand, date);
            commodity.setGroup(commodityService.getCommodityGroup(commodity.getName()));
            stationCommodities.add(commodity);
        }
    }
    
    return stationCommodities;
}
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:23,代碼來源:StationService.java

示例5: findStationsInSystemOrientDb

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public Set<Vertex> findStationsInSystemOrientDb(Vertex system, Set<String> avoidStations) {

        if (avoidStations == null) {
            avoidStations = new HashSet<>();
        }

        Set<Vertex> stationsInSystem = new HashSet<>();
        for (Edge hasEdge : system.getEdges(com.tinkerpop.blueprints.Direction.OUT, "Has")) {
            Vertex station = hasEdge.getVertex(com.tinkerpop.blueprints.Direction.IN);
            String stationName = station.getProperty("name");
            if (!avoidStations.contains(stationName)) {
                stationsInSystem.add(station);
            }
        }
        return stationsInSystem;
    }
 
開發者ID:jrosocha,項目名稱:jarvisCli,代碼行數:17,代碼來源:StarSystemService.java

示例6: migrateSchemaContainerRootEdges

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
/**
 * The edge label has change. Migrate existing edges.
 */
private void migrateSchemaContainerRootEdges(Vertex schemaRoot) {
	for (Edge edge : schemaRoot.getEdges(Direction.OUT, "HAS_SCHEMA_CONTAINER")) {
		Vertex container = edge.getVertex(Direction.IN);
		schemaRoot.addEdge("HAS_SCHEMA_CONTAINER_ITEM", container);
		edge.remove();
	}
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:11,代碼來源:ChangeTVCMigration.java

示例7: hasPermissionForId

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public boolean hasPermissionForId(Object elementId, GraphPermission permission) {
	if (PermissionStore.hasPermission(getId(), permission, elementId)) {
		return true;
	} else {
		FramedGraph graph = getGraph();
		// Find all roles that are assigned to the user by checking the
		// shortcut edge from the index
		Iterable<Edge> roleEdges = graph.getEdges("e." + ASSIGNED_TO_ROLE + "_out", this.getId());
		for (Edge roleEdge : roleEdges) {
			Vertex role = roleEdge.getVertex(Direction.IN);
			// Find all permission edges between the found role and target
			// vertex with the specified label
			Iterable<Edge> edges = graph.getEdges("e." + permission.label() + "_inout", MeshInternal.get().database().createComposedIndexKey(
					elementId, role.getId()));
			boolean foundPermEdge = edges.iterator().hasNext();
			if (foundPermEdge) {
				// We only store granting permissions in the store in order
				// reduce the invalidation calls.
				// This way we do not need to invalidate the cache if a role
				// is removed from a group or a role is deleted.
				PermissionStore.store(getId(), permission, elementId);
				return true;
			}
		}
		// Fall back to read and check whether the user has read perm. Read permission also includes read published.
		if (permission == READ_PUBLISHED_PERM) {
			return hasPermissionForId(elementId, READ_PERM);
		} else {
			return false;
		}
	}

}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:35,代碼來源:UserImpl.java

示例8: getSource

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
List<Closure> getSource(Graph graph) {
  List<Closure> closures = new ArrayList<>();
  for (Edge edge : graph.getEdges()) {
    if (source.equals(edge.getLabel())) {
      Vertex vertex = edge.getVertex(Direction.IN);
      Node node = graphDb.getNodeById(Long.parseLong((String) vertex.getId()));
      closures.add(closureUtil.getClosure(node, SolrDocUtil.DEFAULT_CLOSURE_TYPES));
    }
  }
  return closures;
}
 
開發者ID:SciGraph,項目名稱:golr-loader,代碼行數:12,代碼來源:EvidenceProcessor.java

示例9: inheritPermissions

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
private void inheritPermissions(ODocument parent, ODocument doc) {
    Vertex parentV = getOrientGraph().getVertex(parent.getIdentity());
    Vertex docV = getOrientGraph().getVertex(doc.getIdentity());
    Iterable<Edge> permissions = parentV.getEdges(Direction.IN, "Permission");
    for (Edge permission : permissions) {
        Vertex role = permission.getVertex(Direction.OUT);
        Edge perm = getOrientGraph().addEdge("class:Permission", role, docV, null);
        perm.setProperty("permissions", permission.getProperty("permissions"));
    }
}
 
開發者ID:hybridbpm,項目名稱:hybridbpm,代碼行數:11,代碼來源:InternalAPI.java

示例10: getEvidence

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
List<Closure> getEvidence(Graph graph) {
  List<Closure> closures = new ArrayList<>();
  for (Edge edge : graph.getEdges()) {
    if (hasEvidence.equals(edge.getLabel())) {
      Vertex vertex = edge.getVertex(Direction.IN);
      Node node = graphDb.getNodeById(Long.parseLong((String) vertex.getId()));
      closures.add(closureUtil.getClosure(node, SolrDocUtil.DEFAULT_CLOSURE_TYPES));
    }
  }
  return closures;
}
 
開發者ID:SciGraph,項目名稱:golr-loader,代碼行數:12,代碼來源:EvidenceProcessor.java

示例11: traverse

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public Collection<RelationSet> traverse(VertexWrapper vWrapper) {
    Vertex v = vWrapper.getVertex();
    Collection<VertexWrapper> vertices = new ArrayList<>();
    for (Edge e : v.getEdges(Direction.OUT)) {
        if (e.getLabel().startsWith(v.<String>getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY))) {
            VertexWrapper trait = new TermVertexWrapper(e.getVertex(Direction.IN));
            if (! trait.getPropertyKeys().contains("available_as_tag") && ! isDeleted(trait.getVertex())) {
                vertices.add(trait);
            }
        }
    }
    return Collections.singletonList(new RelationSet("traits", vertices));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:15,代碼來源:TraitRelation.java

示例12: asPipe

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public Pipe asPipe() {
    return new FilterFunctionPipe<>(new PipeFunction<Edge, Boolean>() {
        @Override
        public Boolean compute(Edge edge) {
            String name = edge.getVertex(Direction.OUT).getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
            if (edge.getLabel().startsWith(name)) {
                VertexWrapper v = new TermVertexWrapper(edge.getVertex(Direction.IN));
                return ! v.getPropertyKeys().contains("available_as_tag") && ! isDeleted(v.getVertex());
            } else {
                return false;
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:16,代碼來源:TraitRelation.java

示例13: traverse

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public Collection<RelationSet> traverse(VertexWrapper vWrapper) {
    Vertex v = vWrapper.getVertex();
    Collection<VertexWrapper> vertices = new ArrayList<>();
    for (Edge e : v.getEdges(Direction.OUT)) {
        if (e.getLabel().startsWith(v.<String>getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY))) {
            VertexWrapper trait = new TermVertexWrapper(e.getVertex(Direction.IN));
            if (trait.getPropertyKeys().contains("available_as_tag") && ! isDeleted(trait.getVertex())) {
                vertices.add(trait);
            }
        }
    }
    return Collections.singletonList(new RelationSet("tags", vertices));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:15,代碼來源:TagRelation.java

示例14: asPipe

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public Pipe asPipe() {
    return new FilterFunctionPipe<>(new PipeFunction<Edge, Boolean>() {
        @Override
        public Boolean compute(Edge edge) {
            String name = edge.getVertex(Direction.OUT).getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
            if (edge.getLabel().startsWith(name)) {
                VertexWrapper v = new TermVertexWrapper(edge.getVertex(Direction.IN));
                return v.getPropertyKeys().contains("available_as_tag") && ! isDeleted(v.getVertex());
            } else {
                return false;
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:16,代碼來源:TagRelation.java

示例15: traverse

import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Override
public Collection<RelationSet> traverse(VertexWrapper vWrapper) {
    Collection<RelationSet> relations = new ArrayList<>();
    Vertex v = vWrapper.getVertex();
    String vertexType = v.getProperty(Constants.ENTITY_TYPE_PROPERTY_KEY);
    Map<String, Collection<VertexWrapper>> vertexMap = new HashMap<>();
    for (Edge e : v.getEdges(Direction.OUT)) {
        String edgeLabel = e.getLabel();
        String edgePrefix = String.format("%s%s.", Constants.INTERNAL_PROPERTY_KEY_PREFIX, vertexType);
        if (edgeLabel.startsWith(edgePrefix)) {
            Vertex adjacentVertex = e.getVertex(Direction.IN);
            if (! isDeleted(adjacentVertex)) {
                VertexWrapper relationVertex = new VertexWrapper(adjacentVertex, resourceDefinition);
                String relationName = edgeLabel.substring(edgePrefix.length());
                Collection<VertexWrapper> vertices = vertexMap.get(relationName);
                if (vertices == null) {
                    vertices = new ArrayList<>();
                    vertexMap.put(relationName, vertices);
                }
                vertices.add(relationVertex);
            }
        }
    }
    for (Map.Entry<String, Collection<VertexWrapper>> entry : vertexMap.entrySet()) {
        relations.add(new RelationSet(entry.getKey(), entry.getValue()));
    }
    return relations;
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:29,代碼來源:GenericRelation.java


注:本文中的com.tinkerpop.blueprints.Edge.getVertex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。