本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal.property方法的典型用法代码示例。如果您正苦于以下问题:Java GraphTraversal.property方法的具体用法?Java GraphTraversal.property怎么用?Java GraphTraversal.property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal
的用法示例。
在下文中一共展示了GraphTraversal.property方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
@SneakyThrows
public GraphTraversal<Element, Element> apply(GraphTraversalSource g) {
GraphTraversal traversal = g.addV(element.label());
if (element.id() != null && HasFeature.Verifier.of(g)
.verify(supportsUserSuppliedIds(element))) {
traversal.property(T.id, element.id());
}
for (Field field : keyFields(element)) {
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.property(key, value);
}
return traversal;
}
示例2: insertList
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
private static void insertList(final List list, final String listKey, final GraphTraversal traversal) {
if (list.get(0) instanceof List)
throw new IllegalArgumentException("Lists can not contain nested lists");
char state = list.get(0) instanceof Map ? 'o' : 'p';
for (int i = 1; i < list.size(); i++) {
if (list.get(i) instanceof Map && 'p' == state)
throw new IllegalArgumentException("Lists can only support all objects or all primitives");
else if (list.get(i) instanceof List)
throw new IllegalArgumentException("Lists can not contain nested lists");
else if (!(list.get(i) instanceof Map) && 'o' == state)
throw new IllegalArgumentException("Lists can only support all objects or all primitives");
}
for (final Object object : list) {
if ('p' == state)
traversal.property(VertexProperty.Cardinality.list, listKey, object);
else {
traversal.map(insertMap((Map) object, new DefaultGraphTraversal()));
traversal.addE(listKey).from("a").select("a");
}
}
}
示例3: create
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
protected <V extends Vertex> GraphTraversal create(V vertex) {
GraphTraversal traversal = g
.addV(vertex.label());
Object vertexId = maybeSupplyId(vertex);
if (vertexId != null) {
traversal.property(T.id, vertexId);
}
return update(traversal, vertex, Properties::all);
}
示例4: create
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
<E extends Edge> GraphTraversal create(E edge, Object fromId, Object toId) {
GraphTraversal traversal = g
.V().hasId(fromId).as("from")
.V().hasId(toId).as("to")
.addE(edge.label()).as("edge").from("from");
Object edgeId = maybeSupplyId(edge);
if (edgeId != null) {
traversal.property(T.id, edgeId);
}
return update(traversal, edge, Properties::all);
}
示例5: property
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; //导入方法依赖的package包/类
@Override
public GraphTraversal property(GraphTraversal traversal, Update update) {
if (update.getCardinality() != null) {
traversal.property(update.getCardinality(),
update.getKey(),
update.getValue(),
update.getKeyValues());
} else {
traversal.property(update.getKey(),
update.getValue());
}
return traversal;
}