本文整理了Java中org.apache.tinkerpop.gremlin.structure.Property.isPresent()
方法的一些代码示例,展示了Property.isPresent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.isPresent()
方法的具体详情如下:
包路径:org.apache.tinkerpop.gremlin.structure.Property
类名称:Property
方法名:isPresent
[英]Whether the property is empty or not.
[中]属性是否为空。
代码示例来源:origin: thinkaurelius/titan
@Override
public void map(final Vertex vertex, final MapEmitter<Object, Double> emitter) {
final Property pageRank = vertex.property(PageRankVertexProgram.PAGE_RANK);
if (pageRank.isPresent()) {
emitter.emit(vertex.id(), (Double) pageRank.value());
}
}
代码示例来源:origin: thinkaurelius/titan
@Override
public void map(final Vertex vertex, final MapEmitter<Object, Long> emitter) {
final Property distance = vertex.property(ShortestDistanceVertexProgram.DISTANCE);
if (distance.isPresent()) {
emitter.emit(vertex.id(), (Long) distance.value());
}
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public void map(final Vertex vertex, final MapEmitter<Object, Long> emitter) {
final Property distance = vertex.property(ShortestDistanceVertexProgram.DISTANCE);
if (distance.isPresent()) {
emitter.emit(vertex.id(), (Long) distance.value());
}
}
代码示例来源:origin: JanusGraph/janusgraph
@Override
public void map(final Vertex vertex, final MapEmitter<Object, Double> emitter) {
final Property pageRank = vertex.property(PageRankVertexProgram.PAGE_RANK);
if (pageRank.isPresent()) {
emitter.emit(vertex.id(), (Double) pageRank.value());
}
}
代码示例来源:origin: JanusGraph/janusgraph
private void assertGeoshape(Function<Geoshape,Geoshape> makeGeoshape) {
graph.traversal().E().has("place").toList().forEach(e-> {
assertTrue(e.property("shape").isPresent());
Geoshape place = (Geoshape) e.property("place").value();
Geoshape expected = makeGeoshape.apply(place);
Geoshape actual = (Geoshape) e.property("shape").value();
assertEquals(expected, actual);
});
}
代码示例来源:origin: thinkaurelius/titan
assertEquals(v1id, getId(v));
TitanEdge e = Iterables.getOnlyElement(changes.getEdges(v, Change.REMOVED, Direction.OUT, "knows"));
assertFalse(e.property("weight").isPresent());
assertEquals(v, e.vertex(Direction.IN));
e = Iterables.getOnlyElement(changes.getEdges(v, Change.ADDED, Direction.OUT, "knows"));
代码示例来源:origin: apache/tinkerpop
@Override
public boolean isPresent() {
return this.property.isPresent();
}
代码示例来源:origin: apache/tinkerpop
@Override
public boolean isPresent() {
return this.baseProperty.isPresent();
}
代码示例来源:origin: thinkaurelius/titan
assertEquals(111.1, v1.<Float>value("weight").doubleValue(), 0.01);
Edge e = getOnlyElement(v1.query().direction(Direction.OUT).labels("knows").edges());
assertFalse(e.property("weight").isPresent());
e.property("weight", 44.4);
tx2.commit();
代码示例来源:origin: JanusGraph/janusgraph
assertEquals(111.1, v1.<Float>value("weight").doubleValue(), 0.01);
final Edge e = Iterables.getOnlyElement(v1.query().direction(Direction.OUT).labels("knows").edges());
assertFalse(e.property("weight").isPresent());
e.property("weight", 44.4);
tx2.commit();
JanusGraphEdge e1
= Iterables.getOnlyElement(changes.getEdges(v, Change.REMOVED, Direction.OUT, "knows"));
assertFalse(e1.property("weight").isPresent());
assertEquals(v, e1.vertex(Direction.IN));
e1 = Iterables.getOnlyElement(changes.getEdges(v, Change.ADDED, Direction.OUT, "knows"));
代码示例来源:origin: apache/tinkerpop
/**
* If the value is present, return the value, else return the provided value.
*
* @param otherValue The value to return if the property is not present
* @return A value
*/
public default V orElse(final V otherValue) {
return this.isPresent() ? this.value() : otherValue;
}
代码示例来源:origin: apache/tinkerpop
/**
* If the value is present, return the value, else generate a value given the {@link Supplier}.
*
* @param valueSupplier The supplier to use to generate a value if the property is not present
* @return A value
*/
public default V orElseGet(final Supplier<? extends V> valueSupplier) {
return this.isPresent() ? this.value() : valueSupplier.get();
}
代码示例来源:origin: apache/tinkerpop
/**
* If the property is present, the consume the value as specified by the {@link Consumer}.
*
* @param consumer The consumer to process the existing value.
*/
public default void ifPresent(final Consumer<? super V> consumer) {
if (this.isPresent())
consumer.accept(this.value());
}
代码示例来源:origin: thinkaurelius/titan
v3 = graph.addVertex();
Edge e = v1.addEdge("knows", v3);
assertFalse(e.property("age").isPresent());
代码示例来源:origin: JanusGraph/janusgraph
v3 = graph.addVertex();
Edge e = v1.addEdge("knows", v3);
assertFalse(e.property("age").isPresent());
代码示例来源:origin: apache/tinkerpop
@Override
public void map(final Vertex vertex, final MapEmitter<Serializable, Long> emitter) {
final Property<Serializable> cluster = vertex.property(PeerPressureVertexProgram.CLUSTER);
if (cluster.isPresent()) {
emitter.emit(cluster.value(), 1l);
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public <V> Property<V> property(final String key, final V value) {
if (this.removed) throw elementAlreadyRemoved(Edge.class, id);
ElementHelper.validateProperty(key, value);
final Property oldProperty = super.property(key);
final Property<V> newProperty = new TinkerProperty<>(this, key, value);
if (null == this.properties) this.properties = new HashMap<>();
this.properties.put(key, newProperty);
TinkerHelper.autoUpdateIndex(this, key, value, oldProperty.isPresent() ? oldProperty.value() : null);
return newProperty;
}
代码示例来源:origin: apache/tinkerpop
@Override
public void map(final Vertex vertex, final MapEmitter<Object, Double> emitter) {
final Property pageRank = vertex.property(PageRankVertexProgram.PAGE_RANK);
if (pageRank.isPresent()) {
emitter.emit(vertex.id(), (Double) pageRank.value());
}
}
代码示例来源:origin: apache/tinkerpop
@Override
public void map(final Vertex vertex, final MapEmitter<NullObject, Serializable> emitter) {
final Property<Serializable> cluster = vertex.property(PeerPressureVertexProgram.CLUSTER);
if (cluster.isPresent()) {
emitter.emit(NullObject.instance(), cluster.value());
}
}
代码示例来源:origin: apache/tinkerpop
public static void validatePropertyEquality(final Property originalProperty, final Property otherProperty) {
assertEquals(originalProperty, otherProperty);
assertEquals(otherProperty, originalProperty);
if (originalProperty.isPresent()) {
assertEquals(originalProperty.key(), otherProperty.key());
assertEquals(originalProperty.value(), otherProperty.value());
assertEquals(originalProperty.element(), otherProperty.element());
}
}
内容来源于网络,如有侵权,请联系作者删除!