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

Fix ic4 ic7 #88

Merged
merged 3 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
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
27 changes: 16 additions & 11 deletions nebula/queries/interactive-complex-4.ngql
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
MATCH (person:Person)-[:KNOWS]-(:Person)<-[:POST_HAS_CREATOR]-(post:Post), (post)-[:HAS_TAG]->(`tag`:`Tag`)
WHERE id(person) == $personId AND post.Post.creationDate >= $startDate AND post.Post.creationDate < $endDate
WITH person, count(post) AS postsOnTag, `tag`
OPTIONAL MATCH (person)-[:KNOWS]-()<-[:POST_HAS_CREATOR]-(oldPost:Post), (oldPost)-[:HAS_TAG]->(`tag`)
WHERE oldPost.Post.creationDate < $startDate
WITH person, postsOnTag, `tag`, count(oldPost) AS cp
WHERE cp == 0
RETURN
`tag`.`Tag`.name AS tagName,
sum(postsOnTag) AS postCount
MATCH (person:Person)-[:KNOWS]-(friend:Person)<-[:POST_HAS_CREATOR]-(post:Post)-[:HAS_TAG]->(`tag`:`Tag`)
WHERE id(person) == $personId
WITH DISTINCT `tag`.`Tag`.name AS tagName, post.Post.creationDate AS creationDate
WITH tagName,
CASE
WHEN creationDate >= $startDate AND creationDate < $endDate THEN 1
ELSE 0
END AS valid,
CASE
WHEN creationDate < $startDate THEN 1
ELSE 0
END AS inValid
WITH tagName, sum(valid) AS postCount, sum(inValid) AS inValidPostCount
WHERE postCount > 0 AND inValidPostCount == 0
RETURN tagName, postCount
ORDER BY postCount DESC, tagName ASC
LIMIT 10
LIMIT 10
9 changes: 6 additions & 3 deletions nebula/queries/interactive-complex-7.ngql
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ RETURN
latestLike.likeTime AS likeCreationDate,
id(latestLike.msg) AS messageId,
CASE WHEN tags(latestLike.msg) == ["Post"] THEN
CASE WHEN size(latestLike.msg.imageFile) == 0 THEN latestLike.msg.content
ELSE latestLike.msg.imageFile
CASE WHEN size(latestLike.msg.`Post`.imageFile) == 0 THEN latestLike.msg.`Post`.content
ELSE latestLike.msg.`Post`.imageFile
END
ELSE latestLike.msg.`Comment`.content
END AS messageContent,
latestLike.msg.`Comment`.creationDate AS messageCreationDate,
CASE WHEN tags(latestLike.msg) == ["Post"] THEN
latestLike.msg.`Post`.creationDate
ELSE latestLike.msg.`Comment`.creationDate
END as messageCreationDate,
e IS NULL AS isNew
ORDER BY
likeCreationDate DESC,
Expand Down