Java Code Examples for org.apache.tinkerpop.gremlin.structure.VertexProperty#remove()

The following examples show how to use org.apache.tinkerpop.gremlin.structure.VertexProperty#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphVertexMapper.java    From egeria with Apache License 2.0 5 votes vote down vote up
private void removeProperty(Vertex vertex, String qualifiedPropName) {
    // no value has been specified - remove the property from the vertex
    VertexProperty vp = vertex.property(qualifiedPropName);
    if (vp != null) {
        vp.remove();
    }
}
 
Example 2
Source File: GraphOMRSClassificationMapper.java    From egeria with Apache License 2.0 5 votes vote down vote up
private void removeProperty(Vertex vertex, String qualifiedPropName)
{
    // no value has been specified - remove the property from the vertex
    VertexProperty vp = vertex.property(getPropertyKeyClassification(qualifiedPropName));
    if (vp != null) {
        vp.remove();
    }
}
 
Example 3
Source File: GraphOMRSEntityMapper.java    From egeria with Apache License 2.0 5 votes vote down vote up
private void removeProperty(Vertex vertex, String qualifiedPropName) {
    // no value has been specified - remove the property from the vertex
    VertexProperty vp = vertex.property(getPropertyKeyEntity(qualifiedPropName));
    if (vp != null) {
        vp.remove();
    }
}
 
Example 4
Source File: GraphOMRSEntityMapper.java    From egeria with Apache License 2.0 5 votes vote down vote up
private void removeCoreProperty(Vertex vertex, String prefixedPropName) {
    // no value has been specified - remove the property from the vertex
    VertexProperty vp = vertex.property(prefixedPropName);
    if (vp != null) {
        vp.remove();
    }
}
 
Example 5
Source File: TitanEventualGraphTest.java    From titan1withtp3.1 with Apache License 2.0 5 votes vote down vote up
private void processTx(TitanTransaction tx, int txid, long vid, long uid) {
    TitanVertex v = getV(tx,vid);
    TitanVertex u = getV(tx,uid);
    assertEquals(5.0,v.<Double>value("weight").doubleValue(),0.00001);
    VertexProperty p = getOnlyElement(v.properties("weight"));
    assertEquals(1,p.<Integer>value("sig").intValue());
    sign(v.property("weight",6.0),txid);
    p = getOnlyElement(v.properties("name"));
    assertEquals(1,p.<Integer>value("sig").intValue());
    assertEquals("John",p.value());
    p.remove();
    sign(v.property("name","Bob"),txid);
    for (String pkey : new String[]{"value","valuef"}) {
        p = getOnlyElement(v.properties(pkey));
        assertEquals(1,p.<Integer>value("sig").intValue());
        assertEquals(2,p.value());
        sign((TitanVertexProperty)p,txid);
    }

    Edge e = getOnlyElement(v.query().direction(OUT).labels("es").edges());
    assertEquals(1,e.<Integer>value("sig").intValue());
    e.remove();
    sign(v.addEdge("es",u),txid);
    e = getOnlyElement(v.query().direction(OUT).labels("o2o").edges());
    assertEquals(1,e.<Integer>value("sig").intValue());
    sign((TitanEdge)e,txid);
    e = getOnlyElement(v.query().direction(OUT).labels("o2m").edges());
    assertEquals(1,e.<Integer>value("sig").intValue());
    e.remove();
    sign(v.addEdge("o2m",u),txid);
    for (String label : new String[]{"em","emf"}) {
        e = getOnlyElement(v.query().direction(OUT).labels(label).edges());
        assertEquals(1,e.<Integer>value("sig").intValue());
        sign((TitanEdge)e,txid);
    }
}
 
Example 6
Source File: FrameHelper.java    From peapod with Apache License 2.0 5 votes vote down vote up
public static <V> void removeVertexProperty(FramedVertex framedVertex, String label, V value) {
    if (value == null) {
        throw new IllegalArgumentException("Filter value is <null>");
    }

    Iterator<VertexProperty<V>> it = framedVertex.vertex().properties(label);
    while (it.hasNext()) {
        VertexProperty<V> vertexProperty = it.next();
        if (value.equals(vertexProperty.value())) {
            vertexProperty.remove();
            return;
        }
    }
}
 
Example 7
Source File: ShortestPathVertexProgram.java    From tinkerpop with Apache License 2.0 5 votes vote down vote up
/**
 * Move any valid path into the VP's memory.
 * @param vertex The current vertex.
 * @param memory The VertexProgram's memory.
 */
private void collectShortestPaths(final Vertex vertex, final Memory memory) {

    final VertexProperty<Map<Vertex, Pair<Number, Set<Path>>>> pathProperty = vertex.property(PATHS);

    if (pathProperty.isPresent()) {

        final Map<Vertex, Pair<Number, Set<Path>>> paths = pathProperty.value();
        final List<Path> result = new ArrayList<>();

        for (final Pair<Number, Set<Path>> pair : paths.values()) {
            for (final Path path : pair.getValue1()) {
                if (isEndVertex(vertex)) {
                    if (this.distanceEqualsNumberOfHops ||
                            this.maxDistance == null ||
                            NumberHelper.compare(pair.getValue0(), this.maxDistance) <= 0) {
                        result.add(path);
                    }
                }
            }
        }

        pathProperty.remove();

        memory.add(SHORTEST_PATHS, result);
    }
}