Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite IC 6 with cypher #84

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions nebula/queries/interactive-complex-6.ngql
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
GO 1 to 2 steps from $personId over KNOWS bidirect where KNOWS._dst <> $personId yield distinct KNOWS._dst as friend |
GO from $-.friend over POST_HAS_CREATOR reversely yield distinct POST_HAS_CREATOR._dst as friendPost |
GO from $-.friendPost over HAS_TAG where $$.`Tag`.name==$tagName yield distinct HAS_TAG._src as postWithSpecifiedTag |
GO from $-.postWithSpecifiedTag over HAS_TAG where $$.`Tag`.name<>$tagName yield distinct $$.`Tag`.name as otherTagName, HAS_TAG._src as commonPost |
group by $-.otherTagName yield $-.otherTagName as otherTagName, count($-.commonPost) as postCount |
order by $-.postCount desc, $-.otherTagName ASC |
limit 10
MATCH (person:Person)-[:KNOWS*1..2]-(friend:Person)
WHERE id(person) == $personId AND id(friend) != $personId
WITH DISTINCT friend
MATCH (knownTag:`Tag`{name: $tagName})<-[:HAS_TAG]-(post:Post),
(post)-[:POST_HAS_CREATOR]->(friend:Person),
(post)-[:HAS_TAG]->(t:`Tag`)
WHERE t.`Tag`.name != $tagName
RETURN t.`Tag`.name AS tagName, count(id(post)) AS postCount
ORDER BY postCount DESC, tagName ASC
LIMIT 10