本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
}
}
示例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;
}
示例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"));
}
}
示例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;
}
示例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));
}
示例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;
}
}
});
}
示例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));
}
示例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;
}
}
});
}
示例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;
}