Last active
December 30, 2015 15:59
-
-
Save quagly/7851642 to your computer and use it in GitHub Desktop.
Example of not able to get distinct relationship types from all paths
This file contains 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
//console | |
//setup | |
//hide | |
Initialize Graph | |
[source,cypher] | |
---- | |
CREATE | |
( socrates:Philosopher {name:'Socrates', uri: 'http://dbpedia.org/resource/Socrates' }) | |
, ( plato:Philosopher {name:'Plato', uri: 'http://dbpedia.org/resource/Plato' }) | |
, ( aristotle:Philosopher { name: 'Aristotle' , uri: 'http://dbpedia.org/resource/Aristotle' }) | |
, ( ancient_era:Era { name: 'Ancient philosophy', uri: 'http://dbpedia.org/resource/Ancient_philosophy' }) | |
, ( platonism_school:School { name: 'Platonism', uri: 'http://dbpedia.org/resource/Platonism' }) | |
, ( peripatetic_school:School { name: 'Peripatetic school', uri: 'http://dbpedia.org/resource/Peripatetic_school' }) | |
, ( ancient_greek_school:School { name: 'Ancient Greek philosophy', uri: 'http://dbpedia.org/resource/Ancient_Greek_philosophy' }) | |
, ( 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' }) | |
, ( content:SchoolType { name: 'content', uri: 'http://dbpedia.org/class/yago/Content105809192' }) | |
, ( knowledge:SchoolType { name: 'knowledge', uri: 'http://dbpedia.org/class/yago/Cognition100023271' }) | |
, ( change:SchoolType { name: 'change', uri: 'http://dbpedia.org/class/yago/Change100191142' }) | |
, socrates-[:INFLUENCES]->plato | |
, socrates-[:INFLUENCES]->aristotle | |
, plato-[:INFLUENCES]->aristotle | |
, socrates-[:MEMBER_OF]->ancient_greek_school | |
, plato-[:MEMBER_OF]->platonism_school | |
, aristotle-[:MEMBER_OF]->peripatetic_school | |
, socrates-[:MEMBER_OF]->ancient_era | |
, plato-[:MEMBER_OF]->ancient_era | |
, aristotle-[:MEMBER_OF]->ancient_era | |
, 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 | |
, tradition-[:SUBCLASS_OF]->content | |
, content-[:SUBCLASS_OF]->knowledge | |
, movement-[:SUBCLASS_OF]->change | |
---- | |
query to collect all Relationship Types from Philosopher Nodes to SchoolType nodes | |
[source,cypher] | |
---- | |
MATCH p=(a:Philosopher)-[*]->(b:SchoolType) | |
RETURN DISTINCT EXTRACT( r in RELATIONSHIPS(p)| type(r) ) as RelationshipTypes | |
---- | |
//table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment