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 error #47

Merged
merged 1 commit into from
Nov 10, 2022
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
4 changes: 2 additions & 2 deletions nebula/queries/interactive-complex-1.ngql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MATCH p=(person:Person)-[:KNOWS*1..3]-(friend:Person {firstName: $firstName})
WHERE id(person) == $personId AND id(friend) != $personId
WITH friend,toInteger(substr(id(friend), 2)) as friendId, min(length(p)) AS distance
ORDER BY distance ASC, friend.Person.lastName ASC, friendId ASC
WITH friend,toInteger(substr(id(friend), 2)) as friendId, min(length(p)) AS distance, friend.Person.lastName AS lastName
ORDER BY distance ASC, lastName ASC, friendId ASC
LIMIT 20
MATCH (friend)-[:IS_LOCATED_IN]->(friendCity:Place)
OPTIONAL MATCH (friend)-[studyAt:STUDY_AT]->(uni:Organisation)-[:IS_LOCATED_IN]->(uniCity:Place)
Expand Down
2 changes: 1 addition & 1 deletion nebula/queries/interactive-complex-10.ngql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WITH person, city, friend, datetime({epochMillis: friend.Person.birthday}) as bi
WHERE (birthday.month==$month AND birthday.day>=21) OR
(birthday.month==($month%12)+1 AND birthday.day<22)
WITH DISTINCT friend, city, person
OPTIONAL MATCH (friend)<-[:HAS_CREATOR]-(post:Post)
OPTIONAL MATCH (friend)<-[:POST_HAS_CREATOR]-(post:Post)
WITH friend, city, collect(post) AS posts, person
WITH friend,
city,
Expand Down
19 changes: 12 additions & 7 deletions nebula/queries/interactive-complex-12.ngql
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
MATCH (n:Person)-[:KNOWS]-(friend:Person)<-[:COMMENT_HAS_CREATOR]-(`comment`:`Comment`)-[:REPLY_OF_POST]->(:Post)-[:HAS_TAG]->(`tag`:`Tag`)-[:HAS_TYPE]->(tagClass:Tagclass)-[:IS_SUBCLASS_OF*0..100]->(baseTagClass:Tagclass)
WHERE id(n) == $personId AND (tagClass.Tagclass.name == $tagClassName OR baseTagClass.Tagclass.name == $tagClassName)
RETURN
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
RETURN
toInteger(substr(id(friend),2)) AS personId,
friend.Person.firstName AS personFirstName,
friend.Person.lastName AS personLastName,
collect(DISTINCT `tag`.`Tag`.name) AS tagNames,
count(DISTINCT id(`comment`)) AS replyCount
ORDER BY replyCount DESC, personId ASC
LIMIT 20
collect(DISTINCT tag2.`Tag`.name) AS tagNames,
count(DISTINCT id(comment1)) AS replyCount
ORDER BY
replyCount DESC,
personId ASC
LIMIT 20
12 changes: 11 additions & 1 deletion nebula/queries/interactive-complex-5.ngql
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
GO 1 TO 2 STEPS FROM $personId OVER KNOWS WHERE KNOWS._dst != $personId YIELD distinct KNOWS._dst AS friendId | GO FROM $-.friendId OVER HAS_MEMBER REVERSELY WHERE HAS_MEMBER.joinDate > $minDate YIELD distinct HAS_MEMBER._dst AS forumId, $-.friendId as friendId| GO FROM $-.forumId OVER CONTAINER_OF YIELD $-.friendId AS friendId, $^.Forum.title AS title, $-.forumId AS forumId, CONTAINER_OF._dst AS postId | GO FROM $-.postId OVER POST_HAS_CREATOR WHERE POST_HAS_CREATOR._dst == $-.friendId YIELD $-.forumId AS forumId, $-.title AS forumTitle, $-.postId AS postId | group by $-.forumId, $-.forumTitle YIELD toInteger(substr($-.forumId, 2)) AS forumId, $-.forumTitle AS forumTitle, count($-.postId) AS postCount | ORDER BY $-.postCount DESC, $-.forumId ASC | LIMIT 20
MATCH (person:Person)-[:KNOWS*1..2]-(friend:Person)<-[membership:HAS_MEMBER]-(forum:Forum)
WHERE id(person) == $personId AND id(friend) != $personId AND membership.joinDate > $minDate
WITH DISTINCT friend, forum
OPTIONAL MATCH (friend)<-[:POST_HAS_CREATOR]-(post:Post)<-[:CONTAINER_OF]-(forum)
WITH forum, count(post) AS postCount
RETURN
toInteger(substr(id(forum),2)) AS forumId,
forum.Forum.title AS forumTitle,
postCount
ORDER BY postCount DESC, forumId ASC
LIMIT 20
8 changes: 6 additions & 2 deletions nebula/queries/interactive-complex-7.ngql
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ RETURN
liker.Person.lastName AS personLastName,
latestLike.likeTime AS likeCreationDate,
id(latestLike.msg) AS messageId,
CASE WHEN tags(latestLike.msg) == ["Post"] THEN latestLike.msg.imageFile
ELSE latestLike.msg.content END AS messageContent,
CASE WHEN tags(latestLike.msg) == ["Post"] THEN
CASE WHEN size(latestLike.msg.imageFile) == 0 THEN latestLike.msg.content
ELSE latestLike.msg.imageFile
END
ELSE latestLike.msg.content
END AS messageContent,
latestLike.msg.creationDate AS messageCreationDate,
p IS NULL AS isNew
ORDER BY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -89,16 +90,11 @@ public LdbcQuery1Result convertSingleResult(ResultSet.Record record) throws Unsu

List<String> emails = new ArrayList<>();
if (!record.get(8).isNull()) {
for (ValueWrapper email : record.get(8).asList()) {
emails.add(email.asString());
}
Collections.addAll(emails, record.get(8).asString().split(","));
}

List<String> languages = new ArrayList<>();
if (!record.get(9).isNull()) {
for (ValueWrapper lang : record.get(9).asList()) {
languages.add(lang.asString());
}
Collections.addAll(languages, record.get(9).asString().split(","));
}

List<LdbcQuery1Result.Organization> universities = new ArrayList<>();
Expand Down