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
| // import the web brower version of neo4j-javascript-driver | |
| import neo4j from "neo4j-driver/lib/browser/neo4j-web"; | |
| class App extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = ... // set default state | |
| // instantiate Neo4j driver instance | |
| this.driver = neo4j.driver( | |
| process.env.REACT_APP_NEO4J_URI, | |
| neo4j.auth.basic( |
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
| mutation { | |
| m1: createMovie(id: "101", title: "Black Panther", tagline: "", released: 2018) | |
| m2: createMovie(id: "107", title: "Snatch", tagline: "Unscrupulous boxing promoters, violent bookmakers, a Russian gangster, incompetent amateur robbers...", released: 2000) | |
| m3: createMovie(id: "108", title: "River Runs Through It, A", tagline: "The story about two sons of a stern minister -- one reserved, one rebellious -- growing up in rural Montana while devoted to fly fishing.", released: 1992) | |
| m4: createMovie(id: "71573", title: "Whiteout", tagline: "U.S. Marshal Carrie Stetko tracks a killer in Antarctica, as the sun is about to set for six months", released: 2009) | |
| p1: createPerson(id: "p1", name:"Tom Skerritt", born: 1933) | |
| p2: createPerson(id: "p2", name: "Brad Pitt", born: 1963) | |
| cast1: addMovieActors(id: "108", actors: ["p1", "p2"]) | |
| cast2: addMovieActors(id: "71573", actors: ["p1"]) |
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
| import App from "./components/App"; | |
| import React from "react"; | |
| import { render } from "react-dom"; | |
| import { Client, Provider } from "urql"; | |
| const client = new Client({ | |
| url: "https://3wzp7qnjv.lp.gql.zone/graphql" | |
| }); | |
| const Root = () => ( |
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
| import React from "react"; | |
| import { Item } from "semantic-ui-react"; | |
| import Movie from "./Movie"; | |
| import {Component} from "react"; | |
| import { Connect, query } from "urql"; | |
| const movieQuery = ` | |
| query MovieListQuery($title: String!){ | |
| movies: movies(subString: $title, limit:10) { | |
| title |
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
| import React from "react"; | |
| import { Item } from "semantic-ui-react"; | |
| import { Query} from "react-apollo"; | |
| import gql from "graphql-tag"; | |
| import Movie from "./Movie"; | |
| import {Component} from "react"; | |
| const movieQuery = gql` | |
| query MovieListQuery($title: String!){ | |
| movies: movies(subString: $title, limit:10) { |
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
| import React from "react"; | |
| import { Item } from "semantic-ui-react"; | |
| import { graphql} from "react-apollo"; | |
| import gql from "graphql-tag"; | |
| import Movie from "./Movie"; | |
| import {Component} from "react"; | |
| class MovieList extends Component { | |
| render() { | |
| const {data} = this.props; |
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
| import { ApolloProvider } from 'react-apollo'; | |
| import { ApolloClient } from 'apollo-client'; | |
| import { createHttpLink } from 'apollo-link-http'; | |
| import { InMemoryCache } from 'apollo-cache-inmemory'; | |
| const client = new ApolloClient({ | |
| link: createHttpLink({ uri: 'https://3wzp7qnjv.lp.gql.zone/graphql' }), | |
| cache: new InMemoryCache(), | |
| }); |
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
| // Load 538 prediction data | |
| CALL apoc.load.json("http://projects.fivethirtyeight.com/2016-election-forecast/summary.json") YIELD value AS row | |
| WITH row.state AS state, row.latest_poll AS time, row.latest.D.models.now.winprob AS D, row.latest.R.models.now.winprob AS R, row.latest.L.models.now.winprob AS L | |
| MERGE (s:State {code: state}) | |
| MERGE (m:Model {id: time+state}) | |
| SET m.time = time | |
| MERGE (m)-[:PREDICTION_FOR]->(s) | |
| MERGE (d:Candidate {party: "D"}) | |
| MERGE (r:Candidate {party: "R"}) | |
| MERGE (l:Candidate {party: "L"}) |
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
| CREATE CONSTRAINT ON (u:User) ASSERT u.eid IS UNIQUE; | |
| CREATE CONSTRAINT ON (f:Folder) ASSERT f.name IS UNIQUE; | |
| CREATE CONSTRAINT ON (m:Message) ASSERT m.mid IS UNIQUE; | |
| CREATE INDEX ON :User(email); | |
| LOAD CSV WITH HEADERS FROM "file:///employeelist.csv" AS row | |
| MERGE (u:User {eid: row.eid}) | |
| SET u.firstName = row.firstName, | |
| u.lastName = row.lastName, | |
| u.email = row.Email_id; |
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
| // Load airports from Openflights.org dataset | |
| CREATE CONSTRAINT ON (c:Country) ASSERT c.name IS UNIQUE; | |
| CREATE CONSTRAINT ON (c:City) ASSERT c.name IS UNIQUE; | |
| CREATE CONSTRAINT ON (a:Airport) ASSERT a.id IS UNIQUE; | |
| LOAD CSV FROM "https://raw.githubusercontent.com/jpatokal/openflights/master/data/airports.dat" AS row | |
| WITH toInt(row[0]) AS id, | |
| row[1] AS name, | |
| row[2] AS city, |