org.apache.tinkerpop.gremlin.structure.T.getAccessor()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(12.8k)|赞(0)|评价(0)|浏览(126)

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

T.getAccessor介绍

暂无

代码示例

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

public static boolean keyForContainsKeyOrValue(String key) {
  return key.equals(T.key.getAccessor()) ||
      key.equals(T.value.getAccessor());
}

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

public static boolean keyForContainsValue(String key) {
  return key.equals(T.value.getAccessor());
}

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

public static boolean keyForContainsKey(String key) {
  return key.equals(T.key.getAccessor());
}

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

public Neo4jVertexProperty(final Neo4jVertex vertex, final Neo4jNode vertexPropertyNode) {
  this.vertex = vertex;
  this.key = (String) vertexPropertyNode.getProperty(T.key.getAccessor());
  this.value = (V) vertexPropertyNode.getProperty(T.value.getAccessor());
  this.vertexPropertyNode = vertexPropertyNode;
}

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

protected TinkerEdge(final Object id, final Vertex outVertex, final String label, final Vertex inVertex) {
  super(id, label);
  this.outVertex = outVertex;
  this.inVertex = inVertex;
  TinkerHelper.autoUpdateIndex(this, T.label.getAccessor(), this.label, null);
}

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

public static HugeKeys string2HugeKey(String key) {
  if (key.equals(T.label.getAccessor())) {
    return HugeKeys.LABEL;
  } else if (key.equals(T.id.getAccessor())) {
    return HugeKeys.ID;
  } else if (keyForContainsKeyOrValue(key)) {
    return HugeKeys.PROPERTIES;
  }
  return HugeKeys.valueOf(key);
}

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

public final boolean test(final Element element) {
  // it is OK to evaluate equality of ids via toString(), given that the test suite enforces the value of
  // id().toString() to be a first class representation of the identifier. a string test is only executed
  // if the predicate value is a String.  this allows stuff like: g.V().has(id,lt(10)) to work properly
  if (this.key.equals(T.id.getAccessor()))
    return testingIdString ? testIdAsString(element) : testId(element);
  else if (this.key.equals(T.label.getAccessor()))
    return testLabel(element);
  else if (element instanceof VertexProperty && this.key.equals(T.value.getAccessor()))
    return testValue((VertexProperty) element);
  else if (element instanceof VertexProperty && this.key.equals(T.key.getAccessor()))
    return testKey((VertexProperty) element);
  else {
    if (element instanceof Vertex) {
      final Iterator<? extends Property> itty = element.properties(this.key);
      while (itty.hasNext()) {
        if (testValue(itty.next()))
          return true;
      }
      return false;
    } else {
      final Property property = element.property(this.key);
      return property.isPresent() && testValue(property);
    }
  }
}

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

/**
   * Helper method for providers that want to "fold in" {@link HasContainer}'s based on id checking into the ids of the {@link GraphStep}.
   *
   * @param graphStep    the GraphStep to potentially {@link GraphStep#addIds(Object...)}.
   * @param hasContainer The {@link HasContainer} to check for id validation.
   * @return true if the {@link HasContainer} updated ids and thus, was processed.
   */
  public static boolean processHasContainerIds(final GraphStep<?, ?> graphStep, final HasContainer hasContainer) {
    if (hasContainer.getKey().equals(T.id.getAccessor()) && graphStep.ids.length == 0 &&
        (hasContainer.getBiPredicate() == Compare.eq || hasContainer.getBiPredicate() == Contains.within)) {
      graphStep.addIds(hasContainer.getValue());
      return true;
    }
    return false;
  }
}

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

/**
 * Filters vertices, edges and vertex properties based on their label.
 *
 * @param predicate the filter to apply to the label of the {@link Element}
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.2.4
 */
public default GraphTraversal<S, E> hasLabel(final P<String> predicate) {
  this.asAdmin().getBytecode().addStep(Symbols.hasLabel, predicate);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.label.getAccessor(), predicate));
}

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

/**
 * Filters vertices, edges and vertex properties based on their identifier.
 *
 * @param predicate the filter to apply to the identifier of the {@link Element}
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.2.4
 */
public default GraphTraversal<S, E> hasId(final P<Object> predicate) {
  this.asAdmin().getBytecode().addStep(Symbols.hasId, predicate);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.id.getAccessor(), predicate));
}

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

/**
 * Filters vertices, edges and vertex properties based on their value.
 *
 * @param predicate the filter to apply to the value of the {@link Element}
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.2.4
 */
public default GraphTraversal<S, E> hasValue(final P<Object> predicate) {
  this.asAdmin().getBytecode().addStep(Symbols.hasValue, predicate);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.value.getAccessor(), predicate));
}

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

/**
 * Filters vertices, edges and vertex properties based on their key.
 *
 * @param predicate the filter to apply to the key of the {@link Element}
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.2.4
 */
public default GraphTraversal<S, E> hasKey(final P<String> predicate) {
  this.asAdmin().getBytecode().addStep(Symbols.hasKey, predicate);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.key.getAccessor(), predicate));
}

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

/**
 * Filters vertices, edges and vertex properties based on their properties.
 *
 * @param accessor  the {@link T} accessor of the property to filter on
 * @param predicate the filter to apply to the key's value
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.0.0-incubating
 */
public default GraphTraversal<S, E> has(final T accessor, final P<?> predicate) {
  this.asAdmin().getBytecode().addStep(Symbols.has, accessor, predicate);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(accessor.getAccessor(), predicate));
}

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

