Forked from quagly/SameSchoolTypeClassInfluence
Last active
December 29, 2015 13:19
-
-
Save peterneubauer/7676836 to your computer and use it in GitHub Desktop.
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
== Initialize Graph | |
[source,cypher] | |
---- | |
CREATE | |
( plato:Philosopher {name:'Plato', uri: 'http://dbpedia.org/resource/Plato' }) | |
, ( aristotle:Philosopher { name: 'Aristotle' , uri: 'http://dbpedia.org/resource/Aristotle' }) | |
, ( platonism_school:School { name: 'Platonism', uri: 'http://dbpedia.org/resource/Platonism' }) | |
, ( peripatetic_school:School { name: 'Peripatetic school', uri: 'http://dbpedia.org/resource/Peripatetic_school' }) | |
, ( philo_tradition:SchoolType { name: 'Philosophical traditions', uri: 'http://dbpedia.org/class/yago/PhilosophicalTraditions' }) | |
, ( philo_movement:SchoolType { name: 'Philosophical movements', uri: 'http://dbpedia.org/class/yago/PhilosophicalMovements' }) | |
, ( philo_ancient_school:SchoolType { name: 'Ancient philosophical schools and traditions', uri: 'http://dbpedia.org/class/yago/AncientPhilosophicalSchoolsAndTraditions' }) | |
, ( tradition:SchoolType { name: 'tradition', uri: 'http://dbpedia.org/class/yago/Tradition105809745' }) | |
, ( movement:SchoolType { name: 'movement', uri: 'http://dbpedia.org/class/yago/Motion100331950' }) | |
, ( school:SchoolType { name: 'school', uri: 'http://dbpedia.org/class/yago/School108276720' }) | |
, plato-[:INFLUENCES]->aristotle | |
, plato-[:MEMBER_OF]->platonism_school | |
, aristotle-[:MEMBER_OF]->peripatetic_school | |
, platonism_school-[:TYPE_OF]->philo_tradition | |
, platonism_school-[:TYPE_OF]->philo_movement | |
, peripatetic_school-[:TYPE_OF]->philo_movement | |
, peripatetic_school-[:TYPE_OF]->philo_ancient_school | |
, philo_ancient_school-[:SUBCLASS_OF]->school | |
, philo_movement-[:SUBCLASS_OF]->movement | |
, philo_tradition-[:SUBCLASS_OF]->tradition | |
---- | |
//graph | |
== query for philosophers with school type class | |
[source,cypher] | |
---- | |
MATCH (p1:Philosopher)-[:MEMBER_OF]->(s1:School)-[:TYPE_OF]->(st1:SchoolType)-[:SUBCLASS_OF]->(stc1:SchoolType) | |
WHERE stc1.name = 'movement' | |
RETURN p1.name as p1Name, s1.name as s1Name, st1.name as st1Name, stc1.name as stc1Name | |
---- | |
//table | |
== query for influential philosophers from the same school type | |
[source,cypher] | |
---- | |
MATCH (st2:SchoolType)<-[:TYPE_OF]-(s2:School)<-[:MEMBER_OF]-(p2:Philosopher)<-[:INFLUENCES]-(p1:Philosopher)-[:MEMBER_OF]->(s1:School)-[:TYPE_OF]->(st1:SchoolType) | |
WHERE st2 = st1 // node equality | |
RETURN p1.name as p1Name, s1.name as s1Name, st1.name as st1Name, p2.name as p2Name, s2.name as s2Name, st2.name as st2Name | |
---- | |
//table | |
query for influential philosophers from the same school type class | |
[source,cypher] | |
---- | |
MATCH p=(st2:SchoolType)<-[:TYPE_OF]-(s2:School)<-[:MEMBER_OF]-(p2:Philosopher)<-[:INFLUENCES]-(p1:Philosopher)-[:MEMBER_OF]->(s1:School)-[:TYPE_OF]->(st1:SchoolType)-[:SUBCLASS_OF]->(stc:SchoolType) | |
WHERE (stc)<-[:SUBCLASS_OF]-(st2) | |
RETURN p1.name as p1Name, s1.name as s1Name, st1.name as st1Name, p2.name as p2Name, s2.name as s2Name, st2.name as st2Name, stc.name as stcName | |
---- | |
//table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment