org.vertexium.Vertex.setProperty()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.vertexium.Vertex.setProperty()方法的一些代码示例,展示了Vertex.setProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.setProperty()方法的具体详情如下:
包路径:org.vertexium.Vertex
类名称:Vertex
方法名:setProperty

Vertex.setProperty介绍

暂无

代码示例

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
public void setProperty(String name, Object value, User user, Authorizations authorizations) {
  Visibility visibility = OntologyRepository.VISIBILITY.getVisibility();
  Metadata metadata = createPropertyMetadata(user, new Date(), visibility);
  getVertex().setProperty(name, value, metadata, visibility, authorizations);
  getVertex().getGraph().flush();
}

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
public void setProperty(String name, Object value, User user, Authorizations authorizations) {
  Visibility visibility = OntologyRepository.VISIBILITY.getVisibility();
  Metadata metadata = createPropertyMetadata(user, new Date(), visibility);
  getVertex().setProperty(name, value, metadata, OntologyRepository.VISIBILITY.getVisibility(), authorizations);
  getVertex().getGraph().flush();
}

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
  public void setPropertyOnUser(User user, String propertyName, Object value) {
    if (user instanceof SystemUser) {
      throw new VisalloException("Cannot set properties on system user");
    }
    if (!value.equals(user.getCustomProperties().get(propertyName))) {
      Vertex userVertex = findByIdUserVertex(user.getUserId());
      userVertex.setProperty(propertyName, value, VISIBILITY.getVisibility(), authorizations);
      if (user instanceof ProxyUser){
        User proxiedUser = ((ProxyUser) user).getProxiedUser();
        if (proxiedUser instanceof VertexiumUser) {
          user = proxiedUser;
        }
      }
      if (user instanceof VertexiumUser) {
        ((VertexiumUser) user).setProperty(propertyName, value);
      }
      graph.flush();
    }
  }
}

代码示例来源:origin: org.visallo/visallo-model-vertexium

@Override
public void setProperty(String name, Object value, User user, Authorizations authorizations) {
  Visibility visibility = OntologyRepository.VISIBILITY.getVisibility();
  Metadata metadata = new Metadata();
  VisalloProperties.MODIFIED_DATE_METADATA.setMetadata(metadata, new Date(), visibility);
  if (user != null) {
    VisalloProperties.MODIFIED_BY_METADATA.setMetadata(metadata, user.getUserId(), visibility);
  }
  getVertex().setProperty(name, value, metadata, visibility, authorizations);
  getVertex().getGraph().flush();
}

代码示例来源:origin: org.vertexium/vertexium-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: visallo/vertexium

@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.vertexium/vertexium-test

@Test
public void testGraphQueryWithQueryStringWithAuthorizations() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
  v1.setProperty("description", "This is vertex 1 - dog.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_B, AUTHORIZATIONS_ALL);
  v2.setProperty("description", "This is vertex 2 - cat.", VISIBILITY_B, AUTHORIZATIONS_ALL);
  Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  e1.setProperty("edgeDescription", "This is edge 1 - dog to cat.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  getGraph().flush();
  Iterable<Vertex> vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertEquals(1, count(vertices));
  if (isIterableWithTotalHitsSupported(vertices)) {
    IterableWithTotalHits hits = (IterableWithTotalHits) vertices;
    assertEquals(1, hits.getTotalHits());
  }
  Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A).edges();
  assertEquals(1, count(edges));
}

代码示例来源:origin: visallo/vertexium

@Test
public void testGraphQueryWithQueryStringWithAuthorizations() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
  v1.setProperty("description", "This is vertex 1 - dog.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_B, AUTHORIZATIONS_ALL);
  v2.setProperty("description", "This is vertex 2 - cat.", VISIBILITY_B, AUTHORIZATIONS_ALL);
  Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  e1.setProperty("edgeDescription", "This is edge 1 - dog to cat.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  getGraph().flush();
  Iterable<Vertex> vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertEquals(1, count(vertices));
  if (isIterableWithTotalHitsSupported(vertices)) {
    IterableWithTotalHits hits = (IterableWithTotalHits) vertices;
    assertEquals(1, hits.getTotalHits());
  }
  Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A).edges();
  assertEquals(1, count(edges));
}

代码示例来源:origin: org.vertexium/vertexium-test

