This file contains hidden or 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
type Airport { | |
code: String! | |
name: String! | |
country: String! | |
city: String! | |
location: Point! | |
directs: [Airport] @relation(name: "FLIES_TO", direction: "OUT") | |
neighbors: [Airport] @cypher(statement: "MATCH (a:Airport) WHERE this.city = a.city AND this <> a RETURN a") | |
} |
This file contains hidden or 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
MATCH (a:Airport) WHERE this.city = a.city AND this <> a RETURN a |
This file contains hidden or 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
type FlightDetails { | |
flight_number: String! | |
duration: String! | |
price: FlightsInt! | |
departs_local: FlightsDateTime! | |
arrival_local: FlightsDateTime! | |
} | |
type FlightInfo { | |
flight: FlightDetails @neo4j_ignore |
This file contains hidden or 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
type Query { | |
FlightsSearchObjects(from: String, to: String, date: String): [FlightsSearchResult] | |
} | |
const query = "CALL custom.getFlightsObjects($from, $to, $date, 2, 6) YIELD result RETURN result"; | |
export const resolvers = { | |
Query: { | |
FlightsSearchObjects : async (object, params, ctx, resolveInfo) => { | |
var result; |
This file contains hidden or 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
const pad = (s) => { | |
let str = s + ""; | |
while (str.length < 2) | |
str = "0" + str; | |
return str; | |
} | |
const flightsDateTime = new GraphQLScalarType({ | |
name: 'FlightsDateTime', | |
description: 'Description of flights dateTime type', |
This file contains hidden or 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
query { | |
FlightsSearchObjects(from: "Bangkok", to: "Moscow", date:"20200101") { | |
flights { | |
flight { | |
flight_number | |
price | |
duration | |
departs_local | |
arrival_local | |
} |
This file contains hidden or 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
// clean up | |
CALL apoc.periodic.iterate( | |
"MATCH (n) RETURN n", | |
"DETACH DELETE n", | |
{ batchSize: 10000, parallel: true }); | |
// generate Entities | |
CALL apoc.generate.er(500000, 5000000, 'Client', 'TRANSFER_TO'); | |
// select ATMs | |
MATCH (c:Client) | |
WITH c |
This file contains hidden or 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
// clean up HOPS | |
CALL apoc.periodic.iterate( | |
"MATCH (:Transaction)-[r:HOP]->(:Transaction) RETURN r", | |
"DETACH DELETE r", | |
{ batchSize: 10000, parallel: false }); | |
// generate HOP relationships | |
CALL apoc.periodic.iterate( | |
"MATCH (t1:Transaction)<-[:IN]-(e)-[:OUT]->(t2:Transaction) | |
WHERE (e:Client OR e:Company) | |
AND t1.timestamp < t2.timestamp |
This file contains hidden or 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
PROFILE MATCH path = (t1:Transaction)-[:HOP*3..10]->(t2:Transaction) | |
WHERE (t1)<-[:OUT]-(:Client)-[:IN]->(t2) | |
AND t1.timestamp < t2.timestamp | |
AND (t1.amount - t2.amount) / t1.amount < 0.25 | |
UNWIND nodes(path) as t | |
MATCH (e)-[:OUT]->(t) | |
WHERE e:Client OR e:Company | |
RETURN e, t |
This file contains hidden or 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
FROM neo4j:4.0.0 | |
ENV APOC_VERSION=4.0.0.4 | |
ENV APOC_URI=https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/${APOC_VERSION}/apoc-${APOC_VERSION}-all.jar | |
ENV GDS_VERSION=1.0.0 | |
ENV GDS_URI=https://github.com/neo4j/graph-data-science/releases/download/${GDS_VERSION}/neo4j-graph-data-science-${GDS_VERSION}-standalone.jar | |
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* | |
RUN wget $APOC_URI && mv apoc-${APOC_VERSION}-all.jar plugins/apoc-${APOC_VERSION}-all.jar |