however, I want change relationship between s and o by another like this:
load csv with headers
from 'file:///knowledge_triple.csv'
as line
with line.Subject as sub, line.Predicate as pre, line.Object as obj
merge (s:subject{name:sub})
merge (o:object{name:obj})
merge (s)-[pre]->(o)
this cannot be correct, I wonder if it's possiable. 3q
Try this:
CALL apoc.create.relationship(s, pre,{}, o) YIELD rel
REMOVE rel.noOp
// REMOVE rel.noOp is a dummy script as we have to have a return value.
In this particular case, I think what they were asking for was a way to create the type of the relationship dynamically (from a variable, parameter, or other derived value), so the lack of the colon for the type was intended here (though good eyes, these typos are common).
And dynamic relationship type isn't supported in Cypher (nor is dynamic node labeling), so APOC procs would be the workaround, as ameyasoft provided.