本文整理了Java中org.apache.tinkerpop.gremlin.structure.Element.label()
方法的一些代码示例,展示了Element.label()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.label()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.structure.Element
类名称:Element
方法名:label
[英]Gets the label for the graph Element which helps categorize it.
[中]获取有助于对其进行分类的图形元素的标签。
代码示例来源:origin: apache/tinkerpop
@Override
public String apply(final Element element) {
return element.label();
}
},
代码示例来源:origin: apache/tinkerpop
@Override
public String label() {
return this.element.label();
}
代码示例来源:origin: apache/tinkerpop
@Override
public String label() {
return this.baseElement.label();
}
代码示例来源:origin: apache/tinkerpop
protected DetachedElement(final Element element) {
this.id = element.id();
try {
this.label = element.label();
} catch (final UnsupportedOperationException e) { // ghetto.
this.label = Vertex.DEFAULT_LABEL;
}
}
代码示例来源:origin: apache/tinkerpop
@Override
protected String map(final Traverser.Admin<S> traverser) {
return traverser.get().label();
}
代码示例来源:origin: apache/tinkerpop
protected boolean testLabel(Element element) {
return this.predicate.test(element.label());
}
代码示例来源:origin: apache/tinkerpop
public ReferenceElement(final Element element) {
this.id = element.id();
try {
//Exception creation takes too much time, return default values for known types
if (element instanceof ComputerGraph.ComputerAdjacentVertex) {
this.label = Vertex.DEFAULT_LABEL;
} else {
this.label = element.label();
}
} catch (final UnsupportedOperationException e) {
if (element instanceof Vertex)
this.label = Vertex.DEFAULT_LABEL;
else if (element instanceof Edge)
this.label = Edge.DEFAULT_LABEL;
else
this.label = VertexProperty.DEFAULT_LABEL;
}
}
代码示例来源: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: apache/tinkerpop
if (includeToken(WithOptions.values)) map.put(T.value, ((VertexProperty<?>) element).value());
} else {
if (includeToken(WithOptions.labels)) map.put(T.label, element.label());
代码示例来源:origin: apache/tinkerpop
@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final Property property) {
output.writeString(property.key());
kryo.writeClassAndObject(output, property.value());
kryo.writeClassAndObject(output, property.element().id());
output.writeString(property.element().label());
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
public String apply(final Element element) {
return element.label();
}
},
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
protected String map(final Traverser.Admin<S> traverser) {
return traverser.get().label();
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
protected DetachedElement(final Element element) {
this.id = element.id();
try {
this.label = element.label();
} catch (final UnsupportedOperationException e) { // ghetto.
this.label = Vertex.DEFAULT_LABEL;
}
}
代码示例来源:origin: org.hawkular.inventory/hawkular-inventory-impl-tinkerpop
@Override
public boolean isBackendInternal(Element element) {
return (element instanceof Vertex && element.property(Constants.Property.__type.name()).value().equals(
Constants.InternalType.__identityHash.name())) || (element instanceof Edge && (
element.label().equals(Constants.InternalEdge.__withIdentityHash.name()) ||
element.label().equals(Constants.InternalEdge.__containsIdentityHash.name())
));
}
代码示例来源:origin: rmagen/elastic-gremlin
public void addElement(Element element, String index, String routing, boolean create) {
IndexRequestBuilder indexRequest = client.prepareIndex(index, element.label(), element.id().toString())
.setSource(propertiesMap(element)).setRouting(routing).setCreate(create);
if(bulkRequest != null) bulkRequest.add(indexRequest);
else indexRequest.execute().actionGet();
revision++;
}
代码示例来源:origin: rayokota/hgraphdb
@Override
public Iterator<Mutation> constructMutations() {
byte[] bytes = ValueUtils.serializePropertyValue(graph, ((HBaseElement) element).getElementType(), element.label(), key, value);
Put put = new Put(ValueUtils.serializeWithSalt(element.id()));
put.addColumn(Constants.DEFAULT_FAMILY_BYTES, Bytes.toBytes(key), bytes);
put.addColumn(Constants.DEFAULT_FAMILY_BYTES, Constants.UPDATED_AT_BYTES,
ValueUtils.serialize(((HBaseElement) element).updatedAt()));
return IteratorUtils.of(put);
}
}
代码示例来源:origin: org.hawkular.inventory/hawkular-inventory-impl-tinkerpop
@Override
public boolean hasRelationship(Element source, Element target, String relationshipName) {
if (!(source instanceof Vertex) || !(target instanceof Vertex)) {
return false;
}
Iterator<?> it = context.getGraph().traversal()
.V(source).out(relationshipName).hasLabel(target.label()).is(target);
return closeAfter(it, it::hasNext);
}
代码示例来源:origin: rmagen/elastic-gremlin
public void updateElement(Element element, String index, String routing, boolean upsert) throws ExecutionException, InterruptedException {
UpdateRequest updateRequest = new UpdateRequest(index, element.label(), element.id().toString())
.doc(propertiesMap(element)).routing(routing);
if(upsert)
updateRequest.detectNoop(true).docAsUpsert(true);
if(bulkRequest != null) bulkRequest.add(updateRequest);
else client.update(updateRequest).actionGet();
revision++;
}
代码示例来源:origin: rayokota/hgraphdb
protected static Iterator<? extends Mutation> constructMutations(
HBaseGraph graph, IndexMetadata index, ElementReader<?> reader, Result result)
throws IOException, InterruptedException {
Element element = reader.parse(result);
if (element.label().equals(index.label()) && ((HBaseElement) element).hasProperty(index.propertyKey())) {
Mutator remover = index.type() == ElementType.EDGE
? new EdgeIndexRemover(graph, (Edge) element, index.propertyKey(), null)
: new VertexIndexRemover(graph, (Vertex) element, index.propertyKey(), null);
return remover.constructMutations();
}
return Collections.emptyIterator();
}
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final Property property) {
output.writeString(property.key());
kryo.writeClassAndObject(output, property.value());
kryo.writeClassAndObject(output, property.element().id());
output.writeString(property.element().label());
}
内容来源于网络,如有侵权,请联系作者删除!