Skip to content

Instantly share code, notes, and snippets.

@suellenstringer-hye
Last active April 11, 2018 17:17
Show Gist options
  • Save suellenstringer-hye/8b18944955a99542a5728d856705d46c to your computer and use it in GitHub Desktop.
Save suellenstringer-hye/8b18944955a99542a5728d856705d46c to your computer and use it in GitHub Desktop.
Divinity.txt
--------------------------------------------
DIVINITY
LOAD NODES:
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Article-node.csv" AS csvLine
CREATE (a:Article { id: csvLine.ArtID, title: csvLine.Title, year: toInt(csvLine.PubYear) })
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Author-node.csv" AS csvLine
CREATE (p:Person { id: csvLine.AutID, name: csvLine.Author })
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Journal-node.csv" AS csvLine
CREATE (j:Journal { id: csvLine.JID, journal: csvLine.Journal, ISSN: csvLine.ISSN })
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Topic-node.csv" AS csvLine
CREATE (t:Topic { id: csvLine.TpcID, topic: csvLine.Topic })
---------------------------------------------------------------------------
LOAD RELATIONSHIPS:
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Author-rel.csv" AS csvLine
MATCH (person:Person {id: csvLine.AutID}),(article:Article { id: csvLine.ArtID})
CREATE (person)-[:WROTE]->(article)
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Journal-rel.csv" AS csvLine
MATCH (article:Article { id: csvLine.ArtID}),(journal:Journal { id: csvLine.JID})
CREATE (article)-[:PUBLISHEDIN]->(journal)
LOAD CSV WITH HEADERS FROM "https://raw.githubusercontent.com/EdWarga/VUIR-Data-Project/master/Divinity/Topic-rel.csv" AS csvLine
MATCH (article:Article {id: csvLine.ArtID}),(topic:Topic {id: csvLine.TpcID})
CREATE (article)-[:ISABOUT]->(topic
Write Queries
MATCH (people:Person) RETURN people.name LIMIT 10
MATCH (clif {name: "Anderson, Clifford"}) RETURN clif
MATCH (clif {name: "Anderson, Herbert"}) RETURN clif
MATCH (clif:Person {name: "Anderson, Herbert"})-[:WROTE]->(article) RETURN clif,article
MATCH (clif:Person { name: "Anderson, Herbert" })-[:WROTE]->(article)
WITH article
MATCH (article)-[:ISABOUT]->(topic)
RETURN article, topic
MATCH (tpc:Topic { topic: "Death" })<-[:ISABOUT]-(article)
WITH article
MATCH (article)<-[:WROTE]-(person)
RETURN article, person
MATCH (demon:Monster {name: "Demon"})-[:CAN_BE_KILLED_BY]->(weakness) RETURN demon,weakness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment