//Import BeerAdvocate //Rix Attempt - DID NOT WORK //put all the indexes in place create index on :Beer(name); create index on :Style(name); create index on :Brewery(id); create index on :Profile(name); //import beers, breweries, styles using periodic commit load csv with headers from "file:/Users/rvanbruggen/Dropbox/Neo Technology/Demo/BEER/BeerAdvocate/real/ba7.csv" as csv fieldterminator ';' with csv where csv.beer_ABV is not null merge (b:Beer {name: csv.beer_name, ABV: csv.beer_ABV, id: toInt(csv.beer_beerId)}) merge (b)-[:HAS_STYLE]-(s:Style {name: csv.beer_style}) merge (b)<-[:BREWS]-(br:Brewery {id: toInt(csv.beer_brewerId)}); //import beers, breweries, styles using periodic commit load csv with headers //from "file:/Users/rvanbruggen/Dropbox/Neo Technology/Demo/BEER/BeerAdvocate/sample.csv" as csv from "file:/Users/rvanbruggen/Dropbox/Neo Technology/Demo/BEER/BeerAdvocate/real/ba7.csv" as csv fieldterminator ';' with csv where csv.beer_ABV is null merge (b:Beer {name: csv.beer_name, id: toInt(csv.beer_beerId)}) merge (b)-[:HAS_STYLE]-(s:Style {name: csv.beer_style}) merge (b)<-[:BREWS]-(br:Brewery {id: toInt(csv.beer_brewerId)}); //add the reviews using periodic commit load csv with headers from "file:/Users/rvanbruggen/Dropbox/Neo Technology/Demo/BEER/BeerAdvocate/real/ba7.csv" as csv fieldterminator ';' with csv where csv.review_profileName is not null merge (p:Profile {name: csv.review_profileName}); //THIS QUERY IS PROBLEMATIC using periodic commit load csv with headers from "file:/Users/rvanbruggen/Dropbox/Neo Technology/Demo/BEER/BeerAdvocate/real/ba7.csv" as csv fieldterminator ';' with csv where csv.review_profileName is not null match (b:Beer {name: csv.beer_name}), (p:Profile {name: csv.review_profileName}) create (p)-[:CREATES_REVIEW]->(r:Review {taste: toFloat(csv.review_taste), appearance: toFloat(csv.review_appearance), text: csv.review_text, time: toInt(csv.review_time), aroma: toFloat(csv.review_aroma), palate: toFloat(csv.review_palate), overall: toFloat(csv.review_overall)})-[:REVIEW_COVERS]->(b); //add an Anonymous profile merge (p:Profile {name:"Anonymous"}); //add the anonymous reviews using periodic commit load csv with headers from "file:/Users/rvanbruggen/Dropbox/Neo Technology/Demo/BEER/BeerAdvocate/real/ba7.csv" as csv fieldterminator ';' with csv where csv.review_profileName is null with csv match (b:Beer {name: csv.beer_name}), (p:Profile {name:"Anonymous"}) create (p)-[:CREATES_REVIEW]->(r:Review {taste: toFloat(csv.review_taste), appearance: toFloat(csv.review_appearance), text: csv.review_text, time: toInt(csv.review_time), aroma: toFloat(csv.review_aroma), palate: toFloat(csv.review_palate), overall: toFloat(csv.review_overall)})-[:REVIEW_COVERS]->(b);