CAST Imaging System - Information - Neo4j - How to get top 5 tables with most reads using cypher query
Purpose
This page provides the cypher query to get the top 5 tables with most reads
Applicable Platform or
| Imaging System | Yes/No |
|---|---|
| >2.x | ✅ |
Details
Run the below query in neo4j database to get top 5 tables with most reads
MATCH (o:{appname})-[r:USE]->(t:Object:{appname}) WHERE t.Type CONTAINS "Table"
and (o:Object or o:SubObject)
WITH DISTINCT r.aipLinkType as linkTypes, o, t
UNWIND linkTypes as lt WITH lt,linkTypes, o, t
MATCH(o1:{appname}) where lt = "select" and (o1:Object or o1:SubObject)
RETURN DISTINCT lt as `Link Type`,COUNT(DISTINCT o) as `No. of Reads`, t.Type as `Target Type`, t.FullName as `Target FullName`, t.Name as `Target Name`order by `No. of Reads` desc limit 5
Notes/comments
Note: Please replace {appname} with the application name
Have placed limit 5 to get topmost tables but suppose if 6 tables have same value it will give only first 5, so better to run without limit 5 condition and then take topmost tables.
Related Pages