MATCH (p:Person),(s:Strength)
WHERE p.Strength = s.Name AND p.Strength = "Responsibility"
CREATE (p)-[r:Responsibility]->(s)
RETURN p,s
I see this:
How do I get the relationship 'lines' (e.g. labeled as "Responsibility") to be labeled with the Person's "Level" (an integer value property from the Person schema) instead of the name of the relationship?
The level/strength properties are set for the nodes in your example. If you want the same properties for the relationships, you would simply use the SET clause to set the values. Also, I would recommend you use Merge for creating the relationships to ensure you do not create duplicate relationships.
For example:
MATCH (p:Person),(s:Strength)
WHERE p.Strength = s.Name AND p.Strength = "Responsibility"
MERGE (p)-[r:Responsibility]->(s)
SET r.Strength = "xxx"
RETURN p,s
This will set the property for the relationship. Ideally you do not want to duplicate data (node property/relationship property) in the graph.
As the 'Level' property values are integers you will have a problem in selecting the relationship as the relationship label has to be a string. Here are the workarounds for this problem,
1: Use Level values (needs to be converted to string)
MATCH (p:Person),(s:Strength)
WHERE p.Strength = s.Name AND p.Strength = "Responsibility"
WITH p, s
CALL apoc.create.relationship(p, toString(p.Level), {}, s) YIELD rel
RETURN p, s;
To select relationship "8" workaround:
MATCH (p:Person)-[r]-(s)
WHERE Type (r) = "8"
RETURN p, s;
2: Prefix Level value with letter "S":
MATCH (p:Person),(s:Strength)
WHERE p.Strength = s.Name AND p.Strength = "Responsibility"
WITH p, s
CALL apoc.create.relationship(p, ("S" + toString(p.Level)), {}, s) YIELD rel
RETURN p, s;