forked from ldbc/ldbc_snb_interactive_v1_impls
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
110 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
GO 1 TO 2 STEPS FROM $personId OVER KNOWS BIDIRECT WHERE KNOWS._dst != $personId YIELD distinct KNOWS._dst AS friendId | GO FROM $-.friendId OVER WORK_AT WHERE WORK_AT.workFrom < $workFromYear YIELD $-.friendId AS friendId, $^.Person.firstName AS firstName, $^.Person.lastName AS lastName, WORK_AT.workFrom AS workFrom, WORK_AT._dst AS orgId| GO FROM $-.orgId OVER IS_LOCATED_IN WHERE $$.Place.name == $countryName YIELD toInteger(substr($-.friendId, 2)) AS personId, $-.firstName AS personFirstName, $-.lastName AS personLastName, $^.Organisation.name AS organizationName, $-.workFrom AS organizationWorkFromYear | ORDER BY $-.organizationWorkFromYear ASC, $-.personId ASC, $-.organizationName DESC | LIMIT 10 | ||
GO 1 TO 2 STEPS FROM $personId OVER KNOWS BIDIRECT WHERE KNOWS._dst != $personId YIELD distinct KNOWS._dst AS friendId | | ||
GO FROM $-.friendId OVER WORK_AT WHERE WORK_AT.workFrom < $workFromYear | ||
YIELD $-.friendId AS friendId, | ||
$^.Person.firstName AS firstName, | ||
$^.Person.lastName AS lastName, | ||
WORK_AT.workFrom AS workFrom, | ||
WORK_AT._dst AS orgId | | ||
GO FROM $-.orgId OVER IS_LOCATED_IN WHERE $$.Place.name == $countryName | ||
YIELD toInteger(substr($-.friendId, 2)) AS personId, | ||
$-.firstName AS personFirstName, | ||
$-.lastName AS personLastName, | ||
$^.Organisation.name AS organizationName, | ||
$-.workFrom AS organizationWorkFromYear | | ||
ORDER BY $-.organizationWorkFromYear ASC, $-.personId ASC, $-.organizationName DESC | | ||
LIMIT 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
MATCH (tag1:`Tag`)-[:HAS_TYPE|IS_SUBCLASS_OF*0..6]->(baseTagClass:Tagclass) | ||
WHERE tag1.`Tag`.name == $tagClassName OR baseTagClass.Tagclass.name == $tagClassName | ||
WITH collect(id(tag1)) as T | ||
MATCH (p:Person)-[:KNOWS]-(friend:Person)<-[:COMMENT_HAS_CREATOR]-(comment1:`Comment`)-[:REPLY_OF_POST]->(:Post)-[:HAS_TAG]->(tag2:`Tag`) | ||
WHERE id(p) == $personId AND id(tag2) in T | ||
MATCH (p:Person)-[:KNOWS]-(friend:Person)<-[:COMMENT_HAS_CREATOR]-(comment1:`Comment`), | ||
(tag1:`Tag`)<-[:HAS_TAG]-(:Post)<-[:REPLY_OF_POST]->(comment1:`Comment`) | ||
WHERE id(p) == $personId | ||
RETURN | ||
toInteger(substr(id(friend),2)) AS personId, | ||
friend.Person.firstName AS personFirstName, | ||
friend.Person.lastName AS personLastName, | ||
collect(DISTINCT tag2.`Tag`.name) AS tagNames, | ||
collect(DISTINCT tag1.`Tag`.name) AS tagNames, | ||
count(DISTINCT id(comment1)) AS replyCount | ||
ORDER BY | ||
replyCount DESC, | ||
personId ASC | ||
LIMIT 20 | ||
LIMIT 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
find shortest path from $person1Id to $person2Id over KNOWS BIDIRECT yield path as p|yield collect(length($-.p)) AS l | yield case size($-.l) when 0 then -1 else $-.l[0] end; | ||
find shortest path from $person1Id to $person2Id over KNOWS BIDIRECT yield path as p | | ||
yield collect(length($-.p)) AS l | | ||
yield case size($-.l) when 0 then -1 else $-.l[0] end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
GO FROM $personId OVER KNOWS BIDIRECT YIELD KNOWS._dst AS friendId | ||
| GO FROM $-.friendId OVER POST_HAS_CREATOR, COMMENT_HAS_CREATOR REVERSELY WHERE (COMMENT_HAS_CREATOR.creationDate is not EMPTY and COMMENT_HAS_CREATOR.creationDate <= $maxDate) or (POST_HAS_CREATOR.creationDate is not EMPTY and POST_HAS_CREATOR.creationDate <= $maxDate) | ||
GO FROM $personId OVER KNOWS BIDIRECT YIELD KNOWS._dst AS friendId | | ||
GO FROM $-.friendId OVER POST_HAS_CREATOR, COMMENT_HAS_CREATOR REVERSELY | ||
WHERE | ||
(COMMENT_HAS_CREATOR.creationDate is not EMPTY and COMMENT_HAS_CREATOR.creationDate <= $maxDate) or (POST_HAS_CREATOR.creationDate is not EMPTY and POST_HAS_CREATOR.creationDate <= $maxDate) | ||
YIELD | ||
toInteger(substr($-.friendId, 2)) AS personId, | ||
$^.Person.firstName AS personFirstName, | ||
$^.Person.lastName AS personLastName, | ||
toInteger(substr(id($$), 2)) AS messageId, | ||
CASE WHEN COMMENT_HAS_CREATOR.content is not EMPTY THEN COMMENT_HAS_CREATOR.content ELSE CASE size(POST_HAS_CREATOR.imageFile) WHEN 0 THEN POST_HAS_CREATOR.content ELSE POST_HAS_CREATOR.imageFile END END AS messageContent, | ||
CASE WHEN COMMENT_HAS_CREATOR.creationDate is not EMPTY THEN COMMENT_HAS_CREATOR.creationDate ELSE POST_HAS_CREATOR.creationDate END AS messageCreationDate | ||
| ORDER BY $-.messageCreationDate DESC, $-.messageId ASC | LIMIT 20 | ||
toInteger(substr($-.friendId, 2)) AS personId, | ||
$^.Person.firstName AS personFirstName, | ||
$^.Person.lastName AS personLastName, | ||
toInteger(substr(id($$), 2)) AS messageId, | ||
CASE | ||
WHEN COMMENT_HAS_CREATOR.content is not EMPTY | ||
THEN COMMENT_HAS_CREATOR.content | ||
ELSE | ||
CASE size(POST_HAS_CREATOR.imageFile) | ||
WHEN 0 THEN POST_HAS_CREATOR.content | ||
ELSE POST_HAS_CREATOR.imageFile | ||
END | ||
END AS messageContent, | ||
CASE | ||
WHEN COMMENT_HAS_CREATOR.creationDate is not EMPTY | ||
THEN COMMENT_HAS_CREATOR.creationDate | ||
ELSE POST_HAS_CREATOR.creationDate | ||
END AS messageCreationDate | | ||
ORDER BY $-.messageCreationDate DESC, $-.messageId ASC | | ||
LIMIT 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
MATCH (person:Person)-[:KNOWS]-(:Person)<-[:POST_HAS_CREATOR]-(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)-[: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 | ||
ORDER BY postCount DESC, tagName ASC | ||
limit 10 | ||
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 | ||
ORDER BY postCount DESC, tagName ASC | ||
LIMIT 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
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 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
GO FROM $personId OVER POST_HAS_CREATOR, COMMENT_HAS_CREATOR REVERSELY YIELD id($$) AS messageId | GO FROM $-.messageId OVER REPLY_OF_COMMENT, REPLY_OF_POST REVERSELY YIELD id($$) AS commentId | GO FROM $-.commentId OVER COMMENT_HAS_CREATOR YIELD COMMENT_HAS_CREATOR._dst AS personId, $$.Person.firstName AS personFirstName, $$.Person.lastName AS personLastName, $^.`Comment`.creationDate AS commentCreationDate, toInteger(substr($-.commentId, 2)) AS commentId, $^.`Comment`.content AS commentContent |ORDER BY $-.commentCreationDate DESC, $-.commentId ASC|LIMIT 20 | ||
GO FROM $personId OVER POST_HAS_CREATOR, COMMENT_HAS_CREATOR REVERSELY YIELD id($$) AS messageId | | ||
GO FROM $-.messageId OVER REPLY_OF_COMMENT, REPLY_OF_POST REVERSELY YIELD id($$) AS commentId | | ||
GO FROM $-.commentId OVER COMMENT_HAS_CREATOR | ||
YIELD COMMENT_HAS_CREATOR._dst AS personId, | ||
$$.Person.firstName AS personFirstName, | ||
$$.Person.lastName AS personLastName, | ||
$^.`Comment`.creationDate AS commentCreationDate, | ||
toInteger(substr($-.commentId, 2)) AS commentId, | ||
$^.`Comment`.content AS commentContent | | ||
ORDER BY $-.commentCreationDate DESC, $-.commentId ASC | | ||
LIMIT 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters