Class: Pacer::Neo4j::TxDataWrapper
- Inherits:
-
Object
- Object
- Pacer::Neo4j::TxDataWrapper
- Includes:
- Algo::Wrapping
- Defined in:
- lib/pacer-neo4j/tx_data_wrapper.rb
Overview
Uses the interface defined here: api.neo4j.org/1.8/org/neo4j/graphdb/Path.html
Note that I have removed methods that I didn’t understand, assuming they are internal.
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#tx ⇒ Object
readonly
Returns the value of attribute tx.
-
#type_property ⇒ Object
readonly
Returns the value of attribute type_property.
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
- #assigned_e ⇒ Object
- #assigned_v ⇒ Object
- #cleared_e ⇒ Object
- #cleared_v ⇒ Object
- #created_e ⇒ Object
- #created_e_ids ⇒ Object
- #created_v ⇒ Object
- #created_v_ids ⇒ Object
- #data ⇒ Object
- #deleted?(e) ⇒ Boolean
- #deleted_e ⇒ Object
- #deleted_e_ids ⇒ Object
- #deleted_v ⇒ Object
- #deleted_v_ids ⇒ Object
- #each_e_change(&blk) ⇒ Object
- #each_v_change(&blk) ⇒ Object
-
#initialize(tx, graph, type_property) ⇒ TxDataWrapper
constructor
A new instance of TxDataWrapper.
- #summary ⇒ Object
Constructor Details
#initialize(tx, graph, type_property) ⇒ TxDataWrapper
Returns a new instance of TxDataWrapper.
12 13 14 15 16 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 12 def initialize(tx, graph, type_property) @tx = tx @graph = graph @type_property = type_property end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
10 11 12 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 10 def graph @graph end |
#tx ⇒ Object (readonly)
Returns the value of attribute tx.
10 11 12 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 10 def tx @tx end |
#type_property ⇒ Object (readonly)
Returns the value of attribute type_property.
10 11 12 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 10 def type_property @type_property end |
Instance Method Details
#as_json(options = nil) ⇒ Object
112 113 114 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 112 def as_json( = nil) data.as_json() end |
#assigned_e ⇒ Object
75 76 77 78 79 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 75 def assigned_e tx.assignedRelationshipProperties.map do |p| [p.entity.getId, p.key, graph.decode_property(p.value)] end end |
#assigned_v ⇒ Object
63 64 65 66 67 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 63 def assigned_v tx.assignedNodeProperties.map do |p| [p.entity.getId, p.key, graph.decode_property(p.value)] end end |
#cleared_e ⇒ Object
81 82 83 84 85 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 81 def cleared_e tx.removedRelationshipProperties.map do |p| [p.entity.getId, p.key] end end |
#cleared_v ⇒ Object
69 70 71 72 73 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 69 def cleared_v tx.removedNodeProperties.map do |p| [p.entity.getId, p.key] end end |
#created_e ⇒ Object
26 27 28 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 26 def created_e tx.createdRelationships.map { |n| wrap_edge n } end |
#created_e_ids ⇒ Object
51 52 53 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 51 def created_e_ids tx.createdRelationships.map { |n| [n.getId, n.getType.name, n.getStartNode.getId, n.getEndNode.getId] } end |
#created_v ⇒ Object
18 19 20 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 18 def created_v tx.createdNodes.map { |n| wrap_vertex n } end |
#created_v_ids ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 34 def created_v_ids if type_property tx.createdNodes.map do |n| if n.hasProperty(type_property) type = n.getProperty(type_property) end [n.getId, type] end else tx.createdNodes.map { |n| [n.getId] } end end |
#data ⇒ Object
108 109 110 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 108 def data TxCachedData.new summary end |
#deleted?(e) ⇒ Boolean
59 60 61 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 59 def deleted?(e) tx.is_deleted e.element.rawElement end |
#deleted_e ⇒ Object
30 31 32 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 30 def deleted_e tx.deletedRelationships.map { |n| wrap_edge n } end |
#deleted_e_ids ⇒ Object
55 56 57 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 55 def deleted_e_ids tx.deletedRelationships.map { |n| n.getId } end |
#deleted_v ⇒ Object
22 23 24 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 22 def deleted_v tx.deletedNodes.map { |n| wrap_vertex n } end |
#deleted_v_ids ⇒ Object
47 48 49 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 47 def deleted_v_ids tx.deletedNodes.map { |n| n.getId } end |
#each_e_change(&blk) ⇒ Object
92 93 94 95 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 92 def each_e_change(&blk) assigned_e.each(&blk) cleared_e.each(&blk) end |
#each_v_change(&blk) ⇒ Object
87 88 89 90 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 87 def each_v_change(&blk) assigned_v.each(&blk) cleared_v.each(&blk) end |
#summary ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 97 def summary { created_v: created_v_ids, deleted_v: deleted_v_ids, created_e: created_e_ids, deleted_e: deleted_e_ids, assigned_v: assigned_v, cleared_v: cleared_v, assigned_e: assigned_e, cleared_e: cleared_e } end |