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

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

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

Element.getId介绍

[英]An identifier that is unique to its inheriting class. All vertices of a graph must have unique identifiers. All edges of a graph must have unique identifiers.
[中]对其继承类唯一的标识符。图的所有顶点都必须具有唯一标识符。图的所有边都必须具有唯一标识符。

代码示例

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

/**
 * Simply tests if the element ids are equal().
 *
 * @param a the first element
 * @param b the second element
 * @return Whether the two elements have equal ids
 */
public static boolean haveEqualIds(final Element a, final Element b) {
  return a.getId().equals(b.getId());
}

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

@Override
  public int compare(final Element a, final Element b) {
    return a.getId().toString().compareTo(b.getId().toString());
  }
}

代码示例来源:origin: thinkaurelius/faunus

@Override
  public long convertIdentifier(final Element element) {
    final Object id = element.getId();
    if (id instanceof Long)
      return (Long) id;
    else if (id instanceof Number)
      return ((Number) id).longValue();
    else
      return Long.valueOf(id.toString());
  }
}

代码示例来源:origin: gentics/mesh

@Override
public int compare(Element o1, Element o2) {
  String idA = o1.getId().toString();
  String idB = o2.getId().toString();
  return ObjectUtils.compare(idA, idB);
}

代码示例来源:origin: thinkaurelius/faunus

@Override
  public long convertIdentifier(final Element element) {
    final String rid = element.getId().toString();
    final int splitPosition = rid.indexOf(SEPARATOR) + 1;

    if (splitPosition > 0)
      return Long.valueOf(rid.substring(splitPosition));
    else
      throw new IllegalArgumentException(String.format(
          "Identifer [%s] is not in OrientDB format and can't be converted.", rid));
  }
}

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

protected Element processNextStart() {
  while (true) {
    final Element s = this.starts.next();
    if (this.predicate.evaluate(s.getId(), this.id))
      return s;
  }
}

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

public void put(final String key, final Object value, final T element) {
  final Map<String, Object> map = new HashMap<String, Object>();
  map.put(key, value);
  this.rawIndex.add((Long) element.getId(), map);
}

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

public void put(final String key, final Object value, final T element) {
  final Map<String, Object> map = new HashMap<String, Object>();
  map.put(key, value);
  this.rawIndex.add((Long) element.getId(), map);
}

代码示例来源:origin: blazegraph/database

/**
 * {@inheritDoc}
 */
@Override
public URI toURI(final Element e) {
  
  if (e instanceof Edge) {
    
    return toEdgeURI(e.getId());
    
  } else {
    
    return toVertexURI(e.getId());
    
  }
  
}

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

public Object getId() {
  return propertyBased
      ? baseElement.getProperty(IdGraph.ID)
      : baseElement.getId();
}

代码示例来源:origin: edu.jhuapl.tinkerpop/blueprints-accumulo-graph

@Override
 public Iterable<Mutation> create() {
  byte[] bytes = AccumuloByteSerializer.serialize(value);
  Mutation m = new Mutation(bytes);
  m.put(key.getBytes(), element.getId().toString()
    .getBytes(), Constants.EMPTY);
  return Lists.newArrayList(m);
 }
}

代码示例来源:origin: edu.jhuapl.tinkerpop/blueprints-accumulo-graph

@Override
 public Iterable<Mutation> create() {
  byte[] bytes = AccumuloByteSerializer.serialize(value);
  Mutation m = new Mutation(bytes);
  m.putDelete(key, element.getId().toString());
  return Lists.newArrayList(m);
 }
}

代码示例来源:origin: indexiatech/antiquity

@Override
  public String toString() {
    if (graph.utils.isInternal(this)) {
      return getRaw().getId().toString();
    } else {
      return getId().toString();
    }
  }
}

代码示例来源:origin: edu.jhuapl.tinkerpop/blueprints-accumulo-graph

/**
 * Write the given property to the property table.
 * @param id
 * @param key
 * @param value
 */
public void writeProperty(Element element, String key, Object value) {
 Mutators.apply(getWriter(),
   new WritePropertyMutator(element.getId().toString(),
     key, value));
 globals.checkedFlush();
}

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

public boolean isLegal(final Element element) {
    if (this.key.equals(StringFactory.ID)) {
      return this.predicate.evaluate(element.getId(), this.value);
    } else if (this.key.equals(StringFactory.LABEL) && element instanceof Edge) {
      return this.predicate.evaluate(((Edge) element).getLabel(), this.value);
    } else {
      return this.predicate.evaluate(element.getProperty(this.key), this.value);
    }
  }
}

代码示例来源:origin: edu.jhuapl.tinkerpop/blueprints-accumulo-graph

/**
 * Delete the property entry from property table.
 * @param id
 * @param key
 */
public void clearProperty(Element element, String key) {
 Mutators.apply(getWriter(),
   new ClearPropertyMutator(element.getId().toString(), key));
 globals.checkedFlush();
}

代码示例来源:origin: indexiatech/antiquity

@Override
public Object getId() {
  if (graph.isNaturalIds()) {
    if (rawElement instanceof Vertex) {
      return rawElement.getProperty(VEProps.NATURAL_VERTEX_ID_PROP_KEY);
    } else {
      return rawElement.getProperty(VEProps.NATURAL_EDGE_ID_PROP_KEY);
    }
  } else {
    return rawElement.getId();
  }
}

代码示例来源:origin: JHUAPL/AccumuloGraph

/**
 * Delete the property entry from property table.
 * @param id
 * @param key
 */
public void clearProperty(Element element, String key) {
 Mutators.apply(getWriter(),
   new ClearPropertyMutator(element.getId().toString(), key));
 globals.checkedFlush();
}

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

public void remove(final String key, final Object value, final T element) {
  String clazz;
  if (element instanceof Vertex)
    clazz = RexsterTokens.VERTEX;
  else if (element instanceof Edge)
    clazz = RexsterTokens.EDGE;
  else
    throw new RuntimeException("The provided element is not a legal vertex or edge: " + element);
  RestHelper.delete(this.graph.getGraphURI() + RexsterTokens.SLASH_INDICES_SLASH + RestHelper.encode(this.indexName) + RexsterTokens.QUESTION + RexsterTokens.KEY_EQUALS + key + RexsterTokens.AND + RexsterTokens.VALUE_EQUALS + RestHelper.uriCast(value) + RexsterTokens.AND + RexsterTokens.CLASS_EQUALS + clazz + RexsterTokens.AND + RexsterTokens.ID_EQUALS + RestHelper.encode(element.getId()));
}

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

public void put(final String key, final Object value, final T element) {
  String clazz;
  if (element instanceof Vertex)
    clazz = RexsterTokens.VERTEX;
  else if (element instanceof Edge)
    clazz = RexsterTokens.EDGE;
  else
    throw new RuntimeException("The provided element is not a legal vertex or edge: " + element);
  RestHelper.put(this.graph.getGraphURI() + RexsterTokens.SLASH_INDICES_SLASH + RestHelper.encode(this.indexName) + RexsterTokens.QUESTION + RexsterTokens.KEY_EQUALS + key + RexsterTokens.AND + RexsterTokens.VALUE_EQUALS + RestHelper.uriCast(value) + RexsterTokens.AND + RexsterTokens.CLASS_EQUALS + clazz + RexsterTokens.AND + RexsterTokens.ID_EQUALS + RestHelper.encode(element.getId()));
}

相关文章