本文整理了Java中org.securegraph.Vertex.getProperties()
方法的一些代码示例,展示了Vertex.getProperties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getProperties()
方法的具体详情如下:
包路径:org.securegraph.Vertex
类名称:Vertex
方法名:getProperties
暂无
代码示例来源:origin: org.securegraph.examples/examples-base
public static JSONObject vertexToJson(Vertex vertex) {
JSONObject json = new JSONObject();
json.put("id", vertex.getId());
JSONArray propertiesJson = new JSONArray();
for (Property property : vertex.getProperties()) {
propertiesJson.put(propertyYoJson(property));
}
json.put("properties", propertiesJson);
return json;
}
代码示例来源:origin: org.securegraph/securegraph-test
@Test
public void testAddVertexWithPropertiesWithTwoDifferentVisibilities() {
Vertex v = graph.prepareVertex("v1", VISIBILITY_EMPTY)
.setProperty("prop1", "value1a", VISIBILITY_A)
.setProperty("prop1", "value1b", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(v.getProperties("prop1")));
v = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(v.getProperties("prop1")));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1a", v.getPropertyValue("prop1"));
v = graph.getVertex("v1", AUTHORIZATIONS_B);
assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1b", v.getPropertyValue("prop1"));
}
代码示例来源:origin: lumifyio/securegraph
@Test
public void testChangeVisibilityOnStreamingProperty() throws IOException {
String expectedLargeValue = IOUtils.toString(new LargeStringInputStream(LARGE_PROPERTY_VALUE_SIZE));
PropertyValue propSmall = new StreamingPropertyValue(new ByteArrayInputStream("value1".getBytes()), String.class);
PropertyValue propLarge = new StreamingPropertyValue(new ByteArrayInputStream(expectedLargeValue.getBytes()), String.class);
String largePropertyName = "propLarge/\\*!@#$%^&*()[]{}|";
graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("propSmall", propSmall, VISIBILITY_A)
.setProperty(largePropertyName, propLarge, VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A).getProperties()));
graph.getVertex("v1", AUTHORIZATIONS_A)
.prepareMutation()
.alterPropertyVisibility("propSmall", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A).getProperties()));
graph.getVertex("v1", AUTHORIZATIONS_A)
.prepareMutation()
.alterPropertyVisibility(largePropertyName, VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(0, count(graph.getVertex("v1", AUTHORIZATIONS_A).getProperties()));
assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties()));
}
代码示例来源:origin: org.securegraph/securegraph-test
@Test
public void testChangeVisibilityOnStreamingProperty() throws IOException {
String expectedLargeValue = IOUtils.toString(new LargeStringInputStream(LARGE_PROPERTY_VALUE_SIZE));
PropertyValue propSmall = new StreamingPropertyValue(new ByteArrayInputStream("value1".getBytes()), String.class);
PropertyValue propLarge = new StreamingPropertyValue(new ByteArrayInputStream(expectedLargeValue.getBytes()), String.class);
String largePropertyName = "propLarge/\\*!@#$%^&*()[]{}|";
graph.prepareVertex("v1", VISIBILITY_A)
.setProperty("propSmall", propSmall, VISIBILITY_A)
.setProperty(largePropertyName, propLarge, VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A).getProperties()));
graph.getVertex("v1", AUTHORIZATIONS_A)
.prepareMutation()
.alterPropertyVisibility("propSmall", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(1, count(graph.getVertex("v1", AUTHORIZATIONS_A).getProperties()));
graph.getVertex("v1", AUTHORIZATIONS_A)
.prepareMutation()
.alterPropertyVisibility(largePropertyName, VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(0, count(graph.getVertex("v1", AUTHORIZATIONS_A).getProperties()));
assertEquals(2, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties()));
}
代码示例来源:origin: lumifyio/securegraph
@Test
public void testAddVertexWithPropertiesWithTwoDifferentVisibilities() {
Vertex v = graph.prepareVertex("v1", VISIBILITY_EMPTY)
.setProperty("prop1", "value1a", VISIBILITY_A)
.setProperty("prop1", "value1b", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(v.getProperties("prop1")));
v = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(v.getProperties("prop1")));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1a", v.getPropertyValue("prop1"));
v = graph.getVertex("v1", AUTHORIZATIONS_B);
assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1b", v.getPropertyValue("prop1"));
}
代码示例来源:origin: org.securegraph/securegraph-test
.setProperty("prop2", "value2", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(1, count(vertexAdded.getProperties("prop1")));
assertEquals("value1", vertexAdded.getPropertyValues("prop1").iterator().next());
assertEquals(1, count(vertexAdded.getProperties("prop2")));
assertEquals("value2", vertexAdded.getPropertyValues("prop2").iterator().next());
graph.flush();
assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1", v.getPropertyValues("prop1").iterator().next());
assertEquals(1, count(v.getProperties("prop2")));
assertEquals("value2", v.getPropertyValues("prop2").iterator().next());
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
assertEquals(1, count(v.getProperties("prop1Mutation")));
assertEquals("value1Mutation", v.getPropertyValues("prop1Mutation").iterator().next());
assertEvents(
代码示例来源:origin: lumifyio/securegraph
.setProperty("prop2", "value2", VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
assertEquals(1, count(vertexAdded.getProperties("prop1")));
assertEquals("value1", vertexAdded.getPropertyValues("prop1").iterator().next());
assertEquals(1, count(vertexAdded.getProperties("prop2")));
assertEquals("value2", vertexAdded.getPropertyValues("prop2").iterator().next());
graph.flush();
assertEquals(1, count(v.getProperties("prop1")));
assertEquals("value1", v.getPropertyValues("prop1").iterator().next());
assertEquals(1, count(v.getProperties("prop2")));
assertEquals("value2", v.getPropertyValues("prop2").iterator().next());
graph.flush();
v = graph.getVertex("v1", AUTHORIZATIONS_A_AND_B);
assertEquals(1, count(v.getProperties("prop1Mutation")));
assertEquals("value1Mutation", v.getPropertyValues("prop1Mutation").iterator().next());
assertEvents(
代码示例来源:origin: lumifyio/securegraph
assertEquals(1, count(v.getProperties("prop1")));
Property prop1 = v.getProperties("prop1").iterator().next();
if (prop1 instanceof HasTimestamp) {
assertTrue("timestamp should be more than 0", ((HasTimestamp) prop1).getTimestamp() > 0);
assertEquals(1, count(v.getProperties("prop1")));
prop1 = v.getProperties("prop1").iterator().next();
prop1Metadata = prop1.getMetadata();
assertEquals(2, prop1Metadata.entrySet().size());
assertEquals(1, count(v.getProperties("prop1")));
prop1 = v.getProperties("prop1").iterator().next();
prop1Metadata = prop1.getMetadata();
assertEquals(2, prop1Metadata.entrySet().size());
代码示例来源:origin: org.securegraph/securegraph-test
assertEquals(1, count(v.getProperties("prop1")));
Property prop1 = v.getProperties("prop1").iterator().next();
if (prop1 instanceof HasTimestamp) {
assertTrue("timestamp should be more than 0", ((HasTimestamp) prop1).getTimestamp() > 0);
assertEquals(1, count(v.getProperties("prop1")));
prop1 = v.getProperties("prop1").iterator().next();
prop1Metadata = prop1.getMetadata();
assertEquals(2, prop1Metadata.entrySet().size());
assertEquals(1, count(v.getProperties("prop1")));
prop1 = v.getProperties("prop1").iterator().next();
prop1Metadata = prop1.getMetadata();
assertEquals(2, prop1Metadata.entrySet().size());
代码示例来源:origin: org.securegraph/securegraph-test
@Test
public void testConcurrentModificationOfProperties() {
Vertex v = graph.prepareVertex("v1", VISIBILITY_EMPTY)
.setProperty("prop1", "value1", VISIBILITY_A)
.setProperty("prop2", "value2", VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
int i = 0;
for (Property p : v.getProperties()) {
assertNotNull(p.toString());
if (i == 0) {
v.setProperty("prop3", "value3", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
}
i++;
}
}
代码示例来源:origin: org.securegraph/securegraph-test
assertEquals("value2a", v.getPropertyValues("prop2").iterator().next());
assertEquals("value3a", v.getPropertyValues("prop3").iterator().next());
assertEquals(3, count(v.getProperties()));
assertEquals(1, count(v.getPropertyValues("prop3")));
assertEquals("value3a", v.getPropertyValues("prop3").iterator().next());
assertEquals(3, count(v.getProperties()));
assertContains("value1b", v.getPropertyValues("prop1"));
assertContains("value1a-new", v.getPropertyValues("prop1"));
assertEquals(4, count(v.getProperties()));
代码示例来源:origin: lumifyio/securegraph
assertEquals("value2a", v.getPropertyValues("prop2").iterator().next());
assertEquals("value3a", v.getPropertyValues("prop3").iterator().next());
assertEquals(3, count(v.getProperties()));
assertEquals(1, count(v.getPropertyValues("prop3")));
assertEquals("value3a", v.getPropertyValues("prop3").iterator().next());
assertEquals(3, count(v.getProperties()));
assertContains("value1b", v.getPropertyValues("prop1"));
assertContains("value1a-new", v.getPropertyValues("prop1"));
assertEquals(4, count(v.getProperties()));
代码示例来源:origin: lumifyio/securegraph
@Test
public void testConcurrentModificationOfProperties() {
Vertex v = graph.prepareVertex("v1", VISIBILITY_EMPTY)
.setProperty("prop1", "value1", VISIBILITY_A)
.setProperty("prop2", "value2", VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
int i = 0;
for (Property p : v.getProperties()) {
assertNotNull(p.toString());
if (i == 0) {
v.setProperty("prop3", "value3", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
}
i++;
}
}
代码示例来源:origin: org.securegraph/securegraph-test
@Test
public void testElementMutationDoesntChangeObjectUntilSave() {
Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
v.setProperty("prop1", "value1", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
ElementMutation<Vertex> m = v.prepareMutation()
.setProperty("prop1", "value2", VISIBILITY_A)
.setProperty("prop2", "value2", VISIBILITY_A);
assertEquals(1, count(v.getProperties()));
assertEquals("value1", v.getPropertyValue("prop1"));
m.save(AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(v.getProperties()));
assertEquals("value2", v.getPropertyValue("prop1"));
assertEquals("value2", v.getPropertyValue("prop2"));
}
代码示例来源:origin: lumifyio/securegraph
@Test
public void testElementMutationDoesntChangeObjectUntilSave() {
Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
v.setProperty("prop1", "value1", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
ElementMutation<Vertex> m = v.prepareMutation()
.setProperty("prop1", "value2", VISIBILITY_A)
.setProperty("prop2", "value2", VISIBILITY_A);
assertEquals(1, count(v.getProperties()));
assertEquals("value1", v.getPropertyValue("prop1"));
m.save(AUTHORIZATIONS_A_AND_B);
assertEquals(2, count(v.getProperties()));
assertEquals("value2", v.getPropertyValue("prop1"));
assertEquals("value2", v.getPropertyValue("prop2"));
}
代码示例来源:origin: org.securegraph/securegraph-test
.save(AUTHORIZATIONS_A);
assertEquals(3, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties("prop1")));
List<Property> properties = toList(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties("prop1"));
assertEquals(2, count(properties));
boolean foundProp1Key2 = false;
assertTrue("Prop1Key1VisB not found", foundProp1Key1VisB);
List<Property> hiddenProperties = toList(graph.getVertex("v1", FetchHint.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A_AND_B).getProperties());
assertEquals(3, hiddenProperties.size());
boolean foundProp1Key1VisA = false;
assertEquals(3, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties("prop1")));
代码示例来源:origin: lumifyio/securegraph
.save(AUTHORIZATIONS_A);
assertEquals(3, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties("prop1")));
List<Property> properties = toList(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties("prop1"));
assertEquals(2, count(properties));
boolean foundProp1Key2 = false;
assertTrue("Prop1Key1VisB not found", foundProp1Key1VisB);
List<Property> hiddenProperties = toList(graph.getVertex("v1", FetchHint.ALL_INCLUDING_HIDDEN, AUTHORIZATIONS_A_AND_B).getProperties());
assertEquals(3, hiddenProperties.size());
boolean foundProp1Key1VisA = false;
assertEquals(3, count(graph.getVertex("v1", AUTHORIZATIONS_A_AND_B).getProperties("prop1")));
代码示例来源:origin: org.securegraph/securegraph-test
v.removeProperty("prop1", AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(1, count(v.getProperties()));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(1, count(v.getProperties()));
v.removeProperty("propid2a", "prop2", AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(0, count(v.getProperties()));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(0, count(v.getProperties()));
代码示例来源:origin: lumifyio/securegraph
v.removeProperty("prop1", AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(1, count(v.getProperties()));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(1, count(v.getProperties()));
v.removeProperty("propid2a", "prop2", AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(0, count(v.getProperties()));
v = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(0, count(v.getProperties()));
代码示例来源:origin: org.securegraph/securegraph-test
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(1, count(v1.getProperties()));
v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(1, count(v1.getProperties()));
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
assertEquals(0, count(v1.getProperties()));
v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
assertEquals(0, count(v1.getProperties()));
assertEvents(
new RemovePropertyEvent(graph, v1, prop2_propid2a)
内容来源于网络,如有侵权,请联系作者删除!