本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.VertexProperty.empty方法的典型用法代码示例。如果您正苦于以下问题:Java VertexProperty.empty方法的具体用法?Java VertexProperty.empty怎么用?Java VertexProperty.empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.VertexProperty
的用法示例。
在下文中一共展示了VertexProperty.empty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVertexProperty
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <V> VertexProperty<V> getVertexProperty(final Neo4jVertex vertex, final String key) {
final Neo4jNode node = vertex.getBaseVertex();
if (node.hasProperty(key)) {
if (node.getProperty(key).equals(VERTEX_PROPERTY_TOKEN)) {
if (node.degree(Neo4jDirection.OUTGOING, Graph.Hidden.hide(key)) > 1)
throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
else {
return (VertexProperty<V>) new Neo4jVertexProperty<>(vertex, node.relationships(Neo4jDirection.OUTGOING, Graph.Hidden.hide(key)).iterator().next().end());
}
} else {
return new Neo4jVertexProperty<>(vertex, key, (V) node.getProperty(key));
}
} else
return VertexProperty.<V>empty();
}
示例2: property
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public <V> VertexProperty<V> property(String key) {
Objects.requireNonNull(key, "key cannot be null");
// check we have a property with the given key
Collection<?> collection = properties.get(key);
if (collection != null) {
// check size
if (collection.size() == 1) {
// iterator
Iterator<?> iterator = collection.iterator();
// advance iterator to first element
if (iterator.hasNext()) {
// first element
return (VertexProperty<V>)iterator.next();
}
return VertexProperty.empty();
}
// exception
throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
}
return VertexProperty.empty();
}
示例3: specificProperty
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
protected <V> VertexProperty<V> specificProperty(String key) {
if (key == NAME && name != null) {
return new TinkerVertexProperty(this, key, name);
} else if (key == SONG_TYPE && songType != null) {
return new TinkerVertexProperty(this, key, songType);
} else if (key == PERFORMANCES && performances != null) {
return new TinkerVertexProperty(this, key, performances);
} else {
return VertexProperty.empty();
}
}
示例4: specificProperty
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
protected <V> VertexProperty<V> specificProperty(String key) {
if (key == NAME && name != null) {
return new TinkerVertexProperty(this, key, name);
} else {
return VertexProperty.empty();
}
}
示例5: property
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <T> VertexProperty<T> property(String key) {
T value = value(key);
if (value == null) {
return VertexProperty.<T>empty();
} else {
return new BitsyVertexProperty<T>(this, key, value);
}
}
示例6: property
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <V> VertexProperty<V> property(final String key) {
final VertexProperty<V> vertexProperty = getBaseVertex().<V>property(key);
return vertexProperty.isPresent() ?
new HadoopVertexProperty<>((VertexProperty<V>) ((Vertex) this.baseElement).property(key), this) :
VertexProperty.<V>empty();
}
示例7: property
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <V> VertexProperty<V> property(final String key) {
if (null != this.properties && this.properties.containsKey(key)) {
final List<VertexProperty> list = (List) this.properties.get(key);
if (list.size() > 1)
throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
else
return list.get(0);
} else
return VertexProperty.<V>empty();
}
示例8: sideEffect
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
protected void sideEffect(final Traverser.Admin<S> traverser) {
final String key = (String) this.parameters.get(traverser, T.key, () -> {
throw new IllegalStateException("The AddPropertyStep does not have a provided key: " + this);
}).get(0);
final Object value = this.parameters.get(traverser, T.value, () -> {
throw new IllegalStateException("The AddPropertyStep does not have a provided value: " + this);
}).get(0);
final Object[] vertexPropertyKeyValues = this.parameters.getKeyValues(traverser, T.key, T.value);
final Element element = traverser.get();
if (this.callbackRegistry != null) {
final Property currentProperty = traverser.get().property(key);
final boolean newProperty = element instanceof Vertex ? currentProperty == VertexProperty.empty() : currentProperty == Property.empty();
final Event.ElementPropertyChangedEvent evt;
if (element instanceof Vertex)
evt = new Event.VertexPropertyChangedEvent(DetachedFactory.detach((Vertex) element, true), newProperty ? null : DetachedFactory.detach((VertexProperty) currentProperty, true), value, vertexPropertyKeyValues);
else if (element instanceof Edge)
evt = new Event.EdgePropertyChangedEvent(DetachedFactory.detach((Edge) element, true), newProperty ? null : DetachedFactory.detach(currentProperty), value);
else if (element instanceof VertexProperty)
evt = new Event.VertexPropertyPropertyChangedEvent(DetachedFactory.detach((VertexProperty) element, true), newProperty ? null : DetachedFactory.detach(currentProperty), value);
else
throw new IllegalStateException(String.format("The incoming object cannot be processed by change eventing in %s: %s", AddPropertyStep.class.getName(), element));
this.callbackRegistry.getCallbacks().forEach(c -> c.accept(evt));
}
if (null != this.cardinality)
((Vertex) element).property(this.cardinality, key, value, vertexPropertyKeyValues);
else if (vertexPropertyKeyValues.length > 0)
((Vertex) element).property(key, value, vertexPropertyKeyValues);
else
element.property(key, value);
}
示例9: property
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <V> VertexProperty<V> property(final String key) {
V value = getProperty(key);
return value != null ? new HBaseVertexProperty<>(graph, this, key, value) : VertexProperty.empty();
}
示例10: getVertexProperty
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <V> VertexProperty<V> getVertexProperty(final Neo4jVertex vertex, final String key) {
return vertex.getBaseVertex().hasProperty(key) ? new Neo4jVertexProperty<>(vertex, key, (V) vertex.getBaseVertex().getProperty(key)) : VertexProperty.<V>empty();
}