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, |
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
// data available here: https://data.police.uk/data/ | |
// Load data for City of London 2015. Change URL for other data downloaded from https://data.police.uk/data/ | |
LOAD CSV WITH HEADERS FROM "https://dl.dropboxusercontent.com/u/67572426/london_graph_hack/2015-01-city-of-london-street.csv" AS row | |
WITH row WHERE row.Location IS NOT NULL AND row.Latitude IS NOT NULL AND row.Longitude IS NOT NULL AND row.Month IS NOT NULL AND row.`Falls within` IS NOT NULL AND row.`Reported by` IS NOT NULL AND row.`Crime type` IS NOT NULL AND row.`Crime ID` IS NOT NULL | |
MERGE (location:Location {name: row.Location}) | |
MERGE (point:Point {lat: row.Latitude, lon: row.Longitude}) | |
MERGE (month:Month {name: row.Month}) | |
MERGE (juris:Jurisdiction {name: row.`Falls within`}) | |
MERGE (report:Reporter {name: row.`Reported by`}) |
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 schema constraints | |
CREATE CONSTRAINT ON (c:FECCommittee) ASSERT c.committee_id IS UNIQUE; | |
CREATE CONSTRAINT ON (t:Treasurer) ASSERT t.name IS UNIQUE; | |
CREATE CONSTRAINT ON (c:Contributor) ASSERT c.name IS UNIQUE; | |
CREATE CONSTRAINT ON (o:Occupation) ASSERT o.name IS UNIQUE; | |
CREATE CONSTRAINT ON (e:Employer) ASSERT e.name IS UNIQUE; | |
CREATE CONSTRAINT ON (c:City) ASSERT c.name IS UNIQUE; | |
// FEC Committees | |
USING PERIODIC COMMIT |