com.tinkerpop.blueprints.Graph.addVertex()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(156)

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

Graph.addVertex介绍

[英]Create a new vertex, add it to the graph, and return the newly created vertex. The provided object identifier is a recommendation for the identifier to use. It is not required that the implementation use this identifier.
[中]创建一个新顶点,将其添加到图形中,然后返回新创建的顶点。所提供的对象标识符是建议使用的标识符。实现不需要使用此标识符。

代码示例

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

@Override
  public Vertex createVertex(final Object id) {
    return this.graph.addVertex(id);
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

@Override
public Vertex addVertex(final Object id) {
  return graph.addVertex(id);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

private Vertex createVertex(final Map<String, Object> map, final Object id) {
  //final Object vertexId = vertexIdKey == null ? (graph.getFeatures().ignoresSuppliedIds ? null : id) : map.remove(vertexIdKey);
  Object vertexId = id;
  if (vertexIdKey != null) {
    vertexId = map.remove(vertexIdKey);
    if (vertexId == null) vertexId = id;
    vertexMappedIdMap.put(id, vertexId);
  }
  final Vertex createdVertex = graph.addVertex(vertexId);
  return createdVertex;
}

代码示例来源:origin: tinkerpop/furnace

@Override
public Vertex addVertex(final Object id) {
  return new DerivedVertex(this.baseGraph.addVertex(id), this);
}

代码示例来源:origin: com.tinkerpop/frames

public Vertex addVertex(final Object id) {
  return config.getConfiguredGraph().addVertex(id);
}

代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames

public Vertex addVertex(final Object id) {
  return config.getConfiguredGraph().addVertex(id);
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public Vertex addVertex(final Object id) {
  return new WrappedVertex(this.baseGraph.addVertex(id));
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

public Vertex addVertex(final Object id) {
  final PartitionVertex vertex = new PartitionVertex(this.baseGraph.addVertex(id), this);
  vertex.setPartition(this.writePartition);
  return vertex;
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core

/**
 * Raises a vertexAdded event.
 */
public Vertex addVertex(final Object id) {
  final Vertex vertex = this.baseGraph.addVertex(id);
  if (vertex == null) {
    return null;
  } else {
    this.onVertexAdded(vertex);
    return new EventVertex(vertex, this);
  }
}

代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints

private void init() {
  try {
    this.graph.getVertices("class", "");
  } catch (IllegalArgumentException e) {
    Vertex v = this.graph.addVertex(null);
    v.setProperty("class", "");
  }
}

代码示例来源:origin: BrynCooke/totorom

/**
 * Add a vertex to the graph
 * 
 * @param kind
 *            The kind of the frame.
 * @return The framed vertex.
 */
public <T extends FramedVertex> T addVertex(Class<T> kind) {
  T framedVertex = frameNewElement(delegate.addVertex(null), kind);
  framedVertex.init();
  return framedVertex;
}

代码示例来源:origin: kieker-monitoring/kieker

@Override
protected void transformVertex(final IVertex vertex) {
  final com.tinkerpop.blueprints.Vertex mappedVertex = this.transformedGraph.addVertex(vertex.getId());
  this.mappedVertices.put(vertex, mappedVertex);
  for (final String propertyKey : vertex.getPropertyKeys()) {
    mappedVertex.setProperty(propertyKey, vertex.getProperty(propertyKey));
  }
}

代码示例来源:origin: com.tinkerpop.blueprints/blueprints-graph-jung

public boolean addVertex(final Vertex vertex) {
  if (null != graph.getVertex(vertex.getId()))
    graph.addVertex(vertex.getId());
  return true;
}

代码示例来源:origin: SciGraph/SciGraph

Vertex addNode(Vertex node) {
 Vertex vertex = graph.getVertex(node.getId());
 if (null == vertex) {
  vertex = graph.addVertex(node.getId());
  copyProperties(node, vertex);
 }
 return vertex;
}

代码示例来源:origin: SciGraph/SciGraph

Vertex addNode(Node node) {
 Vertex vertex = graph.getVertex(node.getId());
 if (null == vertex) {
  vertex = graph.addVertex(node.getId());
  copyProperties(node, vertex);
  Set<String> labels = new HashSet<>();
  for (Label label : node.getLabels()) {
   labels.add(label.name());
  }
  vertex.setProperty("types", labels);
 }
 return vertex;
}

代码示例来源:origin: SciGraph/SciGraph

@Test
public void nonFoundCuriesAreIgnored() {
 Vertex v = graph.addVertex(null);
 adder.addCuries(graph);
 assertThat(v.getPropertyKeys(), not(contains(CommonProperties.CURIE)));
}

代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints

private Vertex add(Term term) {
  Vertex v = null;
  GraphQuery query = this.graph.query();
  query.has("class", "term");
  query.has("value", term.getIdentifier().toString());
  query.has("type", term.getType().toString());
  Iterator<Vertex> it = query.vertices().iterator();
  if (it.hasNext()) {
    v = it.next();
  } else {
    v = this.graph.addVertex(null);
    v.setProperty("class", "term");
    v.setProperty("value", term.getIdentifier().toString());
    v.setProperty("type", term.getType().toString());
  }
  return v;
}

代码示例来源:origin: SciGraph/SciGraph

@Test
public void curiesAreAdded() {
 Vertex v = graph.addVertex(null);
 v.setProperty(CommonProperties.IRI, "http://x.org/foo");
 adder.addCuries(graph);
 assertThat((String)v.getProperty(CommonProperties.CURIE), is("x:foo"));
}

代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints

private Vertex add(Predicate predicate) {
  Vertex v = null;
  GraphQuery query = this.graph.query();
  query.has("class", "predicate");
  query.has("value", predicate.getIdentifier());
  query.has("arity", predicate.getArity());
  Iterator<Vertex> it = query.vertices().iterator();
  if (it.hasNext()) {
    v = it.next();
  } else {
    v = graph.addVertex(null);
    v.setProperty("class", "predicate");
    v.setProperty("value", predicate.getIdentifier());
    v.setProperty("arity", predicate.getArity());
  }
  return v;
}

代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints

@Override
public boolean add(Atom atom) {
  Vertex atomVertex = graph.addVertex(null);
  atomVertex.setProperty("class", "atom");
  atomVertex.setProperty("predicate",
      predicateToString(atom.getPredicate()));
  Vertex predicateVertex = this.add(atom.getPredicate());
  this.graph.addEdge(null, atomVertex, predicateVertex, "predicate");
  int i = 0;
  for (Term t : atom) {
    atomVertex.setProperty("term" + i, termToString(t));
    Vertex termVertex = this.add(t);
    Edge e = graph.addEdge(null, atomVertex, termVertex, "term");
    e.setProperty("index", i++);
  }
  return true;
}

相关文章