org.gradoop.common.model.impl.pojo.Vertex.getProperties()方法的使用及代码示例

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

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

Vertex.getProperties介绍

暂无

代码示例

代码示例来源:origin: org.gradoop/gradoop-flink

/**
 * Returns the gdl formatted vertex including the properties and the label on first occurrence
 * or otherwise just the variable name.
 *
 * @param v The vertex that should be formatted.
 * @param idToVertexName Maps GradoopId of a vertex to a string that represents the gdl
 *                       variable name
 * @return A GDL formatted vertex string.
 */
private String vertexToGDLString(Vertex v, Map<GradoopId, String> idToVertexName)  {
 return String.format("(%s:%s %s)",
  idToVertexName.get(v.getId()),
  v.getLabel(),
  propertiesToGDLString(v.getProperties()));
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * Returns the gdl formatted vertex including the properties and the label on first occurrence
 * or otherwise just the variable name.
 *
 * @param v The vertex that should be formatted.
 * @param idToVertexName Maps GradoopId of a vertex to a string that represents the gdl
 *                       variable name
 * @return A GDL formatted vertex string.
 */
private String vertexToGDLString(Vertex v, Map<GradoopId, String> idToVertexName)  {
 return String.format("(%s:%s %s)",
  idToVertexName.get(v.getId()),
  v.getLabel(),
  propertiesToGDLString(v.getProperties()));
}

代码示例来源:origin: dbs-leipzig/gradoop

@Override
 public void flatMap(Vertex vertex, Collector<Tuple2<PropertyValue, GradoopId>> out) {
  if (vertex.getProperties() != null &&
   vertex.getProperties().containsKey(originalPropertyName)) {
   PropertyValue pv = vertex.getPropertyValue(originalPropertyName);
   reuseTuple.f1 = vertex.getId();

   if (pv.isList()) {
    for (PropertyValue value : pv.getList()) {
     reuseTuple.f0 = value;
     out.collect(reuseTuple);
    }
   } else {
    reuseTuple.f0 = pv;
    out.collect(reuseTuple);
   }
  }
 }
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * Constructs a vertex from a given JSON string representation.
 *
 * @param jsonString The String representation of a JSON object.
 * @return A new vertex from the JSON object.
 */
@Override
public Vertex map(String jsonString) throws Exception {
 JSONObject jsonVertex = new JSONObject(jsonString);
 Properties properties = reuse.getProperties();
 if (properties == null) {
  properties = Properties.create();
  reuse.setProperties(properties);
 }
 properties.clear();
 for (Iterator it = jsonVertex.keys(); it.hasNext();) {
  String key = (String) it.next();
  PropertyValue propertyValue = getPropertyValue(jsonVertex, key);
  properties.set(key, propertyValue);
 }
 return reuse;
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * Find all person who's age is not smaller than 35
 *
 * @throws Throwable if error
 */
@Test
public void findPersonByAge() throws Throwable {
 doTest(TEST02, (loader, store, config) -> {
  //vertex label and property query
  List<Vertex> inputVertices = loader.getVertices()
   .stream()
   .filter(it -> Objects.equals(it.getLabel(), "Person"))
   .filter(it -> it.getProperties() != null)
   .filter(it -> it.getProperties().get("age") != null)
   .filter(it -> it.getProperties().get("age").getInt() >= 35)
   .collect(Collectors.toList());
  List<Vertex> queryResult = store
   .getVertexSpace(
    Query.elements()
     .fromAll()
     .where(AccumuloFilters.propLargerThan("age", 35, true)))
   .readRemainsAndClose();
  validateEPGMElementCollections(inputVertices, queryResult);
 });
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * find all vertices by property value regex
 *
 * @throws Throwable if error
 */
@Test
public void propRegex() throws Throwable {
 doTest(TEST03, (loader, store, config) -> {
  Pattern queryFormula = Pattern.compile("(Leipzig|Dresden)");
  List<Vertex> inputVertices = loader.getVertices().stream()
   .filter(it -> {
    assert it.getProperties() != null;
    return it.getProperties().get("city") != null &&
     it.getProperties().get("city").isString() &&
     queryFormula
      .matcher(it.getProperties().get("city").getString())
      .matches();
   })
   .collect(Collectors.toList());
  List<Vertex> query = store
   .getVertexSpace(
    Query.elements()
     .fromAll()
     .where(AccumuloFilters.propReg("city", queryFormula)))
   .readRemainsAndClose();
  GradoopTestUtils.validateEPGMElementCollections(inputVertices, query);
 });
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * find all vertices by property equality
 *
 * @throws Throwable if error
 */
@Test
public void vertexPropEquals() throws Throwable {
 doTest(TEST01, (loader, store, config) -> {
  List<Vertex> inputVertices = loader.getVertices().stream()
   .filter(it -> {
    assert it.getProperties() != null;
    return it.getProperties().get("gender") != null &&
     Objects.equals(it.getProperties()
      .get("gender")
      .getString(), "f");
   })
   .collect(Collectors.toList());
  List<Vertex> query = store
   .getVertexSpace(
    Query.elements()
     .fromAll()
     .where(AccumuloFilters.propEquals("gender", "f")))
   .readRemainsAndClose();
  GradoopTestUtils.validateEPGMElementCollections(inputVertices, query);
 });
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * Find all person who's age is not smaller than 35
 *
 * @throws Throwable if error
 */
@Test
public void findPersonByAgeBiggerThan35() throws Throwable {
 doTest(TEST02, (loader, store, config) -> {
  //vertex label and property query
  List<Vertex> inputVertices = loader.getVertices()
   .stream()
   .filter(it -> Objects.equals(it.getLabel(), "Person"))
   .filter(it -> it.getProperties() != null)
   .filter(it -> it.getProperties().get("age") != null)
   .filter(it -> it.getProperties().get("age").getInt() >= 35)
   .collect(Collectors.toList());
  AccumuloDataSource source = new AccumuloDataSource(store, config);
  List<Vertex> queryResult = source
   .applyVertexPredicate(
    Query.elements()
     .fromAll()
     .where(AccumuloFilters.<Vertex>labelIn("Person")
      .and(AccumuloFilters.propLargerThan("age", 35, true)))
   )
   .getGraphCollection()
   .getVertices()
   .collect();
  validateEPGMElementCollections(inputVertices, queryResult);
 });
}

代码示例来源:origin: dbs-leipzig/gradoop

/**
 * Find all person who's age is smaller than 35
 *
 * @throws Throwable if error
 */
@Test
public void findPersonByAgeSmallerThan35() throws Throwable {
 doTest(TEST03, (loader, store, config) -> {
  //vertex label and property query
  List<Vertex> inputVertices = loader.getVertices()
   .stream()
   .filter(it -> Objects.equals(it.getLabel(), "Person"))
   .filter(it -> it.getProperties() != null)
   .filter(it -> it.getProperties().get("age") != null)
   .filter(it -> it.getProperties().get("age").getInt() < 35)
   .collect(Collectors.toList());
  AccumuloDataSource source = new AccumuloDataSource(store, config);
  List<Vertex> queryResult = source
   .applyVertexPredicate(
    Query.elements()
     .fromAll()
     .where(AccumuloFilters.<Vertex>labelIn("Person")
      .and(AccumuloFilters.<Vertex>propLargerThan("age", 35, true)
       .negate())))
   .getGraphCollection()
   .getVertices()
   .collect();
  validateEPGMElementCollections(inputVertices, queryResult);
 });
}

代码示例来源:origin: dbs-leipzig/gradoop

.and(inputVertices.stream()
 .map(it -> {
  assert it.getProperties() != null;
  String name = it.getProperties().get("name").getString();
  return (AccumuloElementFilter<Vertex>) AccumuloFilters
   .<Vertex>propEquals("name", name);

代码示例来源:origin: dbs-leipzig/gradoop

assert it.getProperties() != null;
 return it.getProperties().get("name").getString();
})
.collect(Collectors.toList());

代码示例来源:origin: dbs-leipzig/gradoop

switch (String.valueOf(v.getPropertyValue("name"))) {
case "foo":
 assertNotNull(v.getProperties());
 assertEquals(4, v.getProperties().size());
 assertEquals("453", v.getPropertyValue("value1").getString());
 assertEquals("true", v.getPropertyValue("value2").getString());
 break;
case "bar":
 assertNotNull(v.getProperties());
 assertEquals(4, v.getProperties().size());
 assertEquals("76", v.getPropertyValue("value1").getString());
 assertEquals("false", v.getPropertyValue("value2").getString());
 break;
case "bla":
 assertNotNull(v.getProperties());
 assertEquals(3, v.getProperties().size());
 assertEquals("4568", v.getPropertyValue("value1").toString());
 assertFalse(v.hasProperty("value2"));

相关文章