memgraph/tests/public_benchmark/ldbc/test_cases/queries/query_1.oc
florijan 63966c15a6 LDBC Query1 converted
Summary: Ugly formatting and bad variable naming due to 1024 limit on neo4j client.

Reviewers: buda, teon.banek

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D748
2017-09-08 09:30:22 +02:00

46 lines
996 B
Plaintext

MATCH (:Person {id:"30786325583618"})-[p:KNOWS*1..3]-(f:Person)
WHERE f.firstName = "Chau"
WITH f, min(size(p)) AS d
ORDER BY d ASC, f.lastName ASC, tointeger(f.id) ASC
LIMIT 20
MATCH (f)-[:IS_LOCATED_IN]->(fCity:Place)
OPTIONAL MATCH (f)-[studyAt:STUDY_AT]->(uni:Organisation)-[:IS_LOCATED_IN]->(uniCity:Place)
WITH
f,
collect(
CASE uni.name
WHEN null THEN null
ELSE [uni.name, studyAt.classYear, uniCity.name]
END
) AS unis,
fCity,
d
OPTIONAL MATCH (f)-[worksAt:WORK_AT]->(c:Organisation)-[:IS_LOCATED_IN]->(cCountry:Place)
WITH
f,
collect(
CASE c.name
WHEN null THEN null
ELSE [c.name, worksAt.workFrom, cCountry.name]
END
) AS companies,
unis,
fCity,
d
RETURN
f.id AS id,
f.lastName AS lastName,
d as distance,
f.birthday AS birthday,
f.creationDate AS creationDate,
f.gender AS gender,
f.browserUsed AS browser,
f.locationIP AS locationIp,
f.email AS emails,
f.speaks AS languages,
fCity.name AS cityName,
unis,
companies
ORDER BY distance ASC, f.lastName ASC, tointeger(f.id) ASC
LIMIT 20;