Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mneedham/bbcgoodfood
https://github.com/mneedham/bbcgoodfood
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mneedham/bbcgoodfood
- Owner: mneedham
- Created: 2018-07-30T07:42:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T02:19:31.000Z (about 2 years ago)
- Last Synced: 2024-04-14T09:10:03.080Z (9 months ago)
- Language: Python
- Size: 4.77 MB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 16
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
= BBC Good Food Dataset
== Importing the data into Neo4j
[source,cypher]
----
CREATE INDEX ON :Recipe(id);
CREATE INDEX ON :Ingredient(name);
CREATE INDEX ON :Keyword(name);
CREATE INDEX ON :DietType(name);
CREATE INDEX ON :Author(name);
CREATE INDEX ON :Collection(name);
:params jsonFile => "https://raw.githubusercontent.com/mneedham/bbcgoodfood/master/stream_all.json";
CALL apoc.load.json($jsonFile) YIELD value
WITH value.page.article.id AS id,
value.page.title AS title,
value.page.article.description AS description,
value.page.recipe.cooking_time AS cookingTime,
value.page.recipe.prep_time AS preparationTime,
value.page.recipe.skill_level AS skillLevel
MERGE (r:Recipe {id: id})
SET r.cookingTime = cookingTime,
r.preparationTime = preparationTime,
r.name = title,
r.description = description,
r.skillLevel = skillLevel;
CALL apoc.load.json($jsonFile) YIELD value
WITH value.page.article.id AS id,
value.page.article.author AS author
MERGE (a:Author {name: author})
WITH a,id
MATCH (r:Recipe {id:id})
MERGE (a)-[:WROTE]->(r);
CALL apoc.load.json($jsonFile) YIELD value
WITH value.page.article.id AS id,
value.page.recipe.ingredients AS ingredients
MATCH (r:Recipe {id:id})
FOREACH (ingredient IN ingredients |
MERGE (i:Ingredient {name: ingredient})
MERGE (r)-[:CONTAINS_INGREDIENT]->(i)
);
CALL apoc.load.json($jsonFile) YIELD value
WITH value.page.article.id AS id,
value.page.recipe.keywords AS keywords
MATCH (r:Recipe {id:id})
FOREACH (keyword IN keywords |
MERGE (k:Keyword {name: keyword})
MERGE (r)-[:KEYWORD]->(k)
);
CALL apoc.load.json($jsonFile) YIELD value
WITH value.page.article.id AS id,
value.page.recipe.diet_types AS dietTypes
MATCH (r:Recipe {id:id})
FOREACH (dietType IN dietTypes |
MERGE (d:DietType {name: dietType})
MERGE (r)-[:DIET_TYPE]->(d)
);
CALL apoc.load.json($jsonFile) YIELD value
WITH value.page.article.id AS id,
value.page.recipe.collections AS collections
MATCH (r:Recipe {id:id})
FOREACH (collection IN collections |
MERGE (c:Collection {name: collection})
MERGE (r)-[:COLLECTION]->(c)
);
----