neo4j_bolt 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31a315fe0d04141dd4d3315da9b25f6b42e6571b799dee6f6fab39a4ced605bd
4
- data.tar.gz: 4ac80c13abd2c1172f6786522342f8dd2d965c9352ae34d3011aeb38b6695dbe
3
+ metadata.gz: 0a19a8e8ffa10a25369a85dce34d09d3a3015a2a105ae52f43eb59fd9752badb
4
+ data.tar.gz: 2ccb5d3d9d583e53afe638f4a21a328b94f9edadee9aa744baa9f019afa26007
5
5
  SHA512:
6
- metadata.gz: 0e3db7bdadcc4c2ec69ef531466eb2d9696963a7d6709b7f7a198cfbf4c6ccf9037ccfca166d4c9bac5dd07426910cc1e7aa11f52de7785e4f1d697cabfe51d9
7
- data.tar.gz: 1f7fab9c9b4f78271d36bf5baee3d480bccfc45245d634547d8b146c3c0dbbc75b2f3616689c96717f3cabefceb5d2e1129ead5ac0d6cec1f4aef1afafbd46a3
6
+ metadata.gz: 1dadad65f242485126346c41db2c278f29a915ec075fb5775c0415c7b959cbc41efac7bfb3c29289b16a387de68f5a326be24b2bcd0614d5409e5a2503b39f0a
7
+ data.tar.gz: 04d1a7cb369c42260bfd5ea6ce9a030a519e68fcf86aaa7bda14b9cd7ec696472eb01512d7390abcc5037ed452246a50780a05b564131c746c62e23bf5a59e0f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neo4j_bolt (0.1.11)
4
+ neo4j_bolt (0.1.12)
5
5
  gli
6
6
 
7
7
  GEM
data/bin/neo4j_bolt CHANGED
@@ -90,7 +90,7 @@ class App
90
90
  c2.action do |global_options, options, args|
91
91
  neo4j_query("SHOW ALL CONSTRAINTS") do |row|
92
92
  # STDERR.puts row.to_yaml
93
- puts "#{row['type']} #{row['name']} #{row['labelsOrTypes'].join('/')}/#{row['properties'].join('/')}"
93
+ puts "#{row['type']} #{row['name']} #{(row['labelsOrTypes'] || []).join('/')}/#{row['properties'].join('/')}"
94
94
  end
95
95
  neo4j_query("SHOW ALL INDEXES") do |row|
96
96
  # STDERR.puts row.to_yaml
@@ -202,6 +202,30 @@ class App
202
202
  end
203
203
  end
204
204
 
205
+ indexes = {}
206
+ INDEX_TR = {
207
+ 'UNIQUENESS' => '<u>unique</u>',
208
+ 'BTREE' => 'indexed',
209
+ }
210
+
211
+ ['SHOW ALL CONSTRAINTS', 'SHOW ALL INDEXES'].each do |query|
212
+ neo4j_query(query) do |row|
213
+ # STDERR.puts row.to_json
214
+ labels_or_types = row['labelsOrTypes'] || []
215
+ properties = row['properties'] || []
216
+ type = row['type']
217
+ entity = row['entityType']
218
+ if labels_or_types.size == 1 && properties.size == 1
219
+ label_or_type = labels_or_types.first
220
+ property = properties.first
221
+ indexes[entity.downcase.to_sym] ||= {}
222
+ indexes[entity.downcase.to_sym][label_or_type] ||= {}
223
+ indexes[entity.downcase.to_sym][label_or_type][property] ||= Set.new()
224
+ indexes[entity.downcase.to_sym][label_or_type][property] << type
225
+ end
226
+ end
227
+ end
228
+
205
229
  dot = StringIO.open do |io|
206
230
  io.puts "digraph {"
207
231
  io.puts "graph [fontname = Helvetica, fontsize = 10, nodesep = 0.2, ranksep = 0.3];"
@@ -218,7 +242,12 @@ class App
218
242
  label += "</td></tr>"
219
243
  properties_for_label[lbl].keys.sort.each do |key|
220
244
  label += "<tr>"
221
- label += "<td border='1' valign='top' align='left' colspan='1'>#{key}</td>"
245
+ parts = Set.new()
246
+ ((((indexes[:node] || {})[lbl] || {})[key.to_s]) || Set.new()).each do |it|
247
+ parts << INDEX_TR[it] || it
248
+ end
249
+ index_s = parts.empty? ? '' : " <i>(#{parts.join(', ')})</i>"
250
+ label += "<td border='1' valign='top' align='left' colspan='1'>#{key}#{index_s}</td>"
222
251
  label += "<td border='1' valign='top' align='left' colspan='1'>#{properties_for_label[lbl][key][:classes].to_a.map { |x| TR[x.to_s] || x.to_s }.sort.join(' / ')}</td>"
223
252
  label += "</tr>"
224
253
  end
@@ -232,15 +261,20 @@ class App
232
261
  lb = parts[2]
233
262
 
234
263
  label = "<<table valign='top' align='left' border='0' cellborder='0' cellspacing='0' cellpadding='4'>"
235
- label += "<tr><td border='1' bgcolor='#d3d7cf' valign='top' align='left' colspan='2'><b>#{type}</b>"
264
+ label += "<tr><td border='1' color='#888888' bgcolor='#d3d7cf' valign='top' align='left' colspan='2'>#{type}"
236
265
  if options[:properties]
237
266
  label += " <i>(#{counts_for_label[s]})</i>"
238
267
  end
239
268
  label += "</td></tr>"
240
269
  (properties_for_label[s] || {}).keys.sort.each do |key|
241
270
  label += "<tr>"
242
- label += "<td border='1' valign='top' align='left' colspan='1'>#{key}</td>"
243
- label += "<td border='1' valign='top' align='left' colspan='1'>#{properties_for_label[s][key][:classes].to_a.map { |x| TR[x.to_s] || x.to_s }.sort.join(' / ')}</td>"
271
+ parts = Set.new()
272
+ ((((indexes[:relationship] || {})[type] || {})[key.to_s]) || Set.new()).each do |it|
273
+ parts << INDEX_TR[it] || it
274
+ end
275
+ index_s = parts.empty? ? '' : " <i>(#{parts.join(', ')})</i>"
276
+ label += "<td border='1' color='#888888' valign='top' align='left' colspan='1'>#{key}#{index_s}</td>"
277
+ label += "<td border='1' color='#888888' valign='top' align='left' colspan='1'>#{properties_for_label[s][key][:classes].to_a.map { |x| TR[x.to_s] || x.to_s }.sort.join(' / ')}</td>"
244
278
  label += "</tr>"
245
279
  end
246
280
  label += "</table>>"
@@ -1,3 +1,3 @@
1
1
  module Neo4jBolt
2
- VERSION = "0.1.11"
2
+ VERSION = "0.1.13"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j_bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Specht