org.vertexium.Edge.getVertexId()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(246)

本文整理了Java中org.vertexium.Edge.getVertexId()方法的一些代码示例,展示了Edge.getVertexId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge.getVertexId()方法的具体详情如下:
包路径:org.vertexium.Edge
类名称:Edge
方法名:getVertexId

Edge.getVertexId介绍

[英]Get the attach vertex id on either side of the edge.
[中]获取边任一侧的附加顶点id。

代码示例

代码示例来源:origin: visallo/vertexium

private Direction getDirection(String previousVertexId, Edge element) {
  if (element.getVertexId(Direction.OUT).equals(previousVertexId)) {
    return Direction.OUT;
  } else {
    return Direction.IN;
  }
}

代码示例来源:origin: org.visallo/visallo-core

public static Set<String> getAllVertexIdsOnEdges(List<Edge> edges) {
    Set<String> results = new HashSet<>();
    for (Edge edge : edges) {
      results.add(edge.getVertexId(Direction.IN));
      results.add(edge.getVertexId(Direction.OUT));
    }
    return results;
  }
}

代码示例来源:origin: org.visallo/visallo-core

public static JSONObject toJsonEdge(Edge edge, String workspaceId) {
  try {
    JSONObject json = toJsonElement(edge, workspaceId);
    json.put("label", edge.getLabel());
    json.put("outVertexId", edge.getVertexId(Direction.OUT));
    json.put("inVertexId", edge.getVertexId(Direction.IN));
    return json;
  } catch (JSONException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: visallo/vertexium

@Override
  protected boolean isIncluded(Edge edge) {
    switch (direction) {
      case IN:
        return edge.getVertexId(Direction.IN).equals(getId());
      case OUT:
        return edge.getVertexId(Direction.OUT).equals(getId());
      default:
        return true;
    }
  }
};

代码示例来源:origin: org.visallo/visallo-core

protected void broadcastEdgeDeletion(Edge edge) {
  JSONObject dataJson = new JSONObject();
  if (edge != null) {
    dataJson.put("edgeId", edge.getId());
    dataJson.put("outVertexId", edge.getVertexId(Direction.OUT));
    dataJson.put("inVertexId", edge.getVertexId(Direction.IN));
  }
  JSONObject json = new JSONObject();
  json.put("type", "edgeDeletion");
  json.put("data", dataJson);
  broadcastJson(json);
}

代码示例来源:origin: org.visallo/visallo-core

/**
 * Find all term mentions connected to either side of the edge.
 */
public Iterable<Vertex> findByEdge(Edge edge, Authorizations authorizations) {
  return new JoinIterable<>(
      findByVertexId(edge.getVertexId(Direction.IN), authorizations),
      findByVertexId(edge.getVertexId(Direction.OUT), authorizations)
  );
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

@Override
public String toString() {
  if (this instanceof Edge) {
    Edge edge = (Edge) this;
    return getId() + ":[" + edge.getVertexId(Direction.OUT) + "-" + edge.getLabel() + "->" + edge.getVertexId(Direction.IN) + "]";
  }
  return getId();
}

代码示例来源:origin: org.vertexium/vertexium-core

/**
 * Get the attach vertex on either side of the edge.
 *
 * @param direction  The side of the edge to get the vertex from (IN or OUT).
 * @param fetchHints Hint on what should be fetched from the datastore.
 * @return The vertex.
 */
default Vertex getVertex(Direction direction, FetchHints fetchHints, Authorizations authorizations) {
  String vertexId = getVertexId(direction);
  return getGraph().getVertex(vertexId, fetchHints, authorizations);
}

代码示例来源:origin: org.visallo/visallo-core

public static void populateClientApiEdge(ClientApiEdge e, Edge edge, String workspaceId) {
  e.setLabel(edge.getLabel());
  e.setOutVertexId(edge.getVertexId(Direction.OUT));
  e.setInVertexId(edge.getVertexId(Direction.IN));
  populateClientApiElement(e, edge, workspaceId);
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public EdgeBuilderByVertexId prepareEdge(Edge edge) {
  return prepareEdge(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      edge.getLabel(),
      edge.getTimestamp(),
      edge.getVisibility()
  );
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public void alterEdgeLabel(Edge edge, String newEdgeLabel) {
  ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  Mutation m = createAlterEdgeLabelMutation(edge, newEdgeLabel, edgeColumnVisibility);
  saveEdgeMutation(m);
  saveEdgeInfoOnVertex(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      newEdgeLabel,
      edgeColumnVisibility
  );
}

代码示例来源:origin: org.visallo/visallo-core

public ClientApiSourceInfo getSourceInfoForEdge(Edge edge, Authorizations authorizations) {
  String inVertexId = edge.getVertexId(Direction.IN);
  Vertex termMention = findTermMention(inVertexId, edge.getId(), null, null, null, authorizations);
  return getSourceInfoFromTermMention(termMention, authorizations);
}

代码示例来源:origin: visallo/vertexium

public void alterEdgeLabel(Edge edge, String newEdgeLabel) {
  ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  Mutation m = createAlterEdgeLabelMutation(edge, newEdgeLabel, edgeColumnVisibility);
  saveEdgeMutation(m);
  saveEdgeInfoOnVertex(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      newEdgeLabel,
      edgeColumnVisibility
  );
}

代码示例来源:origin: org.visallo/visallo-core

@Override
public void populateProductVertexWithWorkspaceEdge(Edge propertyVertexEdge, WorkProductVertex vertex) {
  vertex.setId(propertyVertexEdge.getVertexId(Direction.IN));
  if (WorkspaceProperties.PRODUCT_TO_ENTITY_IS_ANCILLARY.getPropertyValue(propertyVertexEdge, false)) {
    vertex.setAncillary(true);
  }
  populateCustomProductVertexWithWorkspaceEdge(propertyVertexEdge, (TVertex) vertex);
}

代码示例来源:origin: visallo/vertexium

void addInEdge(Edge edge) {
  if (this.inEdges instanceof EdgesWithEdgeInfo) {
    ((EdgesWithEdgeInfo) this.inEdges).add(edge.getId(), new org.vertexium.accumulo.iterator.model.EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.OUT)));
  } else {
    throw new VertexiumException("Cannot add edge");
  }
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

void addInEdge(Edge edge) {
  if (this.inEdges instanceof EdgesWithEdgeInfo) {
    ((EdgesWithEdgeInfo) this.inEdges).add(edge.getId(), new org.vertexium.accumulo.iterator.model.EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.OUT)));
  } else {
    throw new VertexiumException("Cannot add edge");
  }
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

void addOutEdge(Edge edge) {
  if (this.outEdges instanceof EdgesWithEdgeInfo) {
    ((EdgesWithEdgeInfo) this.outEdges).add(edge.getId(), new org.vertexium.accumulo.iterator.model.EdgeInfo(edge.getLabel(), edge.getVertexId(Direction.IN)));
  } else {
    throw new VertexiumException("Cannot add edge");
  }
}

代码示例来源:origin: visallo/vertexium

public boolean alterEdgeVertexOutVertex(Mutation vertexOutMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.IN));
  vertexOutMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexOutMutation.put(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public boolean alterEdgeVertexOutVertex(Mutation vertexOutMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.IN));
  vertexOutMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexOutMutation.put(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public boolean alterEdgeVertexInVertex(Mutation vertexInMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.OUT));
  vertexInMutation.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexInMutation.put(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

相关文章