{"id":10349,"date":"2023-07-12T20:39:33","date_gmt":"2023-07-13T01:39:33","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=10349"},"modified":"2023-09-05T11:42:54","modified_gmt":"2023-09-05T16:42:54","slug":"neo4j-exploring-the-data","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=10349","title":{"rendered":"NEO4J: Exploring the Data"},"content":{"rendered":"<p>Since I seem to frequently acquire orphaned platforms with no documentation, I figure it would be good to figure out how to investigate an unknown NEO4J platform to see what it\u2019s got. \u201cSHOW\u201d is very useful in these cases. The full list of SHOW commands is:<\/p>\n<pre>\"ALIAS\"\r\n\"ALIASES\"\r\n\"ALL\"\r\n\"BTREE\"\r\n\"BUILT\"\r\n\"CONSTRAINT\"\r\n\"CONSTRAINTS\"\r\n\"CURRENT\"\r\n\"DATABASE\"\r\n\"DATABASES\"\r\n\"DEFAULT\"\r\n\"EXIST\"\r\n\"EXISTENCE\"\r\n\"EXISTS\"\r\n\"FULLTEXT\"\r\n\"FUNCTION\"\r\n\"FUNCTIONS\"\r\n\"HOME\"\r\n\"INDEX\"\r\n\"INDEXES\"\r\n\"KEY\"\r\n\"LOOKUP\"\r\n\"NODE\"\r\n\"POINT\"\r\n\"POPULATED\"\r\n\"PRIVILEGE\"\r\n\"PRIVILEGES\"\r\n\"PROCEDURE\"\r\n\"PROCEDURES\"\r\n\"PROPERTY\"\r\n\"RANGE\"\r\n\"REL\"\r\n\"RELATIONSHIP\"\r\n\"ROLE\"\r\n\"ROLES\"\r\n\"SERVER\"\r\n\"SERVERS\"\r\n\"SETTING\"\r\n\"SETTINGS\"\r\n\"SUPPORTED\"\r\n\"TEXT\"\r\n\"TRANSACTION\"\r\n\"TRANSACTIONS\"\r\n\"UNIQUE\"\r\n\"UNIQUENESS\"\r\n\"USER\"\r\n\"USERS\"<\/pre>\n<p>The most useful ones for figuring out what you\u2019ve got \u2026 the \u201cshow databases\u201d command I know from MySQL\/MariaDB does what I expected \u2013 you can also include a specific database name, but \u201cshow database ljrtest\u201d doesn\u2019t appear to list any more information than the generic show databases command. .<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1433\" height=\"341\" class=\"wp-image-10350\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-1.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-1.png 1433w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-1-300x71.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-1-1024x244.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-1-768x183.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-1-750x178.png 750w\" sizes=\"auto, (max-width: 1433px) 100vw, 1433px\" \/><\/p>\n<p>There\u2019s also a \u201cshow users\u201d command that outputs the users in the database \u2013 although I\u2019m using the community edition without authentication, so there isn\u2019t much interesting information being output here.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1437\" height=\"209\" class=\"wp-image-10351\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-2.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-2.png 1437w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-2-300x44.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-2-1024x149.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-2-768x112.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-2-750x109.png 750w\" sizes=\"auto, (max-width: 1437px) 100vw, 1437px\" \/><\/p>\n<p>And roles, if roles are being used, should be output with \u201cSHOW ALL ROLES\u201d \u2026 but mine just says \u201cUnsupported administration command\u201d<\/p>\n<p>Once you know what databases you\u2019ve got and who can log in and do stuff, we\u2019d want to look at the data. There are some built-in functions that will help us out here. The db.labels() function will list the labels in the selected database.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"804\" height=\"536\" class=\"wp-image-10352\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-3.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-3.png 804w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-3-300x200.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-3-768x512.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-3-750x500.png 750w\" sizes=\"auto, (max-width: 804px) 100vw, 804px\" \/><\/p>\n<p>You can also return a distinct list of labels along with the count of nodes with that label:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1340\" height=\"536\" class=\"wp-image-10353\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-4.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-4.png 1340w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-4-300x120.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-4-1024x410.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-4-768x307.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-4-750x300.png 750w\" sizes=\"auto, (max-width: 1340px) 100vw, 1340px\" \/><\/p>\n<p>Since a node can have multiple, comparing that total with a count of nodes would give you an idea if there are many more labels than nodes. In my case, either view shows 156 \u2026 so I know there are few (if any) nodes with multiple labels.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"211\" class=\"wp-image-10354\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-5.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-5.png 644w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-5-300x98.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/p>\n<p>To view the types of relationships defined in the selected database, use \u201cCALL db.relationshipTypes()\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"519\" class=\"wp-image-10355\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-6.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-6.png 650w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-6-300x240.png 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>Similarly, you can return the relationship types along with counts<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1259\" height=\"535\" class=\"wp-image-10356\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-7.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-7.png 1259w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-7-300x127.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-7-1024x435.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-7-768x326.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-7-750x319.png 750w\" sizes=\"auto, (max-width: 1259px) 100vw, 1259px\" \/><\/p>\n<p>There is a function to list the property keys used within the data \u2013 interesting to note that keys that were used but the nodes using them were subsequently deleted \u2026 they still show up as property keys. Basically, anything that is there is on this list but some things on this list may not be there anymore. In this example, \u2018parentm\u2019 and \u2018parentf\u2019 were labels I used to build relationships programmatically.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"665\" height=\"735\" class=\"wp-image-10357\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-8.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-8.png 665w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-8-271x300.png 271w\" sizes=\"auto, (max-width: 665px) 100vw, 665px\" \/><\/p>\n<p>I\u2019ve found db.schema.nodeTypeProperties to be more useful in this regard \u2013 it does not appear to list properties that are not in use, and the output includes field types<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1372\" height=\"712\" class=\"wp-image-10358\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-9.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-9.png 1372w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-9-300x156.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-9-1024x531.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-9-768x399.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-9-750x389.png 750w\" sizes=\"auto, (max-width: 1372px) 100vw, 1372px\" \/><\/p>\n<p>To see if there are any custom procedures or functions registered, look on the server(s). Use ps -efww to view the running command \u2013 there will be some folders listed after \u201c-cp\u201d \u2026 you could find procedures or plugins in any of those folders. In my case, the plugins are in \/plugins<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1456\" height=\"129\" class=\"wp-image-10359\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-10.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-10.png 1456w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-10-300x27.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-10-1024x91.png 1024w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-10-768x68.png 768w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-10-750x66.png 750w\" sizes=\"auto, (max-width: 1456px) 100vw, 1456px\" \/><\/p>\n<p>And the only \u201ccustom\u201d things registered are the APOC and APOC-Extended jar\u2019s<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"756\" height=\"136\" class=\"wp-image-10360\" src=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-11.png\" srcset=\"https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-11.png 756w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-11-300x54.png 300w, https:\/\/www.rushworth.us\/lisa\/wp-content\/uploads\/2023\/09\/word-image-10349-11-750x135.png 750w\" sizes=\"auto, (max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Since I seem to frequently acquire orphaned platforms with no documentation, I figure it would be good to figure out how to investigate an unknown NEO4J platform to see what it\u2019s got. \u201cSHOW\u201d is very useful in these cases. The full list of SHOW commands is: &#8220;ALIAS&#8221; &#8220;ALIASES&#8221; &#8220;ALL&#8221; &#8220;BTREE&#8221; &#8220;BUILT&#8221; &#8220;CONSTRAINT&#8221; &#8220;CONSTRAINTS&#8221; &#8220;CURRENT&#8221; &#8220;DATABASE&#8221; &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1896],"tags":[1902,1897],"class_list":["post-10349","post","type-post","status-publish","format-standard","hentry","category-neo4j","tag-cypher","tag-neo4j"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10349"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10349\/revisions"}],"predecessor-version":[{"id":10362,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10349\/revisions\/10362"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}