ldbc: Extract update queries
Summary: Convert update queries to oC supported by MG Ignore ve2 in ldbc Reviewers: buda, mislav.bradac, florijan Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D733
This commit is contained in:
parent
2111612fc8
commit
26297ca641
1
tests/public_benchmark/ldbc/.gitignore
vendored
1
tests/public_benchmark/ldbc/.gitignore
vendored
@ -4,4 +4,5 @@ ldbc-snb-impls/
|
||||
neo4j_csv_dataset_scale_*/
|
||||
tmp/
|
||||
ve3/
|
||||
ve2/
|
||||
*.out
|
||||
|
19
tests/public_benchmark/ldbc/test_cases/queries/update_1.cyp
Normal file
19
tests/public_benchmark/ldbc/test_cases/queries/update_1.cyp
Normal file
@ -0,0 +1,19 @@
|
||||
// LdbcUpdate1AddPerson{personId=35184372093118, personFirstName='Sanjay', personLastName='Anand', gender='male', birthday=Sat Jun 11 02:00:00 CEST 1988, creationDate=Thu Sep 13 12:52:35 CEST 2012, locationIp='103.1.131.183', browserUsed='Firefox', cityId=117, languages=[te, bn, en], emails=[Sanjay35184372093118@gmail.com, Sanjay35184372093118@gmx.com, Sanjay35184372093118@yahoo.com], tagIds=[4, 571, 1187, 2931, 8163, 10222, 12296], studyAt=[Organization{organizationId=3650, year=2007}], workAt=[Organization{organizationId=554, year=2008}]}
|
||||
|
||||
// Create the person node.
|
||||
CREATE (p:Person {id: "35184372093118", firstName: 'Sanjay', lastName: 'Anand', gender: 'male', birthday: 581990400000, creationDate: 1347533555467, locationIP: '103.1.131.183', browserUsed: 'Firefox', speaks: ["te", "bn", "en"], emails: ["Sanjay35184372093118@gmail.com", "Sanjay35184372093118@gmx.com", "Sanjay35184372093118@yahoo.com"]});
|
||||
|
||||
// Add isLocatedIn and hasInterest relationships.
|
||||
MATCH (p:Person {id: "35184372093118"}),
|
||||
(c:Place {id: "117"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["4", "571", "1187", "2931", "8163", "10222", "12296"]
|
||||
WITH p, c, collect(t) AS tagSet
|
||||
CREATE (p)-[:IS_LOCATED_IN]->(c)
|
||||
FOREACH(t IN tagSet| CREATE (p)-[:HAS_INTEREST]->(t));
|
||||
|
||||
// Add for each studyAt
|
||||
MATCH (p:Person {id: "35184372093118"}), (u0:Organisation {id: 3650}) CREATE (p)-[:STUDY_AT {classYear: 2007}]->(u0);
|
||||
|
||||
// Add for each workAt
|
||||
MATCH (p:Person {id: "35184372093118"}), (c0:Organisation {id: 554}) CREATE (p)-[:WORK_AT {workFrom: 2008}]->(c0);
|
20
tests/public_benchmark/ldbc/test_cases/queries/update_1.oc
Normal file
20
tests/public_benchmark/ldbc/test_cases/queries/update_1.oc
Normal file
@ -0,0 +1,20 @@
|
||||
// LdbcUpdate1AddPerson{personId=35184372093118, personFirstName='Sanjay', personLastName='Anand', gender='male', birthday=Sat Jun 11 02:00:00 CEST 1988, creationDate=Thu Sep 13 12:52:35 CEST 2012, locationIp='103.1.131.183', browserUsed='Firefox', cityId=117, languages=[te, bn, en], emails=[Sanjay35184372093118@gmail.com, Sanjay35184372093118@gmx.com, Sanjay35184372093118@yahoo.com], tagIds=[4, 571, 1187, 2931, 8163, 10222, 12296], studyAt=[Organization{organizationId=3650, year=2007}], workAt=[Organization{organizationId=554, year=2008}]}
|
||||
|
||||
// Create the person node.
|
||||
CREATE (p:Person {id: "35184372093118", firstName: 'Sanjay', lastName: 'Anand', gender: 'male', birthday: 581990400000, creationDate: 1347533555467, locationIP: '103.1.131.183', browserUsed: 'Firefox', speaks: ["te", "bn", "en"], emails: ["Sanjay35184372093118@gmail.com", "Sanjay35184372093118@gmx.com", "Sanjay35184372093118@yahoo.com"]});
|
||||
|
||||
// Add isLocatedIn and hasInterest relationships.
|
||||
MATCH (p:Person {id: "35184372093118"}),
|
||||
(c:Place {id: "117"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["4", "571", "1187", "2931", "8163", "10222", "12296"]
|
||||
WITH p, c, collect(t) AS tagSet
|
||||
CREATE (p)-[:IS_LOCATED_IN]->(c)
|
||||
// FOREACH(t IN tagSet| CREATE (p)-[:HAS_INTEREST]->(t));
|
||||
WITH p, tagSet UNWIND list AS t CREATE (p)-[:HAS_INTEREST]->(t);
|
||||
|
||||
// Add for each studyAt
|
||||
MATCH (p:Person {id: "35184372093118"}), (u0:Organisation {id: 3650}) CREATE (p)-[:STUDY_AT {classYear: 2007}]->(u0);
|
||||
|
||||
// Add for each workAt
|
||||
MATCH (p:Person {id: "35184372093118"}), (c0:Organisation {id: 554}) CREATE (p)-[:WORK_AT {workFrom: 2008}]->(c0);
|
12
tests/public_benchmark/ldbc/test_cases/queries/update_2.cyp
Normal file
12
tests/public_benchmark/ldbc/test_cases/queries/update_2.cyp
Normal file
@ -0,0 +1,12 @@
|
||||
// Parameters are read from an arbitrary line in ldbc_snb_datagen/social_network/updateStream_0_0_forum.csv
|
||||
// First 3 columns are skipped, then read in order and passed as arguments.
|
||||
// Missing columns are filled with ""
|
||||
// The easiest way is to run QueryTester and see the parameters.
|
||||
|
||||
// LdbcUpdate2AddPostLike{personId=26388279073665, postId=1236953235741, creationDate=Thu Sep 13 11:36:22 CEST 2012}
|
||||
// Date is converted to the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
||||
|
||||
// Add a Like to a Post of the social network.
|
||||
MATCH (p:Person {id:"26388279073665"}),
|
||||
(m:Post {id:"1236953235741"})
|
||||
CREATE (p)-[:LIKES {creationDate:1347528982194}]->(m);
|
12
tests/public_benchmark/ldbc/test_cases/queries/update_2.oc
Normal file
12
tests/public_benchmark/ldbc/test_cases/queries/update_2.oc
Normal file
@ -0,0 +1,12 @@
|
||||
// Parameters are read from an arbitrary line in ldbc_snb_datagen/social_network/updateStream_0_0_forum.csv
|
||||
// First 3 columns are skipped, then read in order and passed as arguments.
|
||||
// Missing columns are filled with ""
|
||||
// The easiest way is to run QueryTester and see the parameters.
|
||||
|
||||
// LdbcUpdate2AddPostLike{personId=26388279073665, postId=1236953235741, creationDate=Thu Sep 13 11:36:22 CEST 2012}
|
||||
// Date is converted to the number of milliseconds since January 1, 1970, 00:00:00 GMT
|
||||
|
||||
// Add a Like to a Post of the social network.
|
||||
MATCH (p:Person {id:"26388279073665"}),
|
||||
(m:Post {id:"1236953235741"})
|
||||
CREATE (p)-[:LIKES {creationDate:1347528982194}]->(m);
|
@ -0,0 +1,4 @@
|
||||
// LdbcUpdate3AddCommentLike{personId=102, commentId=2199029728710, creationDate=Thu Sep 13 11:38:06 CEST 2012}
|
||||
MATCH (p:Person {id:"102"}),
|
||||
(m:Comment {id:"2199029728710"})
|
||||
CREATE (p)-[:LIKES {creationDate:1347529086733}]->(m);
|
@ -0,0 +1,4 @@
|
||||
// LdbcUpdate3AddCommentLike{personId=102, commentId=2199029728710, creationDate=Thu Sep 13 11:38:06 CEST 2012}
|
||||
MATCH (p:Person {id:"102"}),
|
||||
(m:Comment {id:"2199029728710"})
|
||||
CREATE (p)-[:LIKES {creationDate:1347529086733}]->(m);
|
11
tests/public_benchmark/ldbc/test_cases/queries/update_4.cyp
Normal file
11
tests/public_benchmark/ldbc/test_cases/queries/update_4.cyp
Normal file
@ -0,0 +1,11 @@
|
||||
// LdbcUpdate4AddForum{forumId=2199023287110, forumTitle='Album 14 of Brian Kelly', creationDate=Thu Sep 13 11:41:44 CEST 2012, moderatorPersonId=6597069776618, tagIds=[12273]}
|
||||
|
||||
CREATE (f:Forum {id: "2199023287110", title: 'Album 14 of Brian Kelly', creationDate: 1347529304194});
|
||||
|
||||
MATCH (f:Forum {id: "2199023287110"}),
|
||||
(p:Person {id:"6597069776618"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["12273"]
|
||||
WITH f, p, collect(t) as tagSet
|
||||
CREATE (f)-[:HAS_MODERATOR]->(p)
|
||||
FOREACH (t IN tagSet| CREATE (f)-[:HAS_TAG]->(t));
|
12
tests/public_benchmark/ldbc/test_cases/queries/update_4.oc
Normal file
12
tests/public_benchmark/ldbc/test_cases/queries/update_4.oc
Normal file
@ -0,0 +1,12 @@
|
||||
// LdbcUpdate4AddForum{forumId=2199023287110, forumTitle='Album 14 of Brian Kelly', creationDate=Thu Sep 13 11:41:44 CEST 2012, moderatorPersonId=6597069776618, tagIds=[12273]}
|
||||
|
||||
CREATE (f:Forum {id: "2199023287110", title: 'Album 14 of Brian Kelly', creationDate: 1347529304194});
|
||||
|
||||
MATCH (f:Forum {id: "2199023287110"}),
|
||||
(p:Person {id:"6597069776618"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["12273"]
|
||||
WITH f, p, collect(t) as tagSet
|
||||
CREATE (f)-[:HAS_MODERATOR]->(p)
|
||||
// FOREACH (t IN tagSet| CREATE (f)-[:HAS_TAG]->(t));
|
||||
WITH f, tagSet UNWIND tagSet AS t CREATE (f)-[:HAS_TAG]->(t);
|
@ -0,0 +1,5 @@
|
||||
// LdbcUpdate5AddForumMembership{forumId=1786706433093, personId=32985348839299, joinDate=Thu Sep 13 11:36:02 CEST 2012}
|
||||
|
||||
MATCH (f:Forum {id:"1786706433093"}),
|
||||
(p:Person {id:"32985348839299"})
|
||||
CREATE (f)-[:HAS_MEMBER {joinDate:1347528962967}]->(p);
|
@ -0,0 +1,5 @@
|
||||
// LdbcUpdate5AddForumMembership{forumId=1786706433093, personId=32985348839299, joinDate=Thu Sep 13 11:36:02 CEST 2012}
|
||||
|
||||
MATCH (f:Forum {id:"1786706433093"}),
|
||||
(p:Person {id:"32985348839299"})
|
||||
CREATE (f)-[:HAS_MEMBER {joinDate:1347528962967}]->(p);
|
17
tests/public_benchmark/ldbc/test_cases/queries/update_6.cyp
Normal file
17
tests/public_benchmark/ldbc/test_cases/queries/update_6.cyp
Normal file
@ -0,0 +1,17 @@
|
||||
// LdbcUpdate6AddPost{postId=2199025986581, imageFile='', creationDate=Thu Sep 13 11:41:43 CEST 2012, locationIp='61.16.220.210', browserUsed='Chrome', language='tk', content='About Abbas I of Persia, w Shah Mohammed in a coup and placed the 16-year-old Abbas on the th', length=93, authorPersonId=8796093029267, forumId=549755863266, countryId=0, tagIds=[3]}
|
||||
|
||||
// If the imageFile parameter is not empty, then we need to add it to the created node properties.
|
||||
|
||||
CREATE (m:Post:Message {id: "2199025986581", creationDate: 1347529303996, locationIP: '61.16.220.210', browserUsed: 'Chrome', language: 'tk', content: 'About Abbas I of Persia, w Shah Mohammed in a coup and placed the 16-year-old Abbas on the th', length: 93});
|
||||
|
||||
MATCH (m:Post {id: "2199025986581"}),
|
||||
(p:Person {id: "8796093029267"}),
|
||||
(f:Forum {id: "549755863266"}),
|
||||
(c:Place {id: "0"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["3"]
|
||||
WITH m, p, f, c, collect(t) as tagSet
|
||||
CREATE (m)-[:HAS_CREATOR]->(p),
|
||||
(m)<-[:CONTAINER_OF]-(f),
|
||||
(m)-[:IS_LOCATED_IN]->(c)
|
||||
FOREACH (t IN tagSet| CREATE (m)-[:HAS_TAG]->(t));
|
18
tests/public_benchmark/ldbc/test_cases/queries/update_6.oc
Normal file
18
tests/public_benchmark/ldbc/test_cases/queries/update_6.oc
Normal file
@ -0,0 +1,18 @@
|
||||
// LdbcUpdate6AddPost{postId=2199025986581, imageFile='', creationDate=Thu Sep 13 11:41:43 CEST 2012, locationIp='61.16.220.210', browserUsed='Chrome', language='tk', content='About Abbas I of Persia, w Shah Mohammed in a coup and placed the 16-year-old Abbas on the th', length=93, authorPersonId=8796093029267, forumId=549755863266, countryId=0, tagIds=[3]}
|
||||
|
||||
// If the imageFile parameter is not empty, then we need to add it to the created node properties.
|
||||
|
||||
CREATE (m:Post:Message {id: "2199025986581", creationDate: 1347529303996, locationIP: '61.16.220.210', browserUsed: 'Chrome', language: 'tk', content: 'About Abbas I of Persia, w Shah Mohammed in a coup and placed the 16-year-old Abbas on the th', length: 93});
|
||||
|
||||
MATCH (m:Post {id: "2199025986581"}),
|
||||
(p:Person {id: "8796093029267"}),
|
||||
(f:Forum {id: "549755863266"}),
|
||||
(c:Place {id: "0"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["3"]
|
||||
WITH m, p, f, c, collect(t) as tagSet
|
||||
CREATE (m)-[:HAS_CREATOR]->(p),
|
||||
(m)<-[:CONTAINER_OF]-(f),
|
||||
(m)-[:IS_LOCATED_IN]->(c)
|
||||
// FOREACH (t IN tagSet| CREATE (m)-[:HAS_TAG]->(t));
|
||||
WITH m, tagSet UNWIND tagSet AS t CREATE (m)-[:HAS_TAG]->(t);
|
17
tests/public_benchmark/ldbc/test_cases/queries/update_7.cyp
Normal file
17
tests/public_benchmark/ldbc/test_cases/queries/update_7.cyp
Normal file
@ -0,0 +1,17 @@
|
||||
// LdbcUpdate7AddComment{commentId=2199024038763, creationDate=Thu Sep 13 11:36:09 CEST 2012, locationIp='213.55.65.79', browserUsed='Firefox', content='About Arnold Schoenberg, ist movement in German poetry and art, andAbout Ecce Cor M', length=83, authorPersonId=8796093030860, countryId=76, replyToPostId=2199024038761, replyToCommentId=-1, tagIds=[146, 11287]}
|
||||
|
||||
CREATE (c:Comment:Message {id: "2199024038763", creationDate: 1347528969834, locationIP: '213.55.65.79', browserUsed: 'Firefox', content: 'About Arnold Schoenberg, ist movement in German poetry and art, andAbout Ecce Cor M', length: 83});
|
||||
|
||||
// For replyOfId: if replyToCommentId is -1, then use replyToPostId
|
||||
|
||||
MATCH (m:Comment {id: "2199024038763"}),
|
||||
(p:Person {id: "8796093030860"}),
|
||||
(r:Message {id: "2199024038761"}),
|
||||
(c:Place {id: "76"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["146", "11287"]
|
||||
WITH m, p, r, c, collect(t) as tagSet
|
||||
CREATE (m)-[:HAS_CREATOR]->(p),
|
||||
(m)-[:REPLY_OF]->(r),
|
||||
(m)-[:IS_LOCATED_IN]->(c)
|
||||
FOREACH (t IN tagSet| CREATE (m)-[:HAS_TAG]->(t));
|
18
tests/public_benchmark/ldbc/test_cases/queries/update_7.oc
Normal file
18
tests/public_benchmark/ldbc/test_cases/queries/update_7.oc
Normal file
@ -0,0 +1,18 @@
|
||||
// LdbcUpdate7AddComment{commentId=2199024038763, creationDate=Thu Sep 13 11:36:09 CEST 2012, locationIp='213.55.65.79', browserUsed='Firefox', content='About Arnold Schoenberg, ist movement in German poetry and art, andAbout Ecce Cor M', length=83, authorPersonId=8796093030860, countryId=76, replyToPostId=2199024038761, replyToCommentId=-1, tagIds=[146, 11287]}
|
||||
|
||||
CREATE (c:Comment:Message {id: "2199024038763", creationDate: 1347528969834, locationIP: '213.55.65.79', browserUsed: 'Firefox', content: 'About Arnold Schoenberg, ist movement in German poetry and art, andAbout Ecce Cor M', length: 83});
|
||||
|
||||
// For replyOfId: if replyToCommentId is -1, then use replyToPostId
|
||||
|
||||
MATCH (m:Comment {id: "2199024038763"}),
|
||||
(p:Person {id: "8796093030860"}),
|
||||
(r:Message {id: "2199024038761"}),
|
||||
(c:Place {id: "76"})
|
||||
OPTIONAL MATCH (t:Tag)
|
||||
WHERE t.id IN ["146", "11287"]
|
||||
WITH m, p, r, c, collect(t) as tagSet
|
||||
CREATE (m)-[:HAS_CREATOR]->(p),
|
||||
(m)-[:REPLY_OF]->(r),
|
||||
(m)-[:IS_LOCATED_IN]->(c)
|
||||
// FOREACH (t IN tagSet| CREATE (m)-[:HAS_TAG]->(t));
|
||||
WITH m, tagSet UNWIND tagSet AS t CREATE (m)-[:HAS_TAG]->(t);
|
@ -0,0 +1,4 @@
|
||||
// LdbcUpdate8AddFriendship{person1Id=21990232558208, person2Id=32985348841200, creationDate=Thu Sep 13 11:43:09 CEST 2012}
|
||||
MATCH (p1:Person {id:"21990232558208"}),
|
||||
(p2:Person {id:"32985348841200"})
|
||||
CREATE (p1)-[:KNOWS {creationDate:1347529389109}]->(p2);
|
@ -0,0 +1,4 @@
|
||||
// LdbcUpdate8AddFriendship{person1Id=21990232558208, person2Id=32985348841200, creationDate=Thu Sep 13 11:43:09 CEST 2012}
|
||||
MATCH (p1:Person {id:"21990232558208"}),
|
||||
(p2:Person {id:"32985348841200"})
|
||||
CREATE (p1)-[:KNOWS {creationDate:1347529389109}]->(p2);
|
Loading…
Reference in New Issue
Block a user