当前位置: 首页>>代码示例>>Java>>正文


Java GraphTraversal.has方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal.has方法的典型用法代码示例。如果您正苦于以下问题:Java GraphTraversal.has方法的具体用法?Java GraphTraversal.has怎么用?Java GraphTraversal.has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal的用法示例。


在下文中一共展示了GraphTraversal.has方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: find

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
/**
 * Find the given element using it's id, if it has one, or all of it's properties.
 */
protected <E extends Element> GraphTraversal find(E element) {
  GraphTraversal traversal = g.V();
  if (element.id() != null) {
    traversal = traversal.hasId(element.id());
  } else {
    traversal = traversal.hasLabel(element.label());
    Object[] properties = Properties.id(element);
    if (properties == null || properties.length == 0) {
      properties = Properties.all(element);
    }
    for (Property property : list(properties)) {
      traversal = traversal.has(property.key(), property.value());
    }
  }
  return traversal;
}
 
开发者ID:karthicks,项目名称:gremlin-ogm,代码行数:20,代码来源:ElementGraph.java

示例2: findPersons

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
public List<Person> findPersons(Optional<String> firstName) {

        GraphTraversal<?, ?> traversal = g.V().hasLabel(PERSON.LABEL);

        if(firstName.isPresent()) {
            traversal.has(PERSON.FIRST_NAME, firstName.get());
        }

        return traversal.valueMap(true)
                .toStream()
                .map(this::toPerson)
                .collect(Collectors.toList());
    }
 
开发者ID:experoinc,项目名称:spring-boot-graph-day,代码行数:14,代码来源:PersonRepository.java

示例3: apply

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
@SneakyThrows
public GraphTraversal<Element, Element> apply(GraphTraversal<Element, Element> traversal) {
  traversal.hasLabel(element.label());
  List<Field> fields;
  if (keyType != null) {
    if (is(keyType, PrimaryKey.class)) {
      fields = primaryKeyFields(element);
    } else if (is(keyType, OrderingKey.class)) {
      fields = orderingKeyFields(element);
    } else {
      throw org.apache.tinkerpop.gremlin.object.structure.Element.Exceptions
          .invalidAnnotationType(keyType);
    }
  } else {
    fields = keyFields(element);
  }
  for (Field field : fields) {
    String key = propertyKey(field);
    Object value = propertyValue(field, element);
    if (isMissing(value)) {
      throw org.apache.tinkerpop.gremlin.object.structure.Element.Exceptions.requiredKeysMissing(
          element.getClass(), key);
    }
    traversal.has(key, value);
  }
  return traversal;
}
 
开发者ID:karthicks,项目名称:gremlin-ogm,代码行数:29,代码来源:HasKeys.java

示例4: vertexTraversal

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
private GraphTraversal<Vertex, Vertex> vertexTraversal(GraphTraversal<Vertex, ? extends Element> traversal) {
    // A vertex should always be looked up by vertex property, not the actual vertex ID which may be incorrect.
    // This is because a vertex may represent a reified relation, which will use the original edge ID as an ID.
    
    // We know only vertices have this property, so the cast is safe
    //noinspection unchecked
    return (GraphTraversal<Vertex, Vertex>) traversal.has(Schema.VertexProperty.ID.name(), id().getValue());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:9,代码来源:IdFragment.java

示例5: applyLabelsToTraversal

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
static void applyLabelsToTraversal(
        GraphTraversal<?, Edge> traversal, Schema.EdgeProperty property,
        @Nullable Set<Label> typeLabels, GraknTx tx) {

    if (typeLabels != null) {
        Set<Integer> typeIds =
                typeLabels.stream().map(label -> tx.admin().convertToId(label).getValue()).collect(toSet());
        traversal.has(property.name(), P.within(typeIds));
    }
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:11,代码来源:AbstractRolePlayerFragment.java

示例6: applyTraversalInner

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
        GraphTraversal<Vertex, ? extends Element> traversal, GraknTx graph, Collection<Var> vars) {

    Set<Integer> labelIds =
            labels().stream().map(label -> graph.admin().convertToId(label).getValue()).collect(toSet());

    if (labelIds.size() == 1) {
        int labelId = Iterables.getOnlyElement(labelIds);
        return traversal.has(LABEL_ID.name(), labelId);
    } else {
        return traversal.has(LABEL_ID.name(), P.within(labelIds));
    }
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:15,代码来源:LabelFragment.java

示例7: apply

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal<Element, Element> apply(GraphTraversal<Element, Element> traversal) {
  return traversal.has(label, key, value);
}
 
开发者ID:karthicks,项目名称:gremlin-ogm,代码行数:5,代码来源:Has.java

示例8: isVertex

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
/**
 * Create a traversal that filters to only vertices
 */
static <T> GraphTraversal<T, Vertex> isVertex(GraphTraversal<T, ? extends Element> traversal) {
    // This cast is safe because we filter only to vertices
    //noinspection unchecked
    return (GraphTraversal<T, Vertex>) traversal.has(Schema.VertexProperty.ID.name());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:9,代码来源:Fragments.java

示例9: applyTraversalInner

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
        GraphTraversal<Vertex, ? extends Element> traversal, GraknTx graph, Collection<Var> vars) {

    return traversal.has(Schema.VertexProperty.IS_ABSTRACT.name(), true);
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:7,代码来源:IsAbstractFragment.java

示例10: applyTraversalInner

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
        GraphTraversal<Vertex, ? extends Element> traversal, GraknTx tx, Collection<Var> vars) {
    return traversal.has(DATA_TYPE.name(), dataType().getName());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:6,代码来源:DataTypeFragment.java

示例11: applyTraversalInner

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
        GraphTraversal<Vertex, ? extends Element> traversal, GraknTx graph, Collection<Var> vars) {

    return traversal.has(REGEX.name(), regex());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:7,代码来源:RegexFragment.java

示例12: applyTraversalInner

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal<Vertex, ? extends Element> applyTraversalInner(
        GraphTraversal<Vertex, ? extends Element> traversal, GraknTx graph, Collection<Var> vars) {

    return traversal.has(INDEX.name(), attributeIndex());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:7,代码来源:AttributeIndexFragment.java

示例13: applyPredicate

import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public <S, E> GraphTraversal<S, E> applyPredicate(GraphTraversal<S, E> traversal) {
    return traversal.has(Schema.VertexProperty.VALUE_STRING.name(), regexPredicate());
}
 
开发者ID:graknlabs,项目名称:grakn,代码行数:5,代码来源:RegexPredicate.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal.has方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。