org.neo4j.graphdb.Relationship.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(106)

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

Relationship.getProperties介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

assertEquals( properties.get( key2 ), int2 );
assertEquals( properties.get( key3 ), string );
properties = rel1.getProperties( key1, key2 );
assertEquals( properties.get( key1 ), int1 );
assertEquals( properties.get( key2 ), int2 );

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

if (vRel == null) vRel = v1.createRelationshipTo(v2, rel.getType());
if (!relAggNames.isEmpty()) {
  aggregate(vRel, relAggNames, relAggKeys.length > 0 ? rel.getProperties(relAggKeys) : Collections.emptyMap());

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

private Map<String, Object> data(PropertyContainer pc, Map<String, Map<String, Object>> colors, String weightproperty, String[] exportproperties) {
  if (pc instanceof Node) {
    Node n = (Node) pc;
    String labels = Util.labelString(n);
    Map<String, Object> attributes = map("label", caption(n), "TYPE", labels);
    attributes.putAll(positions());
    attributes.putAll(color(labels,colors));
    if (exportproperties.length > 0) attributes.putAll(n.getProperties(exportproperties));
    return map(idStr(n), attributes);
  }
  if (pc instanceof Relationship) {
    Relationship r = (Relationship) pc;
    String type = r.getType().name();
    Map<String, Object> attributes = map("label", type, "TYPE", type);
    Double weight = Util.doubleValue(r,weightproperty,1.0);
    attributes.putAll(map("source", idStr(r.getStartNode()), "target", idStr(r.getEndNode()), "directed", true,"weight",weight));
    attributes.putAll(color(type, colors));
    if (exportproperties.length > 0) attributes.putAll(r.getProperties(exportproperties));
    return map(String.valueOf(r.getId()), attributes);
  }
  return map();
}

代码示例来源:origin: org.neo4j/neo4j-shell

@Override
public Map<String, Object> getProperties( String... names )
{
  return actual.getProperties( names );
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetArrayValueSourceArrayValuesDifferentTypeAndOneSameValue(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:[\"1995\",\"2014\"], reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:[2010,2015], reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
    Relationship rel1 = (Relationship) r.get("rel1");
    Relationship rel2 = (Relationship) r.get("rel2");
    PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
    assertEquals(asList("1995","2014","2010","2015").toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
  });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetSingleValueSourceArrayValuesDifferentType(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:1995, reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:[\"2010\",\"2015\"], reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
    Relationship rel1 = (Relationship) r.get("rel1");
    Relationship rel2 = (Relationship) r.get("rel2");
    PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
    assertEquals(asList("1995","2010", "2015").toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
  });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetArrayValuesSourceSingleValuesSameType(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:[2010,2015], reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:1995, reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
    Relationship rel1 = (Relationship) r.get("rel1");
    Relationship rel2 = (Relationship) r.get("rel2");
    PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
    assertEquals(asList(2010L, 2015L,1995L).toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
  });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetArrayValueSourceArrayValuesSameTypeOneSameValue(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:[1995,2014], reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:[2010,2014], reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
    Relationship rel1 = (Relationship) r.get("rel1");
    Relationship rel2 = (Relationship) r.get("rel2");
    PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
    assertEquals(asList(1995L,2014L,2010L).toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
  });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetSingleValueSourceArrayValuesSameType(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:1995, reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:[2010,2015], reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
        Relationship rel1 = (Relationship) r.get("rel1");
        Relationship rel2 = (Relationship) r.get("rel2");
        PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
        assertEquals(asList(1995L,2010L, 2015L).toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
      });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetArrayValueSourceArrayValuesSameType(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:[1995,2014], reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:[2010,2015], reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
        Relationship rel1 = (Relationship) r.get("rel1");
        Relationship rel2 = (Relationship) r.get("rel2");
        PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
        assertEquals(asList(1995L,2014L,2010L, 2015L).toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
      });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetArrayValuesSourceSingleValuesDifferentType(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:[2010,2015], reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:\"1995\", reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
    Relationship rel1 = (Relationship) r.get("rel1");
    Relationship rel2 = (Relationship) r.get("rel2");
    PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
    assertEquals(asList("2010", "2015","1995").toArray(), new ArrayBackedList(rel1.getProperty("year")).toArray());
  });
}

代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures

@Test
public void testCombinePropertiesTargetSingleValueSourceSingleValuesSameTypeAndSameValue(){
  long id = db.execute("Create (d:Person {name:'Daniele'})\n" + "Create (p:Country {name:'USA'})\n" + "Create (d)-[:TRAVELS_TO {year:1996, reason:\"work\"}]->(p)\n"
      + "Create (d)-[:GOES_TO {year:1996, reason:\"fun\"}]->(p)\n" + "Create (d)-[:FLIGHTS_TO {company:\"Air America\"}]->(p) RETURN id(p) as id ").<Long>columnAs("id").next();
  testCall(db, QUERY , (r) -> {
    Relationship rel1 = (Relationship) r.get("rel1");
    Relationship rel2 = (Relationship) r.get("rel2");
    PropertiesManager.mergeProperties(rel2.getProperties("year"), rel1, new RefactorConfig(map("properties","combine")));
    assertEquals(1996L, rel1.getProperty("year"));
  });
}

相关文章