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 

enter image description here

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)?

enter image description here

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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -