本文整理了Java中org.apache.tinkerpop.gremlin.structure.Element.properties()
方法的一些代码示例,展示了Element.properties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.properties()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.structure.Element
类名称:Element
方法名:properties
[英]Get an Iterator of properties where the propertyKeys is meant to be a filter on the available keys. If no keys are provide then return all the properties.
[中]获取属性迭代器,其中propertyKeys是可用键的过滤器。如果未提供任何键,则返回所有属性。
代码示例来源:origin: thinkaurelius/titan
@Override
protected Iterator<E> flatMap(final Traverser.Admin<Element> traverser) {
if (useMultiQuery) { //it is guaranteed that all elements are vertices
assert multiQueryResults != null;
return convertIterator(multiQueryResults.get(traverser.get()));
} else if (traverser.get() instanceof Vertex) {
TitanVertexQuery query = makeQuery((TitanTraversalUtil.getTitanVertex(traverser)).query());
return convertIterator(query.properties());
} else {
//It is some other element (edge or vertex property)
Iterator<E> iter;
if (getReturnType().forValues()) {
assert orders.isEmpty() && hasContainers.isEmpty();
iter = traverser.get().values(getPropertyKeys());
} else {
//this asks for properties
assert orders.isEmpty();
//HasContainers don't apply => empty result set
if (!hasContainers.isEmpty()) return Collections.emptyIterator();
iter = (Iterator<E>) traverser.get().properties(getPropertyKeys());
}
if (limit!=Query.NO_LIMIT) iter = Iterators.limit(iter,limit);
return iter;
}
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
protected Iterator<E> flatMap(final Traverser.Admin<Element> traverser) {
if (useMultiQuery) { //it is guaranteed that all elements are vertices
assert multiQueryResults != null;
return convertIterator(multiQueryResults.get(traverser.get()));
} else if (traverser.get() instanceof JanusGraphVertex || traverser.get() instanceof WrappedVertex) {
final JanusGraphVertexQuery query = makeQuery((JanusGraphTraversalUtil.getJanusGraphVertex(traverser)).query());
return convertIterator(query.properties());
} else {
//It is some other element (edge or vertex property)
Iterator<E> iterator;
if (getReturnType().forValues()) {
assert orders.isEmpty() && hasContainers.isEmpty();
iterator = traverser.get().values(getPropertyKeys());
} else {
//this asks for properties
assert orders.isEmpty();
//HasContainers don't apply => empty result set
if (!hasContainers.isEmpty()) return Collections.emptyIterator();
iterator = (Iterator<E>) traverser.get().properties(getPropertyKeys());
}
if (limit!=Query.NO_LIMIT) iterator = Iterators.limit(iterator,limit);
return iterator;
}
}
代码示例来源:origin: apache/tinkerpop
public static Map<String, Property> propertyMap(final Element element, final String... propertyKeys) {
final Map<String, Property> propertyMap = new HashMap<>();
element.properties(propertyKeys).forEachRemaining(property -> propertyMap.put(property.key(), property));
return propertyMap;
}
代码示例来源:origin: apache/tinkerpop
/**
* Get the keys of the properties associated with this element.
* The default implementation iterators the properties and stores the keys into a {@link HashSet}.
*
* @return The property key set
*/
public default Set<String> keys() {
final Set<String> keys = new HashSet<>();
this.properties().forEachRemaining(property -> keys.add(property.key()));
return Collections.unmodifiableSet(keys);
}
代码示例来源:origin: apache/tinkerpop
/**
* Add or set a property value for the {@code Element} given its key.
*/
public <V> Property<V> property(final String key, final V value);
代码示例来源:origin: apache/tinkerpop
public static Map<String, Object> propertyValueMap(final Element element, final String... propertyKeys) {
final Map<String, Object> values = new HashMap<>();
element.properties(propertyKeys).forEachRemaining(property -> values.put(property.key(), property.value()));
return values;
}
代码示例来源:origin: apache/tinkerpop
@Override
public <V> Iterator<? extends Property<V>> properties(final String... propertyKeys) {
return (Iterator) IteratorUtils.filter(this.element.properties(propertyKeys), property -> !computeKeys.contains(property.key()));
}
代码示例来源:origin: apache/tinkerpop
/**
* Get the values of properties as an {@link Iterator}.
*/
public default <V> Iterator<V> values(final String... propertyKeys) {
return IteratorUtils.map(this.<V>properties(propertyKeys), property -> property.value());
}
代码示例来源:origin: apache/tinkerpop
private static void writeElementProperties(final KryoShim kryo, final OutputShim output, final Element element) {
final Iterator<? extends Property> properties = element.properties();
output.writeBoolean(properties.hasNext());
while (properties.hasNext()) {
final Property p = properties.next();
output.writeString(p.key());
kryo.writeClassAndObject(output, p.value());
output.writeBoolean(properties.hasNext());
}
}
}
代码示例来源:origin: apache/tinkerpop
@Override
protected Iterator<E> flatMap(final Traverser.Admin<Element> traverser) {
return this.returnType.equals(PropertyType.VALUE) ?
traverser.get().values(this.propertyKeys) :
(Iterator) traverser.get().properties(this.propertyKeys);
}
代码示例来源:origin: apache/tinkerpop
element.properties(this.propertyKeys) :
TraversalUtil.applyAll(traverser, this.propertyTraversal);
代码示例来源: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: org.jboss.windup.graph/windup-graph-api
@Override
public void deinit(Element element)
{
element.properties(WindupFrame.TYPE_PROP).forEachRemaining(Property::remove);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
public static Map<String, Property> propertyMap(final Element element, final String... propertyKeys) {
final Map<String, Property> propertyMap = new HashMap<>();
element.properties(propertyKeys).forEachRemaining(property -> propertyMap.put(property.key(), property));
return propertyMap;
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
/**
* Get the keys of the properties associated with this element.
* The default implementation iterators the properties and stores the keys into a {@link HashSet}.
*
* @return The property key set
*/
public default Set<String> keys() {
final Set<String> keys = new HashSet<>();
this.properties().forEachRemaining(property -> keys.add(property.key()));
return Collections.unmodifiableSet(keys);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
public static Map<String, Object> propertyValueMap(final Element element, final String... propertyKeys) {
final Map<String, Object> values = new HashMap<>();
element.properties(propertyKeys).forEachRemaining(property -> values.put(property.key(), property.value()));
return values;
}
代码示例来源:origin: rmagen/elastic-gremlin
private Map propertiesMap(Element element) {
if(element instanceof BaseElement)
return ((BaseElement)element).allFields();
Map<String, Object> map = new HashMap<>();
element.properties().forEachRemaining(property -> map.put(property.key(), property.value()));
return map;
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
/**
* Get the values of properties as an {@link Iterator}.
*/
public default <V> Iterator<V> values(final String... propertyKeys) {
return IteratorUtils.map(this.<V>properties(propertyKeys), property -> property.value());
}
代码示例来源:origin: unipop-graph/unipop
public static <E extends Element> Map<String, Object> fullProperties(E element) {
Map<String, Object> properties = new HashMap<>();
properties.put(T.id.getAccessor(), element.id());
properties.put(T.label.getAccessor(), element.label());
element.properties().forEachRemaining(property -> properties.put(property.key(), property.value()));
return properties;
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
private static void writeElementProperties(final KryoShim kryo, final OutputShim output, final Element element) {
final Iterator<? extends Property> properties = element.properties();
output.writeBoolean(properties.hasNext());
while (properties.hasNext()) {
final Property p = properties.next();
output.writeString(p.key());
kryo.writeClassAndObject(output, p.value());
output.writeBoolean(properties.hasNext());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!