private void addTextProperty( TikaTextExtractorGraphPropertyWorkerConfiguration.TextExtractMapping textExtractMapping, ExistingElementMutation<Vertex> m, String propertyKey, StreamingPropertyValue textValue, org.vertexium.Metadata textMetadata, Visibility visibility ) { m.addPropertyValue(propertyKey, textExtractMapping.getExtractedTextPropertyName(), textValue, textMetadata, visibility); }
/** * Adds or updates a property. * * @param key The unique key given to the property allowing for multi-valued properties. * @param name The name of the property. * @param value The value of the property. * @param metadata The metadata to assign to this property. * @param visibility The visibility to give this property. */ default void addPropertyValue(String key, String name, Object value, Metadata metadata, Visibility visibility, Authorizations authorizations) { prepareMutation().addPropertyValue(key, name, value, metadata, visibility).save(authorizations); }
/** * Adds or updates a property. * * @param key The unique key given to the property allowing for multi-valued properties. * @param name The name of the property. * @param value The value of the property. * @param visibility The visibility to give this property. */ default void addPropertyValue(String key, String name, Object value, Visibility visibility, Authorizations authorizations) { prepareMutation().addPropertyValue(key, name, value, visibility).save(authorizations); }
/** * Adds or updates a property. * * @param key The unique key given to the property allowing for multi-valued properties. * @param name The name of the property. * @param value The value of the property. * @param visibility The visibility to give this property. */ default void addPropertyValue(String key, String name, Object value, Visibility visibility, Authorizations authorizations) { prepareMutation().addPropertyValue(key, name, value, visibility).save(authorizations); }
/** * Adds or updates a property. * * @param key The unique key given to the property allowing for multi-valued properties. * @param name The name of the property. * @param value The value of the property. * @param metadata The metadata to assign to this property. * @param visibility The visibility to give this property. */ default void addPropertyValue(String key, String name, Object value, Metadata metadata, Visibility visibility, Authorizations authorizations) { prepareMutation().addPropertyValue(key, name, value, metadata, visibility).save(authorizations); }
.addPropertyValue("propid1a", "prop1", "value1a", VISIBILITY_A) .addPropertyValue("propid2a", "prop2", "value2a", VISIBILITY_A) .addPropertyValue("propid3a", "prop3", "value3a", VISIBILITY_A) .addPropertyValue("propid1a", "prop1", "value1b", VISIBILITY_A) .addPropertyValue("propid2a", "prop2", "value2b", VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B);
.addPropertyValue("propid1a", "prop1", "value1a", VISIBILITY_A) .addPropertyValue("propid2a", "prop2", "value2a", VISIBILITY_A) .addPropertyValue("propid3a", "prop3", "value3a", VISIBILITY_A) .addPropertyValue("propid1a", "prop1", "value1b", VISIBILITY_A) .addPropertyValue("propid2a", "prop2", "value2b", VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B);
@Test public void testTimestampsInExistingElementMutation() { long t1 = createDate(2017, 1, 18, 9, 20, 0).getTime(); long t2 = createDate(2017, 1, 19, 9, 20, 0).getTime(); graph.prepareVertex("v1", VISIBILITY_EMPTY) .addPropertyValue("k1", "prop1", "test1", Metadata.create(), t1, VISIBILITY_EMPTY) .save(AUTHORIZATIONS_ALL); graph.flush(); Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_ALL); assertEquals(t1, v1.getProperty("k1", "prop1").getTimestamp()); graph.getVertex("v1", AUTHORIZATIONS_ALL) .prepareMutation() .addPropertyValue("k1", "prop1", "test2", Metadata.create(), t2, VISIBILITY_EMPTY) .save(AUTHORIZATIONS_ALL); graph.flush(); v1 = graph.getVertex("v1", AUTHORIZATIONS_ALL); assertEquals(t2, v1.getProperty("k1", "prop1").getTimestamp()); List<HistoricalPropertyValue> historicalValues = toList(v1.getHistoricalPropertyValues("k1", "prop1", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL)); assertEquals(2, historicalValues.size()); assertEquals(t1, historicalValues.get(1).getTimestamp()); assertEquals(t2, historicalValues.get(0).getTimestamp()); }
@Test public void testTimestampsInExistingElementMutation() { long t1 = createDate(2017, 1, 18, 9, 20, 0).getTime(); long t2 = createDate(2017, 1, 19, 9, 20, 0).getTime(); graph.prepareVertex("v1", VISIBILITY_EMPTY) .addPropertyValue("k1", "prop1", "test1", Metadata.create(), t1, VISIBILITY_EMPTY) .save(AUTHORIZATIONS_ALL); graph.flush(); Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_ALL); assertEquals(t1, v1.getProperty("k1", "prop1").getTimestamp()); graph.getVertex("v1", AUTHORIZATIONS_ALL) .prepareMutation() .addPropertyValue("k1", "prop1", "test2", Metadata.create(), t2, VISIBILITY_EMPTY) .save(AUTHORIZATIONS_ALL); graph.flush(); v1 = graph.getVertex("v1", AUTHORIZATIONS_ALL); assertEquals(t2, v1.getProperty("k1", "prop1").getTimestamp()); List<HistoricalPropertyValue> historicalValues = toList(v1.getHistoricalPropertyValues("k1", "prop1", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL)); assertEquals(2, historicalValues.size()); assertEquals(t1, historicalValues.get(1).getTimestamp()); assertEquals(t2, historicalValues.get(0).getTimestamp()); }
.addPropertyValue("key1", "prop1Mutation", "value1Mutation", VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.flush();
.addPropertyValue("key1", "prop1Mutation", "value1Mutation", VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.flush();
elementMutation.addPropertyValue(propertyKey, propertyName, value, propertyMetadata, propertyVisibility);
.addPropertyValue("", "int", 5, VISIBILITY_A) .addPropertyValue("", "bigInteger", BigInteger.valueOf(10), VISIBILITY_A) .addPropertyValue("", "bigDecimal", BigDecimal.valueOf(1.1), VISIBILITY_A)
.addPropertyValue("", "int", 5, VISIBILITY_A) .addPropertyValue("", "bigInteger", BigInteger.valueOf(10), VISIBILITY_A) .addPropertyValue("", "bigDecimal", BigDecimal.valueOf(1.1), VISIBILITY_A)
.addPropertyValue("propid1a", "prop1", "value1a", VISIBILITY_A) .addPropertyValue("propid1b", "prop1", "value1b", VISIBILITY_A) .addPropertyValue("propid2a", "prop2", "value2a", VISIBILITY_A)
.addPropertyValue("propid1a", "prop1", "value1a", VISIBILITY_A) .addPropertyValue("propid1b", "prop1", "value1b", VISIBILITY_A) .addPropertyValue("propid2a", "prop2", "value2a", VISIBILITY_A)
@Test public void testRemoveValuesFromMultivalueProperties() { graph.defineProperty("p1").dataType(String.class).sortable(true).textIndexHint(TextIndexHint.ALL).define(); Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A) .addPropertyValue("k1", "p1", "v1", VISIBILITY_A) .addPropertyValue("k2", "p1", "v2", VISIBILITY_A) .save(AUTHORIZATIONS_ALL); getGraph().flush(); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v1").vertexIds(), "v1"); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v2").vertexIds(), "v1"); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v3").vertexIds()); v1.prepareMutation() .addPropertyValue("k3", "p1", "v3", VISIBILITY_A) .deleteProperty("k1", "p1", VISIBILITY_A) .save(AUTHORIZATIONS_ALL); getGraph().flush(); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v2").vertexIds(), "v1"); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v3").vertexIds(), "v1"); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v1").vertexIds()); v1.deleteProperty("k2", "p1", VISIBILITY_A, AUTHORIZATIONS_ALL); getGraph().flush(); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v3").vertexIds(), "v1"); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v1").vertexIds()); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v2").vertexIds()); }
.addPropertyValue("key2", "prop1", new GeoPoint(38.6270, -90.1994, "St Louis, MO"), VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.flush();
@Test public void testRemoveValuesFromMultivalueProperties() { graph.defineProperty("p1").dataType(String.class).sortable(true).textIndexHint(TextIndexHint.ALL).define(); Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A) .addPropertyValue("k1", "p1", "v1", VISIBILITY_A) .addPropertyValue("k2", "p1", "v2", VISIBILITY_A) .save(AUTHORIZATIONS_ALL); getGraph().flush(); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v1").vertexIds(), "v1"); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v2").vertexIds(), "v1"); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v3").vertexIds()); v1.prepareMutation() .addPropertyValue("k3", "p1", "v3", VISIBILITY_A) .deleteProperty("k1", "p1", VISIBILITY_A) .save(AUTHORIZATIONS_ALL); getGraph().flush(); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v2").vertexIds(), "v1"); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v3").vertexIds(), "v1"); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v1").vertexIds()); v1.deleteProperty("k2", "p1", VISIBILITY_A, AUTHORIZATIONS_ALL); getGraph().flush(); assertIdsAnyOrder(getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v3").vertexIds(), "v1"); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v1").vertexIds()); assertResultsCount(0, 0, getGraph().query(AUTHORIZATIONS_ALL).has("p1", "v2").vertexIds()); }
.addPropertyValue("key2", "prop1", new GeoPoint(38.6270, -90.1994, "St Louis, MO"), VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.flush();