MATCH (n:VideoTranscript {path: "/Users/ikwattro/dev/_transcript/Knowledge Graph Search with Elasticsearch — L. Misquitta and A. Negro, GraphAware-k8Gu6GMbBtQ.en.vtt"})
WITH n
UNWIND range(60000, 3600000, 60000) AS i
MATCH (n)-[:HAS_CAPTION]->(c)-[:HAS_ANNOTATED_TEXT]->(at)<-[r:DESCRIBES]-(k)
WHERE c.startTimeMS > i - 60000 AND c.endTimeMS < i
WITH n, i, k, sum(r.relevance) AS score
WITH n, i, collect({keyword: k.value, score: score}) AS m
WITH n, i, reverse(apoc.coll.sortMaps(m, 'score'))[0..5] AS m
UNWIND m AS k
MATCH (keyword:Keyword {value: k.keyword})-[:DESCRIBES]->(at)<-[:HAS_ANNOTATED_TEXT]-(caption)<-[:HAS_CAPTION]-(video)
WHERE video <> n AND NOT keyword.value IN ["day","term"]
WITH m, i, video, keyword, count(*) AS f
WITH m, i, video, collect({keyword: keyword, f: f}) AS fm
WITH m, i, video, reverse(apoc.coll.sortMaps(fm, 'f'))[0..5] AS commonKeywords
WITH i, video.title AS reco, [x in commonKeywords | x.keyword.value] AS commonK
WITH i, collect({v: reco, kws: commonK, score: size(commonK)}) AS m
WITH i, reverse(apoc.coll.sortMaps(m, 'score'))[0..2] AS recos
RETURN i, [x IN recos | x.v + " -- " + apoc.text.join(x.kws, ', ')] ORDER BY i ASC
╒═══════╤════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╕
│"i" │"[x IN recos | x.v + " -- " + apoc.text.join(x.kws, ', ')]" │
╞═══════╪════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│60000 │["Connect, Enrich, Evolve - Convert Unstructured Data Silos to Knowledge Graphs-AMrXgoB3iBg.en.vtt -- knowledge graph, relev│
│ │ant search","Building the Connected Enterprise with Machine Learning and Neo4j — Tim Ward, CluedIn-iDf6SdhT758.en.vtt -- kno│
│ │wledge graph"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│120000 │["Cypher Everywhere - Neo4j, Hadoop_Spark and the Unexpected — A. Green, M. Rydberg, D. Solovyov, Neo4j-IrWnUFXjeMQ.en.vtt -│
│ │- multiple datum source, case","Cypher and Spark - Multiple Graphs and More in openCypher — Stefan Plantikow et al, Neo4j-Ea│
│ │CFxDxhtsI.en.vtt -- multiple datum source, case"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│180000 │["Digital Transformation and the Journey to a Highly Connected Enterprise-qWCYIXMXWXI.en.vtt -- knowledge graph","Graph Algo│
│ │rithms on ACID - Analytics for Understanding Data Relationships-bHjxKZUsQDs.en.vtt -- employee"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│240000 │["Digital Transformation and the Journey to a Highly Connected Enterprise-qWCYIXMXWXI.en.vtt -- relationship, panama papers"│
│ │,"Opening Keynote - Emil Eifrem-q0OU1nyQ1bQ.en.vtt -- panama papers, relationship"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│300000 │["Digital Transformation and the Journey to a Highly Connected Enterprise-qWCYIXMXWXI.en.vtt -- knowledge graph","Knowledge │
│ │Graphs - The Path to Enterprise — Michael Moore and AI Omar Azhar, EY-tvSgRX9_vP4.en.vtt -- knowledge graph"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│360000 │["Building the Connected Enterprise with Machine Learning and Neo4j — Tim Ward, CluedIn-iDf6SdhT758.en.vtt -- people, knowle│
│ │dge graph, classic problem","Collaborative Technology Intelligence Platform Using Graph Database — Fan Li, Dupont-QilEgDYxie│
│ │U.en.vtt -- people, knowledge graph"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│420000 │["Connect, Enrich, Evolve - Convert Unstructured Data Silos to Knowledge Graphs-AMrXgoB3iBg.en.vtt -- relevant search"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│480000 │["Connect, Enrich, Evolve - Convert Unstructured Data Silos to Knowledge Graphs-AMrXgoB3iBg.en.vtt -- knowledge graph, varie│
│ │ty","Master Data Management (MDM) with Neo4j-a2YXWV6jmYU.en.vtt -- variety, sort"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│540000 │["Information Sharing for Enterprise Architects — Patrick Elder & Jessica Dembe-aMPm4Zo58E4.en.vtt -- search engine","Collab│
│ │orative Technology Intelligence Platform Using Graph Database — Fan Li, Dupont-QilEgDYxieU.en.vtt -- search engine"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│600000 │["How Graphs are Taming the Complexity of Network & IT Ops-cBFCb172vLU.en.vtt -- end user","David Meza, Chief Knowledge Arch│
│ │itect, NASA-YFCWIrMSe3k.en.vtt -- end user"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│660000 │["Podcast Interview with Dustin Cote, Luther College-0ilk_EZGzBY.en.vtt -- same query","Mastering Highly Distributed Archite│
│ │cture with Neo4j — Thomas Lawrence, Amadeus-F1bWm_puNjQ.en.vtt -- same query"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│720000 │["Connect, Enrich, Evolve - Convert Unstructured Data Silos to Knowledge Graphs-AMrXgoB3iBg.en.vtt -- relevant search"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│780000 │["Connect, Enrich, Evolve - Convert Unstructured Data Silos to Knowledge Graphs-AMrXgoB3iBg.en.vtt -- relevant search"] │
├───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