@Test
public void testModifyVertexWithLowerAuthorizationThenOtherProperties() {
  graph.prepareVertex("v1", VISIBILITY_A)
      .setProperty("prop1", "value1", VISIBILITY_A)
      .setProperty("prop2", "value2", VISIBILITY_B)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.flush();
  Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  v1.setProperty("prop1", "value1New", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
  graph.flush();
  Iterable<Vertex> vertices = graph.query(AUTHORIZATIONS_A_AND_B)
      .has("prop2", "value2")
      .vertices();
  assertVertexIds(vertices, "v1");
}

代码示例来源:origin: visallo/vertexium

@Test
public void testModifyVertexWithLowerAuthorizationThenOtherProperties() {
  graph.prepareVertex("v1", VISIBILITY_A)
      .setProperty("prop1", "value1", VISIBILITY_A)
      .setProperty("prop2", "value2", VISIBILITY_B)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.flush();
  Vertex v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  v1.setProperty("prop1", "value1New", VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
  graph.flush();
  Iterable<Vertex> vertices = graph.query(AUTHORIZATIONS_A_AND_B)
      .has("prop2", "value2")
      .vertices();
  assertVertexIds(vertices, "v1");
}

代码示例来源:origin: org.vertexium/vertexium-test

v.setProperty("prop1", "value2", prop1Metadata, VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
graph.flush();

代码示例来源:origin: visallo/vertexium

v.setProperty("prop1", "value2", prop1Metadata, VISIBILITY_A, AUTHORIZATIONS_A_AND_B);
graph.flush();

代码示例来源:origin: org.vertexium/vertexium-test

@Test
public void testGraphQueryWithQueryString() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
  v1.setProperty("description", "This is vertex 1 - dog.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_ALL);
  v2.setProperty("description", "This is vertex 2 - cat.", VISIBILITY_B, AUTHORIZATIONS_ALL);
  Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  e1.setProperty("description", "This is edge 1 - dog to cat.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  getGraph().flush();
  Iterable<Vertex> vertices = graph.query("vertex", AUTHORIZATIONS_A_AND_B).vertices();
  Assert.assertEquals(2, count(vertices));
  vertices = graph.query("vertex", AUTHORIZATIONS_A).vertices();
  Assert.assertEquals(1, count(vertices));
  vertices = graph.query("dog", AUTHORIZATIONS_A).vertices();
  Assert.assertEquals(1, count(vertices));
  vertices = graph.query("dog", AUTHORIZATIONS_B).vertices();
  Assert.assertEquals(0, count(vertices));
  Iterable<Element> elements = graph.query("dog", AUTHORIZATIONS_A_AND_B).elements();
  Assert.assertEquals(2, count(elements));
}

代码示例来源:origin: visallo/vertexium

@Test
public void testGraphQueryWithQueryString() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
  v1.setProperty("description", "This is vertex 1 - dog.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_ALL);
  v2.setProperty("description", "This is vertex 2 - cat.", VISIBILITY_B, AUTHORIZATIONS_ALL);
  Edge e1 = graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  e1.setProperty("description", "This is edge 1 - dog to cat.", VISIBILITY_A, AUTHORIZATIONS_ALL);
  getGraph().flush();
  Iterable<Vertex> vertices = graph.query("vertex", AUTHORIZATIONS_A_AND_B).vertices();
  Assert.assertEquals(2, count(vertices));
  vertices = graph.query("vertex", AUTHORIZATIONS_A).vertices();
  Assert.assertEquals(1, count(vertices));
  vertices = graph.query("dog", AUTHORIZATIONS_A).vertices();
  Assert.assertEquals(1, count(vertices));
  vertices = graph.query("dog", AUTHORIZATIONS_B).vertices();
  Assert.assertEquals(0, count(vertices));
  Iterable<Element> elements = graph.query("dog", AUTHORIZATIONS_A_AND_B).elements();
  Assert.assertEquals(2, count(elements));
}

代码示例来源:origin: org.vertexium/vertexium-test

@Test
public void testElementMutationDoesntChangeObjectUntilSave() {
  Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  v.setProperty("prop1", "value1-1", VISIBILITY_A, AUTHORIZATIONS_ALL);
  graph.flush();
  ElementMutation<Vertex> m = v.prepareMutation()
      .setProperty("prop1", "value1-2", VISIBILITY_A)
      .setProperty("prop2", "value2-2", VISIBILITY_A);
  Assert.assertEquals(1, count(v.getProperties()));
  assertEquals("value1-1", v.getPropertyValue("prop1"));
  v = m.save(AUTHORIZATIONS_A_AND_B);
  Assert.assertEquals(2, count(v.getProperties()));
  assertEquals("value1-2", v.getPropertyValue("prop1"));
  assertEquals("value2-2", v.getPropertyValue("prop2"));
}

代码示例来源:origin: visallo/vertexium

@Test
public void testElementMutationDoesntChangeObjectUntilSave() {
  Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_ALL);
  v.setProperty("prop1", "value1-1", VISIBILITY_A, AUTHORIZATIONS_ALL);
  graph.flush();
  ElementMutation<Vertex> m = v.prepareMutation()
      .setProperty("prop1", "value1-2", VISIBILITY_A)
      .setProperty("prop2", "value2-2", VISIBILITY_A);
  Assert.assertEquals(1, count(v.getProperties()));
  assertEquals("value1-1", v.getPropertyValue("prop1"));
  v = m.save(AUTHORIZATIONS_A_AND_B);
  Assert.assertEquals(2, count(v.getProperties()));
  assertEquals("value1-2", v.getPropertyValue("prop1"));
  assertEquals("value2-2", v.getPropertyValue("prop2"));
}

代码示例来源:origin: org.vertexium/vertexium-test

String propertyName = "prop.one";
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
v1.setProperty(propertyName, "value1", VISIBILITY_A, AUTHORIZATIONS_ALL);
v2.setProperty(propertyName, "value2", VISIBILITY_A, AUTHORIZATIONS_ALL);
v3.setProperty(propertyName, "value3", VISIBILITY_A, AUTHORIZATIONS_ALL);

代码示例来源:origin: visallo/vertexium

String propertyName = "prop.one";
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_ALL);
v1.setProperty(propertyName, "value1", VISIBILITY_A, AUTHORIZATIONS_ALL);
v2.setProperty(propertyName, "value2", VISIBILITY_A, AUTHORIZATIONS_ALL);
v3.setProperty(propertyName, "value3", VISIBILITY_A, AUTHORIZATIONS_ALL);

相关文章