neo4j - Optional match issues -
i'm confused on how use optional match. using same exemple reported earlier (enter link description here), starting mol25 traverse scaffolds , return optionally linked other molecules.
match path=(:molecule {name: 'mol25'}) -[:hassubstructure*1..3]- (s:scaffold) optional match (s) <-[:hassubstructure]- (:molecule) s.num_rings > 1 return path
although scaffold -1796602943 (top-left) substructure of mol26, mol26 not return. have expected optional match (s) <-[:hassubstructure]- (:molecule) return it.
when using before optional match, molecules bearing of scaffolds s, scaffold hierarchy limited first neighbors, expected behavior.
match (:molecule {name: 'mol25'}) -[:hassubstructure*1..3]- (s:scaffold) s optional match p=(s) <-[:hassubstructure]- (:molecule) return p
so, how can scaffolds @ 3 relationships distance , molecules optionally attached of these in single path (required subsequent treatment)?
i think if want return other molecule, have return
it:
match path=(:molecule {name: 'mol25'})-[:hassubstructure*1..3]-(s:scaffold) s.num_rings > 1 optional match (s)<-[:hassubstructure]-(other:molecule) return path, other
Comments
Post a Comment