Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-17-2018 03:12 AM
Hi,
I have a problem, trying to propagate values in a network:
my procedure:
@Procedure(name="clesius.propagate", mode=Mode.WRITE)
@Description("it.clesius.propagate('netName, 'inputName','inputValue') - propagate in net
<TrendStart>
name or<Node>
name with value.")
public Stream<MapResult>
propagate(
@Name("net") String netName,
@Name("name") String inputName,
@Name(value = "value", defaultValue = "0") String inputValue)
{
....
propagation is OK
sets calculated properties in nodes
....
// try to redraw all nodes
String cypher = "MATCH p=(n:"+netName+")-[r:to]->(m:"+netName+") OPTIONAL MATCH >(x:"+netName+") WHERE not( (x)-[:to]-() ) return n,m,p,x";
try{
Result result = db.execute(cypher);
log.info("Result: "+result);
Stream<MapResult>
stream = result.stream().map(MapResult::new);
log.info("Result: "+stream);
return stream;
}catch(RuntimeException e){
log.error("RuntimeException executing cypher "+e);
return Stream.empty();
}
in Desktop-Browser (Version 1.1.10), (Database Version 3.4.1):
call clesius.propagate("Node","ricco")
results in:
Neo.ClientError.Transaction.TransactionMarkedAsFailed: Transaction rolled back even if marked as successful
but at the end of neo4j.log, there is only:
2018-10-17 09:30:26.068+0000 INFO Result: non-empty iterator
2018-10-17 09:30:26.074+0000 INFO Result: java.util.stream.ReferencePipeline$3@46a4dcfc
If I return Stream.empty() , all new properties are set, hence same cypher in Browser:
MATCH p=(n:Node)-[r:to]->(m:Node) OPTIONAL MATCH (x:Node) WHERE not( (x)-[:to]-() ) return n,m,p,x
is OK and has its new properties
Where is my fault?
10-17-2018 06:52 AM
Sorry, I forgot:
public class MapResult {
public final Map<String, Object> value;
public MapResult(Map<String, Object> value) {
this.value = value;
}
}
All the sessions of the conference are now available online