Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- match (owner:User) - [:USER_CATALOGS] -> (catalog:Catalog)
- where ID(catalog)=$catalog_id
- optional match (catalog) <- [domain_rel:DOMAIN_OF_CATALOG] - (domains:Domain)
- optional match (domains) <- [subdomain_rel:SUB_DOMAIN_TO] - (sub_domain:Domain)
- optional match (catalog) <- [catalog_skill_rel:SKILL_OF_CATALOG] - (skill:Skill)
- optional match (skill) <- [level_of_skill_rel:LEVEL_OF_SKILL*..] - (skill_level:SkillLevel)
- optional match (skill_level) <- [input_level_of_level_rel:INPUT_LEVEL_FOR] - (other_skill_level:SkillLevel)
- optional match (other_skill_level) - [input_level_of_level_rel:LEVEL_OF_SKILL] -> (other_skill:Skill)
- UNWIND (CASE WHEN level_of_skill_rel is NULL then [null] else
- level_of_skill_rel end) as level_of_skill_rels
- return collect(distinct domains {.*, identity: ID(domains)}) as domains,
- count(distinct domains) as domains_count,
- collect( distinct domain_rel
- { identity: id(domain_rel),
- type: type(domain_rel),
- properties: properties(domain_rel),
- start: id(startNode(domain_rel)),
- end: id(endNode(domain_rel))
- }
- ) + collect( distinct subdomain_rel
- { identity: id(subdomain_rel),
- type: type(subdomain_rel),
- properties: properties(subdomain_rel),
- start: id(startNode(subdomain_rel)),
- end: id(endNode(subdomain_rel))
- }
- ) + collect( distinct catalog_skill_rel
- { identity: id(catalog_skill_rel),
- type: type(catalog_skill_rel),
- properties: properties(catalog_skill_rel),
- start: id(startNode(catalog_skill_rel)),
- end: id(endNode(catalog_skill_rel))
- }
- ) + collect( distinct input_level_of_level_rel
- { identity: id(input_level_of_level_rel),
- type: type(input_level_of_level_rel),
- properties: properties(input_level_of_level_rel),
- start: id(startNode(input_level_of_level_rel)),
- end: id(endNode(input_level_of_level_rel))
- }
- ) + collect( distinct level_of_skill_rels
- { identity: id(level_of_skill_rels),
- type: type(level_of_skill_rels),
- properties: properties(level_of_skill_rels),
- start: id(startNode(level_of_skill_rels)),
- end: id(endNode(level_of_skill_rels))
- }
- ) as raw_relations,
- collect(distinct skill {.*, identity: ID(skill)}) as skills,
- catalog
- {
- .*,
- identity: ID(catalog)
- }
- ,owner
- {
- .*,
- identity: ID(owner)
- }
- ,
- collect(distinct skill_level {
- .*,
- identity: ID(skill_level),
- title: skill.title + ':
- ' + skill_level.title
- }
- ) as skill_levels
Advertisement
Add Comment
Please, Sign In to add comment