本文整理了Java中org.apache.tinkerpop.gremlin.structure.Element.keys()
方法的一些代码示例,展示了Element.keys()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.keys()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.structure.Element
类名称:Element
方法名:keys
[英]Get the keys of the properties associated with this element. The default implementation iterators the properties and stores the keys into a HashSet.
[中]获取与此元素关联的属性的键。默认实现迭代器属性并将键存储到哈希集中。
代码示例来源:origin: apache/tinkerpop
private Collection<String> getElementKeysAndNormalizeIfRequired(final Element element) {
final Collection<String> keys;
if (normalize) {
keys = new ArrayList<>();
keys.addAll(element.keys());
Collections.sort((List<String>) keys);
} else
keys = element.keys();
return keys;
}
代码示例来源:origin: apache/tinkerpop
@Override
public Set<String> keys() {
return this.element.keys().stream().filter(key -> !computeKeys.contains(key)).collect(Collectors.toSet());
}
代码示例来源:origin: apache/tinkerpop
/**
* Retrieve the properties associated with a particular element.
* The result is a Object[] where odd indices are String keys and even indices are the values.
*
* @param element the element to retrieve properties from
* @param includeId include Element.ID in the key/value list
* @param includeLabel include Element.LABEL in the key/value list
* @param propertiesToCopy the properties to include with an empty list meaning copy all properties
* @return a key/value array of properties where odd indices are String keys and even indices are the values.
*/
public static Object[] getProperties(final Element element, final boolean includeId, final boolean includeLabel, final Set<String> propertiesToCopy) {
final List<Object> keyValues = new ArrayList<>();
if (includeId) {
keyValues.add(T.id);
keyValues.add(element.id());
}
if (includeLabel) {
keyValues.add(T.label);
keyValues.add(element.label());
}
element.keys().forEach(key -> {
if (propertiesToCopy.isEmpty() || propertiesToCopy.contains(key)) {
keyValues.add(key);
keyValues.add(element.value(key));
}
});
return keyValues.toArray(new Object[keyValues.size()]);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
private Collection<String> getElementKeysAndNormalizeIfRequired(final Element element) {
final Collection<String> keys;
if (normalize) {
keys = new ArrayList<>();
keys.addAll(element.keys());
Collections.sort((List<String>) keys);
} else
keys = element.keys();
return keys;
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
public Set<String> keys() {
return this.element.keys().stream().filter(key -> !computeKeys.contains(key)).collect(Collectors.toSet());
}
代码示例来源:origin: HuygensING/timbuctoo
private Set<String> getKeys(Element element, Set<String> propertiesToIgnore) {
return element.keys().stream().filter(key -> !propertiesToIgnore.contains(key)).collect(Collectors.toSet());
}
代码示例来源:origin: MartinHaeusler/chronos
public static void mergeProperties(final Element element, final Element storeElement, final Element ancestorElement,
final PropertyConflictResolutionStrategy strategy) {
checkNotNull(element, "Precondition violation - argument 'element' must not be NULL!");
checkNotNull(storeElement, "Precondition violation - argument 'storeElement' must not be NULL!");
checkNotNull(strategy, "Precondition violation - argument 'strategy' must not be NULL!");
// get all element property keys
Set<String> elementKeys = Sets.newHashSet(element.keys());
Set<String> storeElementKeys = Sets.newHashSet(storeElement.keys());
Set<String> allKeys = Sets.union(elementKeys, storeElementKeys);
for (String propertyKey : allKeys) {
mergeSingleProperty(propertyKey, element, storeElement, ancestorElement, strategy);
}
}
代码示例来源:origin: com.syncleus.ferma/ferma
@Override
public Set<String> getPropertyKeys() {
return getElement().keys();
}
代码示例来源:origin: apache/atlas
@Override
public Set<String> getPropertyKeys() {
return getWrappedElement().keys();
}
代码示例来源:origin: Syncleus/Ferma
@Override
public Set<String> getPropertyKeys() {
return getElement().keys();
}
代码示例来源:origin: apache/incubator-atlas
@Override
public Set<String> getPropertyKeys() {
return getWrappedElement().keys();
}
代码示例来源:origin: org.jboss.windup.graph/windup-graph-api
/**
* A string representation of this vertex, showing it's properties in a JSON-like format.
*/
default String toPrettyString()
{
Element v = getElement();
StringBuilder result = new StringBuilder();
result.append("[").append(v.toString()).append("=");
result.append("{");
boolean hasSome = false;
for (String propKey : v.keys())
{
hasSome = true;
Iterator<? extends Property<Object>> propVal = v.properties(propKey);
List<Object> propValues = new ArrayList<>();
propVal.forEachRemaining(prop -> propValues.add(prop.value()));
if (propValues.size() == 1)
result.append(propKey).append(": ").append(propValues.get(0));
else
result.append(propKey).append(": ").append(propValues);
result.append(", ");
}
if (hasSome)
{
result.delete(result.length() - 2, result.length());
}
result.append("}]");
return result.toString();
}
代码示例来源:origin: windup/windup
/**
* A string representation of this vertex, showing it's properties in a JSON-like format.
*/
default String toPrettyString()
{
Element v = getElement();
StringBuilder result = new StringBuilder();
result.append("[").append(v.toString()).append("=");
result.append("{");
boolean hasSome = false;
for (String propKey : v.keys())
{
hasSome = true;
Iterator<? extends Property<Object>> propVal = v.properties(propKey);
List<Object> propValues = new ArrayList<>();
propVal.forEachRemaining(prop -> propValues.add(prop.value()));
if (propValues.size() == 1)
result.append(propKey).append(": ").append(propValues.get(0));
else
result.append(propKey).append(": ").append(propValues);
result.append(", ");
}
if (hasSome)
{
result.delete(result.length() - 2, result.length());
}
result.append("}]");
return result.toString();
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
/**
* Retrieve the properties associated with a particular element.
* The result is a Object[] where odd indices are String keys and even indices are the values.
*
* @param element the element to retrieve properties from
* @param includeId include Element.ID in the key/value list
* @param includeLabel include Element.LABEL in the key/value list
* @param propertiesToCopy the properties to include with an empty list meaning copy all properties
* @return a key/value array of properties where odd indices are String keys and even indices are the values.
*/
public static Object[] getProperties(final Element element, final boolean includeId, final boolean includeLabel, final Set<String> propertiesToCopy) {
final List<Object> keyValues = new ArrayList<>();
if (includeId) {
keyValues.add(T.id);
keyValues.add(element.id());
}
if (includeLabel) {
keyValues.add(T.label);
keyValues.add(element.label());
}
element.keys().forEach(key -> {
if (propertiesToCopy.isEmpty() || propertiesToCopy.contains(key)) {
keyValues.add(key);
keyValues.add(element.value(key));
}
});
return keyValues.toArray(new Object[keyValues.size()]);
}
内容来源于网络,如有侵权,请联系作者删除!