/**
 * Filters vertices, edges and vertex properties based on their label.
 *
 * @param label       the label of the {@link Element}
 * @param otherLabels additional labels of the {@link Element}
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.2.2
 */
public default GraphTraversal<S, E> hasLabel(final String label, final String... otherLabels) {
  final String[] labels = new String[otherLabels.length + 1];
  labels[0] = label;
  System.arraycopy(otherLabels, 0, labels, 1, otherLabels.length);
  this.asAdmin().getBytecode().addStep(Symbols.hasLabel, labels);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.label.getAccessor(), labels.length == 1 ? P.eq(labels[0]) : P.within(labels)));
}

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

/**
 * Filters vertices, edges and vertex properties based on their key.
 *
 * @param label       the key of the {@link Element}
 * @param otherLabels additional key of the {@link Element}
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.2.2
 */
public default GraphTraversal<S, E> hasKey(final String label, final String... otherLabels) {
  final String[] labels = new String[otherLabels.length + 1];
  labels[0] = label;
  System.arraycopy(otherLabels, 0, labels, 1, otherLabels.length);
  this.asAdmin().getBytecode().addStep(Symbols.hasKey, labels);
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.key.getAccessor(), labels.length == 1 ? P.eq(labels[0]) : P.within(labels)));
}

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

/**
 * Filters vertices, edges and vertex properties based on their properties.
 *
 * @param label       the label of the {@link Element}
 * @param propertyKey the key of the property to filter on
 * @param predicate   the filter to apply to the key's value
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.0.0-incubating
 */
public default GraphTraversal<S, E> has(final String label, final String propertyKey, final P<?> predicate) {
  this.asAdmin().getBytecode().addStep(Symbols.has, label, propertyKey, predicate);
  TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.label.getAccessor(), P.eq(label)));
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(propertyKey, predicate));
}

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

/**
 * Filters vertices, edges and vertex properties based on their properties.
 *
 * @param accessor the {@link T} accessor of the property to filter on
 * @param value    the value to compare the accessor value to for equality
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.0.0-incubating
 */
public default GraphTraversal<S, E> has(final T accessor, final Object value) {
  if (value instanceof P)
    return this.has(accessor, (P) value);
  else if (value instanceof Traversal)
    return this.has(accessor, (Traversal) value);
  else {
    this.asAdmin().getBytecode().addStep(Symbols.has, accessor, value);
    return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(accessor.getAccessor(), P.eq(value)));
  }
}

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

/**
 * Filters vertices, edges and vertex properties based on their properties.
 *
 * @param label       the label of the {@link Element}
 * @param propertyKey the key of the property to filter on
 * @param value       the value to compare the accessor value to for equality
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.0.0-incubating
 */
public default GraphTraversal<S, E> has(final String label, final String propertyKey, final Object value) {
  this.asAdmin().getBytecode().addStep(Symbols.has, label, propertyKey, value);
  TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.label.getAccessor(), P.eq(label)));
  return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(propertyKey, value instanceof P ? (P) value : P.eq(value)));
}

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

/**
 * Filters vertices, edges and vertex properties based on their properties.
 *
 * @param accessor          the {@link T} accessor of the property to filter on
 * @param propertyTraversal the traversal to filter the accessor value by
 * @return the traversal with an appended {@link HasStep}
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#has-step" target="_blank">Reference Documentation - Has Step</a>
 * @since 3.1.0-incubating
 */
public default GraphTraversal<S, E> has(final T accessor, final Traversal<?, ?> propertyTraversal) {
  this.asAdmin().getBytecode().addStep(Symbols.has, accessor, propertyTraversal);
  return this.asAdmin().addStep(
      new TraversalFilterStep<>(this.asAdmin(), propertyTraversal.asAdmin().addStep(0,
          new PropertiesStep(propertyTraversal.asAdmin(), PropertyType.VALUE, accessor.getAccessor()))));
}

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

@Override
public <V> Property<V> setProperty(final Neo4jVertexProperty vertexProperty, final String key, final V value) {
  final Neo4jNode vertexPropertyNode = Neo4jHelper.getVertexPropertyNode(vertexProperty);
  if (null != vertexPropertyNode) {
    vertexPropertyNode.setProperty(key, value);
    return new Neo4jProperty<>(vertexProperty, key, value);
  } else {
    final Neo4jNode vertexNode = ((Neo4jVertex) vertexProperty.element()).getBaseVertex();
    final Neo4jNode newVertexPropertyNode = ((WrappedGraph<Neo4jGraphAPI>) vertexProperty.element().graph()).getBaseGraph().createNode(VERTEX_PROPERTY_LABEL, vertexProperty.label());
    newVertexPropertyNode.setProperty(T.key.getAccessor(), vertexProperty.key());
    newVertexPropertyNode.setProperty(T.value.getAccessor(), vertexProperty.value());
    newVertexPropertyNode.setProperty(vertexProperty.key(), vertexProperty.value());
    newVertexPropertyNode.setProperty(key, value);
    vertexNode.connectTo(newVertexPropertyNode, Graph.Hidden.hide(vertexProperty.key()));
    vertexNode.setProperty(vertexProperty.key(), VERTEX_PROPERTY_TOKEN);
    Neo4jHelper.setVertexPropertyNode(vertexProperty, newVertexPropertyNode);
    return new Neo4jProperty<>(vertexProperty, key, value);
  }
}

相关文章