Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikwattro/a776b784e4887ccaea25cc1c3a3487a0 to your computer and use it in GitHub Desktop.
Save ikwattro/a776b784e4887ccaea25cc1c3a3487a0 to your computer and use it in GitHub Desktop.
MATCH (n:VideoTranscript {path:"/Users/ikwattro/dev/_transcript/Intro to Graph Databases Episode #6 - Continuing with Cypher-Kv_HP6C2qes.en.vtt"})-[:HAS_ANNOTATED_TEXT]->(a)
match (a)-[:CONTAINS_SENTENCE]->(s:Sentence)
with a, count(*) as nSentences
match (a)-[:CONTAINS_SENTENCE]->(s:Sentence)-[:HAS_TAG]->(t:Tag)
with a, s, count(distinct t) as nTags, (CASE WHEN nSentences*0.1 > 10 THEN 10 ELSE toInteger(nSentences*0.1) END) as nLimit
where nTags > 4
with a, s, nLimit
order by s.summaryRank
with a, collect({text: s.text, pos: s.sentenceNumber})[..10] as summary
unwind summary as sent
return sent.text
order by sent.pos LIMIT 5
╒══════════════════════════════════════════════════════════════════════╕
│"sent.text"                                                           │
╞══════════════════════════════════════════════════════════════════════╡
│"We're going to be discussing how you do filtering, aggregates, and al│
│so cover some additional syntax that is helpful to know as you're writ│
│ing your Cypher queries."                                             │
├──────────────────────────────────────────────────────────────────────┤
│"So in this case, we're looking for people who acted in movies and ret│
│urn both the nodes and the relationships that match that by retur│
│ning the path."                                                       │
├──────────────────────────────────────────────────────────────────────┤
│"So in that case, we are going to get a graph returned, whereas, alter│
│natively, on the right-hand side, we are returning specific properties│
│ by name."                                                            │
├──────────────────────────────────────────────────────────────────────┤
│"Properties are accessed using the syntax you just saw, where we speci│
│fy the variable as well as the property key."                         │
├──────────────────────────────────────────────────────────────────────┤
│"And the Cypher style guide is written by the folks on the openCypher │
│project, and covers the preferred way of casing different parts of you│
│r Cypher syntax."                                                     │
└──────────────────────────────────────────────────────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment