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

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

本文整理了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

  1. /**
  2. * Simply tests if the element ids are equal().
  3. *
  4. * @param a the first element
  5. * @param b the second element
  6. * @return Whether the two elements have equal ids
  7. */
  8. public static boolean haveEqualIds(final Element a, final Element b) {
  9. return a.getId().equals(b.getId());
  10. }

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

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

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

  1. @Override
  2. public long convertIdentifier(final Element element) {
  3. final Object id = element.getId();
  4. if (id instanceof Long)
  5. return (Long) id;
  6. else if (id instanceof Number)
  7. return ((Number) id).longValue();
  8. else
  9. return Long.valueOf(id.toString());
  10. }
  11. }

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

  1. @Override
  2. public int compare(Element o1, Element o2) {
  3. String idA = o1.getId().toString();
  4. String idB = o2.getId().toString();
  5. return ObjectUtils.compare(idA, idB);
  6. }

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

  1. @Override
  2. public long convertIdentifier(final Element element) {
  3. final String rid = element.getId().toString();
  4. final int splitPosition = rid.indexOf(SEPARATOR) + 1;
  5. if (splitPosition > 0)
  6. return Long.valueOf(rid.substring(splitPosition));
  7. else
  8. throw new IllegalArgumentException(String.format(
  9. "Identifer [%s] is not in OrientDB format and can't be converted.", rid));
  10. }
  11. }

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

  1. protected Element processNextStart() {
  2. while (true) {
  3. final Element s = this.starts.next();
  4. if (this.predicate.evaluate(s.getId(), this.id))
  5. return s;
  6. }
  7. }

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

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

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

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

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

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public URI toURI(final Element e) {
  6. if (e instanceof Edge) {
  7. return toEdgeURI(e.getId());
  8. } else {
  9. return toVertexURI(e.getId());
  10. }
  11. }

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

  1. public Object getId() {
  2. return propertyBased
  3. ? baseElement.getProperty(IdGraph.ID)
  4. : baseElement.getId();
  5. }

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

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

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

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

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

  1. @Override
  2. public String toString() {
  3. if (graph.utils.isInternal(this)) {
  4. return getRaw().getId().toString();
  5. } else {
  6. return getId().toString();
  7. }
  8. }
  9. }

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

  1. /**
  2. * Write the given property to the property table.
  3. * @param id
  4. * @param key
  5. * @param value
  6. */
  7. public void writeProperty(Element element, String key, Object value) {
  8. Mutators.apply(getWriter(),
  9. new WritePropertyMutator(element.getId().toString(),
  10. key, value));
  11. globals.checkedFlush();
  12. }

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

  1. public boolean isLegal(final Element element) {
  2. if (this.key.equals(StringFactory.ID)) {
  3. return this.predicate.evaluate(element.getId(), this.value);
  4. } else if (this.key.equals(StringFactory.LABEL) && element instanceof Edge) {
  5. return this.predicate.evaluate(((Edge) element).getLabel(), this.value);
  6. } else {
  7. return this.predicate.evaluate(element.getProperty(this.key), this.value);
  8. }
  9. }
  10. }

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

  1. /**
  2. * Delete the property entry from property table.
  3. * @param id
  4. * @param key
  5. */
  6. public void clearProperty(Element element, String key) {
  7. Mutators.apply(getWriter(),
  8. new ClearPropertyMutator(element.getId().toString(), key));
  9. globals.checkedFlush();
  10. }

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

  1. @Override
  2. public Object getId() {
  3. if (graph.isNaturalIds()) {
  4. if (rawElement instanceof Vertex) {
  5. return rawElement.getProperty(VEProps.NATURAL_VERTEX_ID_PROP_KEY);
  6. } else {
  7. return rawElement.getProperty(VEProps.NATURAL_EDGE_ID_PROP_KEY);
  8. }
  9. } else {
  10. return rawElement.getId();
  11. }
  12. }

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

  1. /**
  2. * Delete the property entry from property table.
  3. * @param id
  4. * @param key
  5. */
  6. public void clearProperty(Element element, String key) {
  7. Mutators.apply(getWriter(),
  8. new ClearPropertyMutator(element.getId().toString(), key));
  9. globals.checkedFlush();
  10. }

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

  1. public void remove(final String key, final Object value, final T element) {
  2. String clazz;
  3. if (element instanceof Vertex)
  4. clazz = RexsterTokens.VERTEX;
  5. else if (element instanceof Edge)
  6. clazz = RexsterTokens.EDGE;
  7. else
  8. throw new RuntimeException("The provided element is not a legal vertex or edge: " + element);
  9. 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()));
  10. }

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

  1. public void put(final String key, final Object value, final T element) {
  2. String clazz;
  3. if (element instanceof Vertex)
  4. clazz = RexsterTokens.VERTEX;
  5. else if (element instanceof Edge)
  6. clazz = RexsterTokens.EDGE;
  7. else
  8. throw new RuntimeException("The provided element is not a legal vertex or edge: " + element);
  9. 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()));
  10. }

相关文章