本文整理汇总了Java中org.apache.tinkerpop.gremlin.structure.VertexProperty.isPresent方法的典型用法代码示例。如果您正苦于以下问题:Java VertexProperty.isPresent方法的具体用法?Java VertexProperty.isPresent怎么用?Java VertexProperty.isPresent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.structure.VertexProperty
的用法示例。
在下文中一共展示了VertexProperty.isPresent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOrCreateVertexProperty
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public VertexProperty getOrCreateVertexProperty(final VertexProperty<?> property, final Vertex vertex, final Graph graph, final GraphTraversalSource g) {
final VertexProperty<?> vp;
final VertexProperty<?> existing = vertex.property(property.key());
if (!existing.isPresent()) {
return createVertexProperty(property, vertex, graph, g);
}
if (!existing.value().equals(property.value())) {
vp = vertex.property(property.key(), property.value());
} else {
vp = existing;
}
property.properties().forEachRemaining(metaProperty -> {
final Property<?> existing2 = vp.property(metaProperty.key());
if (!existing2.isPresent() || !existing2.value().equals(metaProperty.value())) {
vp.property(metaProperty.key(), metaProperty.value());
}
});
return vp;
}
示例2: properties
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys) {
ArrayList<VertexProperty<V>> ans = new ArrayList<VertexProperty<V>>();
if (propertyKeys.length == 0) {
if (this.properties == null) return Collections.emptyIterator();
propertyKeys = this.properties.getPropertyKeys();
}
for (String key : propertyKeys) {
VertexProperty<V> prop = property(key);
if (prop.isPresent()) ans.add(prop);
}
return ans.iterator();
}
示例3: getPropertyOrEmptyString
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
public static String getPropertyOrEmptyString(final Vertex vertex, final String propertyKey) {
VertexProperty<String> property = vertex.property(propertyKey);
if (property.isPresent()) {
return property.value();
}
return "";
}
示例4: getPropertyOrFail
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
public static String getPropertyOrFail(final Vertex vertex, final String propertyKey) {
VertexProperty<String> property = vertex.property(propertyKey);
if (property.isPresent()) {
return property.value();
}
throw new IllegalStateException(
String.format("The vertex with id '%s' does not conatin the expected property '%s'.", vertex.id(),
propertyKey));
}
示例5: getPropertyOrNull
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
public static String getPropertyOrNull(final Vertex vertex, final String propertyKey) {
VertexProperty<String> property = vertex.property(propertyKey);
if (property.isPresent()) {
return property.value();
}
return null;
}
示例6: compare
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public int compare(VertexProperty<T> left, VertexProperty<T> right) {
if (!left.isPresent()) {
return !right.isPresent() ? 0 : (presentFirst ? -1 : 1);
} else if (!right.isPresent()) {
return presentFirst ? 1 : -1;
} else {
return delegate != null ? delegate.compare(left.value(), right.value()) : 0;
}
}
示例7: computeNodeLabel
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Nullable
private static String computeNodeLabel(Vertex vertex) {
if (vertex.label().equals(Bdio.Class.Project.name())
|| vertex.label().equals(Bdio.Class.Component.name())) {
return vertex.<String> property(Bdio.DataProperty.name.name()).orElse(null);
} else if (vertex.label().equals(Bdio.Class.File.name())) {
VertexProperty<String> path = vertex.property(Bdio.DataProperty.path.name());
return path.isPresent() ? HID.from(URI.create(path.value())).getName() : vertex.id().toString();
} else {
return null;
}
}
示例8: 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();
}
示例9: addStart
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
@Override
public void addStart(final Traverser.Admin<Vertex> start) {
final VertexProperty<TraverserSet<Object>> property = start.get().<TraverserSet<Object>>property(TraversalVertexProgram.HALTED_TRAVERSERS);
this.count = property.isPresent() ? property.value().bulkSize() : 0l;
}
示例10: optionalValue
import org.apache.tinkerpop.gremlin.structure.VertexProperty; //导入方法依赖的package包/类
/**
* Returns an optional representing the value of the vertex property. While the vertex property itself has methods
* like {@code orElse}, it lacks methods like {@code map}.
*/
public static <T> Optional<T> optionalValue(VertexProperty<T> vp) {
return vp.isPresent() ? Optional.of(vp.value()) : Optional.empty();
}