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

The following examples show how to use org.apache.tinkerpop.gremlin.structure.Property#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: Neo4JEdgeWhileRemovingPropertyValueTest.java    From neo4j-gremlin-bolt with Apache License 2.0 6 votes vote down vote up
@Test
public void givenPropertyValueShouldAddItToEdge() {
    // arrange
    Mockito.when(graph.tx()).thenAnswer(invocation -> transaction);
    Mockito.when(relationship.get(Mockito.eq("id"))).thenAnswer(invocation -> Values.value(1L));
    Mockito.when(relationship.type()).thenAnswer(invocation -> "label");
    Mockito.when(relationship.keys()).thenAnswer(invocation -> Collections.singleton("key1"));
    Mockito.when(relationship.get(Mockito.eq("key1"))).thenAnswer(invocation -> Values.value("value1"));
    Mockito.when(provider.fieldName()).thenAnswer(invocation -> "id");
    ArgumentCaptor<Long> argument = ArgumentCaptor.forClass(Long.class);
    Mockito.when(provider.processIdentifier(argument.capture())).thenAnswer(invocation -> argument.getValue());
    Neo4JEdge edge = new Neo4JEdge(graph, session, provider, outVertex, relationship, inVertex);
    Property<?> result = edge.property("p1", 1L);
    // act
    result.remove();
    // assert
    Assert.assertFalse("Failed to remove property from edge", edge.property("p1").isPresent());
}
 
Example 2
Source File: GraphOMRSRelationshipMapper.java    From egeria with Apache License 2.0 5 votes vote down vote up
private void removeProperty(Edge edge, String qualifiedPropName) {
    // no value has been specified - remove the property from the edge
    Property ep = edge.property(getPropertyKeyRelationship(qualifiedPropName));
    if (ep != null) {
        ep.remove();
    }
}
 
Example 3
Source File: AtlasJanusElement.java    From atlas with Apache License 2.0 5 votes vote down vote up
@Override
public void removeProperty(String propertyName) {
    Iterator<? extends Property<String>> it = getWrappedElement().properties(propertyName);
    while(it.hasNext()) {
        Property<String> property = it.next();
        property.remove();
    }
}
 
Example 4
Source File: AtlasJanusElement.java    From atlas with Apache License 2.0 5 votes vote down vote up
@Override
public void removePropertyValue(String propertyName, Object propertyValue) {
    Iterator<? extends Property<Object>> it = getWrappedElement().properties(propertyName);

    while (it.hasNext()) {
        Property currentProperty      = it.next();
        Object   currentPropertyValue = currentProperty.value();

        if (Objects.equals(currentPropertyValue, propertyValue)) {
            currentProperty.remove();
            break;
        }
    }
}
 
Example 5
Source File: AtlasJanusElement.java    From atlas with Apache License 2.0 5 votes vote down vote up
@Override
public void removeAllPropertyValue(String propertyName, Object propertyValue) {
    Iterator<? extends Property<Object>> it = getWrappedElement().properties(propertyName);

    while (it.hasNext()) {
        Property currentProperty      = it.next();
        Object   currentPropertyValue = currentProperty.value();

        if (Objects.equals(currentPropertyValue, propertyValue)) {
            currentProperty.remove();
        }
    }
}
 
Example 6
Source File: Titan1Element.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
@Override
public void removeProperty(String propertyName) {
    Iterator<? extends Property<String>> it = getWrappedElement().properties(propertyName);
    while(it.hasNext()) {
        Property<String> property = it.next();
        property.remove();
    }
}