本文整理了Java中org.neo4j.graphdb.Relationship.getAllProperties
方法的一些代码示例,展示了Relationship.getAllProperties
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relationship.getAllProperties
方法的具体详情如下:
包路径:org.neo4j.graphdb.Relationship
类名称:Relationship
方法名:getAllProperties
暂无
代码示例来源:origin: neo4j/neo4j
@Override
public MapValue properties()
{
MapValue m = properties;
if ( m == null )
{
synchronized ( this )
{
m = properties;
if ( m == null )
{
m = properties = ValueUtils.asMapValue( relationship.getAllProperties() );
}
}
}
return m;
}
}
代码示例来源:origin: neo4j/neo4j
private void cloneProperties( Relationship oldRelationship, Relationship newRelationship )
{
for ( Map.Entry<String, Object> property : oldRelationship.getAllProperties().entrySet() )
{
newRelationship.setProperty( property.getKey(), property.getValue() );
}
}
代码示例来源:origin: neo4j/neo4j
public Map<String, Object> getRelationshipProperties( long relationshipId )
{
try ( Transaction tx = database.getGraph().beginTransaction( implicit, AnonymousContext.read() ) )
{
Relationship relationship = database.getGraph().getRelationshipById( relationshipId );
Map<String, Object> allProperties = relationship.getAllProperties();
tx.success();
return allProperties;
}
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
private Map<String, Object> addRelProperties(Map<String, Object> mMap, String typeName, Relationship r) {
Map<String, Object> rProps = r.getAllProperties();
if (rProps.isEmpty()) return mMap;
String prefix = typeName + ".";
rProps.forEach((k, v) -> mMap.put(prefix + k, v));
return mMap;
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
public static String formatRelationshipProperties(String id, Relationship relationship, boolean jsonStyle) {
StringBuilder result = formatProperties(id, relationship.getAllProperties(), jsonStyle);
return result.length() > 0 ? result.substring(2) : "";
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
private void writeRel(Reporter reporter, JsonGenerator jsonGenerator, Relationship rel, ExportConfig config) throws IOException {
Map<String, Object> allProperties = rel.getAllProperties();
JsonFormatSerializer.DEFAULT.writeRelationship(jsonGenerator, rel, config);
reporter.update(0, 1, allProperties.size());
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
private Relationship mergeRels(Relationship source, Relationship target, boolean delete, RefactorConfig conf) {
Map<String, Object> properties = source.getAllProperties();
if (delete) source.delete();
PropertiesManager.mergeProperties(properties, target, conf);
return target;
}
代码示例来源:origin: neo4j/neo4j
assertTrue( rel1.hasProperty( key3 ) );
Map<String,Object> properties = rel1.getAllProperties();
assertEquals( properties.get( key1 ), int1 );
assertEquals( properties.get( key2 ), int2 );
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@Override
public void writeRelationship(JsonGenerator jsonGenerator, Relationship rel, ExportConfig config) throws IOException {
Node startNode = rel.getStartNode();
Node endNode = rel.getEndNode();
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField("id", String.valueOf(rel.getId()));
jsonGenerator.writeStringField("type", "relationship");
jsonGenerator.writeStringField("label", rel.getType().toString());
serializeProperties(jsonGenerator, rel.getAllProperties());
writeRelationshipNode(jsonGenerator, "start", startNode, config);
writeRelationshipNode(jsonGenerator, "end", endNode, config);
jsonGenerator.writeEndObject();
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@UserFunction("apoc.meta.cypher.types")
@Description("apoc.meta.cypher.types(node-relationship-map) - returns a map of keys to types")
public Map<String,Object> typesCypher(@Name("properties") Object target) {
Map<String,Object> properties = Collections.emptyMap();
if (target instanceof Node) properties = ((Node)target).getAllProperties();
if (target instanceof Relationship) properties = ((Relationship)target).getAllProperties();
if (target instanceof Map) {
//noinspection unchecked
properties = (Map<String, Object>) target;
}
Map<String,Object> result = new LinkedHashMap<>(properties.size());
properties.forEach((key,value) -> {
result.put(key, typeCypher(value));
});
return result;
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@Deprecated
@UserFunction
@Description("apoc.meta.types(node-relationship-map) - returns a map of keys to types")
public Map<String,Object> types(@Name("properties") Object target) {
Map<String,Object> properties = Collections.emptyMap();
if (target instanceof Node) properties = ((Node)target).getAllProperties();
if (target instanceof Relationship) properties = ((Relationship)target).getAllProperties();
if (target instanceof Map) {
//noinspection unchecked
properties = (Map<String, Object>) target;
}
Map<String,Object> result = new LinkedHashMap<>(properties.size());
properties.forEach((key,value) -> {
result.put(key, typeName(value));
});
return result;
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
public List<Relationship> getRelationships(Node n, Map<String, Number> filter, int relsPerNode) {
List<Relationship> rels = fixAggregates(Iterables.asList(n.getRelationships()));
if (filter != null) rels.removeIf(r -> !filter(r.getType().name(),r.getAllProperties(),filter));
if (relsPerNode > -1) rels = rels.subList(0, Math.min(relsPerNode, rels.size()));
return rels;
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
String relationship = cypherName(config, "relationship", () -> "", Util::quote);
String end = cypherName(config,"end", ()->toCypher(rel.getEndNode(),config),(s)->'('+quote(s)+')');
return start+"-["+relationship+type+' '+ toCypher(rel.getAllProperties(), config)+"]->"+ end;
代码示例来源:origin: org.neo4j/neo4j-shell
@Override
public Map<String, Object> getAllProperties()
{
return actual.getAllProperties();
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
assertBar(((Node)r.get("bar")));
assertEquals("EDGE_LABEL", ((Relationship)r.get("rel")).getType().name());
assertEquals(Util.map("name", "foo"), ((Relationship)r.get("rel")).getAllProperties());
});
TestUtil.testCall(db, "MATCH (bar:BAR)-[test:TEST]->(foo:FOO) RETURN bar, test, foo", null, (r) -> {
代码示例来源:origin: org.neo4j/neo4j-kernel
@Override
public MapValue properties()
{
MapValue m = properties;
if ( m == null )
{
synchronized ( this )
{
m = properties;
if ( m == null )
{
m = properties = ValueUtils.asMapValue( relationship.getAllProperties() );
}
}
}
return m;
}
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@Test
public void testMergeRelationships() throws Exception {
db.execute("create (:Person{name:'Foo'}), (:Person{name:'Bar'})");
testCall(db, "MERGE (s:Person{name:'Foo'}) MERGE (e:Person{name:'Bar'}) WITH s,e CALL apoc.merge.relationship(s, 'KNOWS', {rid:123}, {since:'Thu'}, e) YIELD rel RETURN rel",
(row) -> {
Relationship rel = (Relationship) row.get("rel");
assertEquals("KNOWS", rel.getType().name());
assertEquals(123l, rel.getProperty("rid"));
assertEquals("Thu", rel.getProperty("since"));
});
testCall(db, "MERGE (s:Person{name:'Foo'}) MERGE (e:Person{name:'Bar'}) WITH s,e CALL apoc.merge.relationship(s, 'KNOWS', {rid:123}, {since:'Fri'}, e) YIELD rel RETURN rel",
(row) -> {
Relationship rel = (Relationship) row.get("rel");
assertEquals("KNOWS", rel.getType().name());
assertEquals(123l, rel.getProperty("rid"));
assertEquals("Thu", rel.getProperty("since"));
});
testCall(db, "MERGE (s:Person{name:'Foo'}) MERGE (e:Person{name:'Bar'}) WITH s,e CALL apoc.merge.relationship(s, 'OTHER', null, null, e) YIELD rel RETURN rel",
(row) -> {
Relationship rel = (Relationship) row.get("rel");
assertEquals("OTHER", rel.getType().name());
assertTrue(rel.getAllProperties().isEmpty());
});
}
代码示例来源:origin: h-omer/neo4j-versioner-core
protected static void connectStateToRs(Node sourceState, Node newState) {
streamOfIterable(sourceState.getRelationships(Direction.OUTGOING))
.filter(rel -> rel.getEndNode().hasLabel(Label.label("R")))
.forEach(rel -> RelationshipProcedure.createRelationship(newState, rel.getEndNode(), rel.getType().name(), rel.getAllProperties()));
}
}
代码示例来源:origin: jexp/neo4j-shell-tools
private int writeRelationship(Output output, Relationship relationship) {
// WRITE RELATIONSHIP
kryo.writeObject(output, KryoSerializationTypes.RELATIONSHIP.name());
kryo.writeObject(output, relationship.getId());
// WRITE SOURCE
kryo.writeObject(output, relationship.getStartNode().getId());
// WRITE TARGET
kryo.writeObject(output, relationship.getEndNode().getId());
// WRITE LABEL
kryo.writeObject(output, relationship.getType().name());
// WRITE PROPERTIES
Map<String, Object> properties = relationship.getAllProperties();
kryo.writeObject(output, relationship.getAllProperties());
return properties.size();
}
}
代码示例来源:origin: org.neo4j/neo4j-ogm-drivers
private RelationshipModel buildRelationship(Relationship relationship) {
RelationshipModel relationshipModel = new RelationshipModel();
relationshipModel.setId(relationship.getId());
relationshipModel.setStartNode(relationship.getStartNode().getId());
relationshipModel.setEndNode(relationship.getEndNode().getId());
relationshipModel.setType(relationship.getType().name());
relationshipModel.setProperties(relationship.getAllProperties());
return relationshipModel;
}
}
内容来源于网络,如有侵权,请联系作者删除!