histograph/cypher-examples

Name: cypher-examples

Owner: Histograph

Description: Selection of example Cypher queries for Histograph data

Created: 2015-08-13 09:30:36.0

Updated: 2015-08-13 09:30:36.0

Pushed: 2015-10-20 13:01:18.0

Homepage: null

Size: 136

Language: null

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Cypher Examples

Selection of example Cypher queries for Histograph data. Expects a Neo4j instance with Histograph data from the following two sources:

Example queries:

Concepts ordered by degree
H (c:`=`)
ONAL MATCH c --> n
RN c,
unt(distinct n) AS cn,
llect(DISTINCT n.name) AS names
R BY cn DESC LIMIT 10;
Types per dataset
H
:_)
E NOT p:_Rel AND NOT p:`=` AND NOT p:`=i`
RN DISTINCT
dataset AS dataset,
type AS type,
UNT(p) AS count
Nieuw-Amsterdam, Nederland
ind source and target nodes
H (m:_) WHERE m.id = "urn:hg:tgn:1047973"
H (n:_) WHERE n.id = "urn:hg:tgn:7016845"

ind corresponding equivalence classes (ECs)
ONAL MATCH m <-[:`=`]- (mConcept:`=`)
ONAL MATCH n <-[:`=`]- (nConcept:`=`)

hoose the right node (EC if there, otherwise only member)
 coalesce(nConcept, n) AS to,
 coalesce(mConcept, m) AS from

nsure we have a path
H p = allShortestPaths(from -[:`hg:liesIn`|`=`|`=i` * 1 .. 5]-> to)
RN p
Municipalities absorbed by Berkelland
ind target nodes
H (n:_) WHERE n.id = "urn:hg:gemeentegeschiedenis:Berkelland"

ind corresponding equivalence classes (ECs)
ONAL MATCH n <-[:`=`]- (nConcept:`=`)

hoose the right node (EC if there, otherwise only member)
 coalesce(nConcept, n) AS to

ind `hg:absorbedBy` paths
H p = allShortestPaths(from -[:`hg:absorbedBy`|`=`|`=i` * 1 .. 5]-> to)

etch all nodes in path
ND(nodes(p)) as k
H k

elect only non-relation nodes
E NOT k:_Rel AND NOT k:`=`

RN DISTINCT k.name, k.id, k.validSince, k.validUntil
R BY k.validUntil
Places inside Municipality of Emmen
ind target nodes
H (n:_) WHERE n.id = "urn:hg:geonames:2756134"

ind corresponding equivalence classes (ECs)
ONAL MATCH n <-[:`=`]- (nConcept:`=`)

hoose the right node (EC if there, otherwise only member)
 coalesce(nConcept, n) AS to

ind paths
H (place:`hg:Place`) -[:`hg:liesIn`|`=`|`=i` * 3 .. 3]-> to
RN DISTINCT place.name, place.id

Copyright © 2015 Waag Society.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.