diff --git a/tests/public_benchmark/ldbc/index_creation.py b/tests/public_benchmark/ldbc/index_creation.py index 439cc4fd9..cfac956ea 100755 --- a/tests/public_benchmark/ldbc/index_creation.py +++ b/tests/public_benchmark/ldbc/index_creation.py @@ -6,7 +6,8 @@ import sys from neo4j.v1 import GraphDatabase, basic_auth # Initialize driver and create session. -driver = GraphDatabase.driver('bolt://localhost:7687', +port = sys.argv[2] if len(sys.argv) > 2 else '7687' +driver = GraphDatabase.driver('bolt://localhost:%s' % port, auth=basic_auth('', ''), encrypted=False) session = driver.session() diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_11.params b/tests/public_benchmark/ldbc/test_cases/params/query_11.params new file mode 100644 index 000000000..906ecab25 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_11.params @@ -0,0 +1,2 @@ +Person,Country,Year +30786325583618,Laos,2010 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_13.params b/tests/public_benchmark/ldbc/test_cases/params/query_13.params new file mode 100644 index 000000000..6ddd42989 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_13.params @@ -0,0 +1,2 @@ +Person1,Person2 +17592186055119,8796093025131 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_2.params b/tests/public_benchmark/ldbc/test_cases/params/query_2.params new file mode 100644 index 000000000..6b9714d07 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_2.params @@ -0,0 +1,3 @@ +person_id: 17592186052613 +message.creationDate <= 1354060800000 +limit 20 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_3.params b/tests/public_benchmark/ldbc/test_cases/params/query_3.params new file mode 100644 index 000000000..82326f490 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_3.params @@ -0,0 +1,2 @@ +person_id, messageX_createionDate, duration, countryX_name, countryY_name +17592186055119,1306886400000,42,Laos,Scotland diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_4.params b/tests/public_benchmark/ldbc/test_cases/params/query_4.params new file mode 100644 index 000000000..d3756eaaf --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_4.params @@ -0,0 +1,2 @@ +person_id, post_creationDate, duration +21990232559429, 1335830400000, 1e10 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_5.params b/tests/public_benchmark/ldbc/test_cases/params/query_5.params new file mode 100644 index 000000000..b46ef77ff --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_5.params @@ -0,0 +1,2 @@ +person_id, membership_joinDate +8796093030404, 1347062400000 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_6.params b/tests/public_benchmark/ldbc/test_cases/params/query_6.params new file mode 100644 index 000000000..e288346a2 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_6.params @@ -0,0 +1,2 @@ +Person_id|Tag +30786325583618|Angola diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_7.params b/tests/public_benchmark/ldbc/test_cases/params/query_7.params new file mode 100644 index 000000000..8d1f23330 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_7.params @@ -0,0 +1,2 @@ +Person_id +17592186053137 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_8.params b/tests/public_benchmark/ldbc/test_cases/params/query_8.params new file mode 100644 index 000000000..513765ee5 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_8.params @@ -0,0 +1,2 @@ +Person_id +24189255818757 diff --git a/tests/public_benchmark/ldbc/test_cases/params/query_9.params b/tests/public_benchmark/ldbc/test_cases/params/query_9.params new file mode 100644 index 000000000..2126ee760 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/params/query_9.params @@ -0,0 +1,2 @@ +Person_id, message_creationDate +13194139542834, 1324080000000 diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_11.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_11.cyp new file mode 100644 index 000000000..94868cfc5 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_11.cyp @@ -0,0 +1,13 @@ +MATCH (person:Person {id:"30786325583618"})-[:KNOWS*1..2]-(friend:Person) +WHERE not(person=friend) +WITH DISTINCT friend +MATCH (friend)-[worksAt:WORK_AT]->(company:Organisation)-[:IS_LOCATED_IN]->(:Place {name:"Laos"}) +WHERE worksAt.workFrom < 2010 +RETURN + friend.id AS friendId, + friend.firstName AS friendFirstName, + friend.lastName AS friendLastName, + company.name AS companyName, + worksAt.workFrom AS workFromYear +ORDER BY workFromYear ASC, tointeger(friendId) ASC, companyName DESC +LIMIT 20; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_11.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_11.oc new file mode 100644 index 000000000..94868cfc5 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_11.oc @@ -0,0 +1,13 @@ +MATCH (person:Person {id:"30786325583618"})-[:KNOWS*1..2]-(friend:Person) +WHERE not(person=friend) +WITH DISTINCT friend +MATCH (friend)-[worksAt:WORK_AT]->(company:Organisation)-[:IS_LOCATED_IN]->(:Place {name:"Laos"}) +WHERE worksAt.workFrom < 2010 +RETURN + friend.id AS friendId, + friend.firstName AS friendFirstName, + friend.lastName AS friendLastName, + company.name AS companyName, + worksAt.workFrom AS workFromYear +ORDER BY workFromYear ASC, tointeger(friendId) ASC, companyName DESC +LIMIT 20; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_13.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_13.cyp new file mode 100644 index 000000000..4731ad43d --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_13.cyp @@ -0,0 +1,7 @@ +MATCH (person1:Person {id:"17592186055119"}), (person2:Person {id:"8796093025131"}) +OPTIONAL MATCH path = shortestPath((person1)-[:KNOWS*..15]-(person2)) +RETURN +CASE path IS NULL + WHEN true THEN -1 + ELSE length(path) +END AS pathLength; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_13.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_13.oc new file mode 100644 index 000000000..bd4a8b1f2 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_13.oc @@ -0,0 +1,7 @@ +MATCH (person1:Person {id:"17592186055119"}), (person2:Person {id:"8796093025131"}) +OPTIONAL MATCH (person1)-bfs[r](a, b | type(a) = "KNOWS", 15)-(person2) +RETURN +CASE r IS NULL + WHEN true THEN -1 + ELSE size(r) + 1 +END AS pathLength; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_2.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_2.cyp new file mode 100644 index 000000000..0b6f1ae3d --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_2.cyp @@ -0,0 +1,14 @@ +MATCH (:Person {id:"17592186052613"})-[:KNOWS]-(friend:Person)<-[:HAS_CREATOR]-(message) +WHERE message.creationDate <= 1354060800000 AND (message:Post OR message:Comment) +RETURN + friend.id AS personId, + friend.firstName AS personFirstName, + friend.lastName AS personLastName, + message.id AS messageId, + CASE exists(message.content) + WHEN true THEN message.content + ELSE message.imageFile + END AS messageContent, + message.creationDate AS messageDate +ORDER BY messageDate DESC, toInt(messageId) ASC +LIMIT 20; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_2.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_2.oc new file mode 100644 index 000000000..7eaf51fcb --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_2.oc @@ -0,0 +1,14 @@ +MATCH (:Person {id:"17592186052613"})-[:KNOWS]-(friend:Person)<-[:HAS_CREATOR]-(message) +WHERE message.creationDate <= 1354060800000 AND (message:Post OR message:Comment) +RETURN + friend.id AS personId, + friend.firstName AS personFirstName, + friend.lastName AS personLastName, + message.id AS messageId, + CASE message.content is not null + WHEN true THEN message.content + ELSE message.imageFile + END AS messageContent, + message.creationDate AS messageDate +ORDER BY messageDate DESC, tointeger(messageId) ASC +LIMIT 20; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_3.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_3.cyp new file mode 100644 index 000000000..5714412bf --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_3.cyp @@ -0,0 +1,29 @@ +MATCH (person:Person {id:"17592186055119"})-[:KNOWS*1..2]-(friend:Person)<-[:HAS_CREATOR]-(messageX), +(messageX)-[:IS_LOCATED_IN]->(countryX:Place) +WHERE + not(person=friend) + AND not((friend)-[:IS_LOCATED_IN]->()-[:IS_PART_OF]->(countryX)) + AND countryX.name="Laos" AND messageX.creationDate>=1306886400000 + AND messageX.creationDate<1306886400042 +WITH friend, count(DISTINCT messageX) AS xCount +MATCH (friend)<-[:HAS_CREATOR]-(messageY)-[:IS_LOCATED_IN]->(countryY:Place) +WHERE + countryY.name="Scotland" + AND not((friend)-[:IS_LOCATED_IN]->()-[:IS_PART_OF]->(countryY)) + AND messageY.creationDate>={4} + AND messageY.creationDate<{5} +WITH + friend.id AS friendId, + friend.firstName AS friendFirstName, + friend.lastName AS friendLastName, + xCount, + count(DISTINCT messageY) AS yCount +RETURN + friendId, + friendFirstName, + friendLastName, + xCount, + yCount, + xCount + yCount AS xyCount +ORDER BY xyCount DESC, toInt(friendId) ASC +LIMIT 10; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_4.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_4.cyp index 33948caf9..b4c917f61 100644 --- a/tests/public_benchmark/ldbc/test_cases/queries/query_4.cyp +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_4.cyp @@ -1,11 +1,11 @@ MATCH (person:Person {id:"21990232559429"})-[:KNOWS]-(:Person)<-[:HAS_CREATOR]-(post:Post)-[:HAS_TAG]->(tag:Tag) -WHERE post.creationDate >= toInt(1335830400000) AND post.creationDate < toInt(1339027200000) +WHERE post.creationDate >= 1335830400000 AND post.creationDate < 1345830400000 OPTIONAL MATCH (tag)<-[:HAS_TAG]-(oldPost:Post)-[:HAS_CREATOR]->(:Person)-[:KNOWS]-(person) -WHERE oldPost.creationDate < toInt(1335830400000) +WHERE oldPost.creationDate < 1335830400000 WITH tag, post, length(collect(oldPost)) AS oldPostCount WHERE oldPostCount=0 RETURN tag.name AS tagName, length(collect(post)) AS postCount ORDER BY postCount DESC, tagName ASC -LIMIT toInt(10); +LIMIT 10; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_4.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_4.oc index 2e2172384..49fa70dcf 100644 --- a/tests/public_benchmark/ldbc/test_cases/queries/query_4.oc +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_4.oc @@ -1,5 +1,5 @@ MATCH (person:Person {id:"21990232559429"})-[:KNOWS]-(:Person)<-[:HAS_CREATOR]-(post:Post)-[:HAS_TAG]->(tag:Tag) -WHERE post.creationDate >= 1335830400000 AND post.creationDate < 1339027200000 +WHERE post.creationDate >= 1335830400000 AND post.creationDate < 1345830400000 OPTIONAL MATCH (tag)<-[:HAS_TAG]-(oldPost:Post)-[:HAS_CREATOR]->(:Person)-[:KNOWS]-(person) WHERE oldPost.creationDate < 1335830400000 WITH tag, post, size(collect(oldPost)) AS oldPostCount diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_6.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_6.cyp new file mode 100644 index 000000000..fafe82e62 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_6.cyp @@ -0,0 +1,14 @@ +MATCH + (person:Person {id:"30786325583618"})-[:KNOWS*1..2]-(friend:Person), + (friend)<-[:HAS_CREATOR]-(friendPost:Post)-[:HAS_TAG]->(knownTag:Tag {name:"Angola"}) +WHERE not(person=friend) +MATCH (friendPost)-[:HAS_TAG]->(commonTag:Tag) +WHERE not(commonTag=knownTag) +WITH DISTINCT commonTag, knownTag, friend +MATCH (commonTag)<-[:HAS_TAG]-(commonPost:Post)-[:HAS_TAG]->(knownTag) +WHERE (commonPost)-[:HAS_CREATOR]->(friend) +RETURN + commonTag.name AS tagName, + count(commonPost) AS postCount +ORDER BY postCount DESC, tagName ASC +LIMIT 20; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_6.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_6.oc new file mode 100644 index 000000000..9b958ba41 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_6.oc @@ -0,0 +1,16 @@ +MATCH + (person:Person {id:"30786325583618"})-[:KNOWS*1..2]-(friend:Person), + (friend)<-[:HAS_CREATOR]-(friendPost:Post)-[:HAS_TAG]->(knownTag:Tag {name:"Angola"}) +WHERE not(person=friend) +MATCH (friendPost)-[:HAS_TAG]->(commonTag:Tag) +WHERE not(commonTag=knownTag) +WITH DISTINCT commonTag, knownTag, friend +MATCH (commonTag)<-[:HAS_TAG]-(commonPost:Post)-[:HAS_TAG]->(knownTag) +OPTIONAL MATCH (commonPost)-[cpCreator:HAS_CREATOR]->(friend) +WITH commonTag, commonPost +WHERE cpCreator is not null +RETURN + commonTag.name AS tagName, + count(commonPost) AS postCount +ORDER BY postCount DESC, tagName ASC +LIMIT 20; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_7.cyp b/tests/public_benchmark/ldbc/test_cases/queries/query_7.cyp new file mode 100644 index 000000000..d4c4b7e9b --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_7.cyp @@ -0,0 +1,21 @@ +MATCH (person:Person {id:"17592186053137"})<-[:HAS_CREATOR]-(message)<-[like:LIKES]-(liker:Person) +WITH liker, message, like.creationDate AS likeTime, person +ORDER BY likeTime DESC, toInt(message.id) ASC +WITH + liker, + head(collect({msg: message, likeTime: likeTime})) AS latestLike, + person +RETURN + liker.id AS personId, + liker.firstName AS personFirstName, + liker.lastName AS personLastName, + latestLike.likeTime AS likeTime, + latestLike.msg.id AS messageId, + CASE exists(latestLike.msg.content) + WHEN true THEN latestLike.msg.content + ELSE latestLike.msg.imageFile + END AS messageContent, + latestLike.likeTime - latestLike.msg.creationDate AS latencyAsMilli, + not((liker)-[:KNOWS]-(person)) AS isNew +ORDER BY likeTime DESC, toInt(personId) ASC +LIMIT 10; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_7.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_7.oc new file mode 100644 index 000000000..e50041a06 --- /dev/null +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_7.oc @@ -0,0 +1,23 @@ +MATCH (person:Person {id:"17592186053137"})<-[:HAS_CREATOR]-(message)<-[like:LIKES]-(liker:Person) +WITH liker, message, like.creationDate AS likeTime, person +ORDER BY likeTime DESC, tointeger(message.id) ASC +WITH + liker, + collect(message)[0] AS latestLike_msg, + collect(likeTime)[0] AS latestLike_time, + person +OPTIONAL MATCH (liker)-[liker_knows_person:KNOWS]-(person) +RETURN + liker.id AS personId, + liker.firstName AS personFirstName, + liker.lastName AS personLastName, + latestLike_time AS likeTime, + latestLike_msg.id AS messageId, + CASE latestLike_msg.content is not null + WHEN true THEN latestLike_msg.content + ELSE latestLike_msg.imageFile + END AS messageContent, + latestLike_time - latestLike_msg.creationDate AS latencyAsMilli, + liker_knows_person is null AS isNew +ORDER BY likeTime DESC, tointeger(personId) ASC +LIMIT 10; diff --git a/tests/public_benchmark/ldbc/test_cases/queries/query_9.oc b/tests/public_benchmark/ldbc/test_cases/queries/query_9.oc index 97dcbc678..e825b46b4 100644 --- a/tests/public_benchmark/ldbc/test_cases/queries/query_9.oc +++ b/tests/public_benchmark/ldbc/test_cases/queries/query_9.oc @@ -5,7 +5,7 @@ RETURN DISTINCT friend.firstName AS personFirstName, friend.lastName AS personLastName, message.id AS messageId, - CASE message.content IS null + CASE message.content IS not null WHEN true THEN message.content ELSE message.imageFile END AS messageContent,