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.
Instance Method Summary collapse
- #changed_e ⇒ Object
- #changed_v ⇒ Object
- #changes ⇒ Object
- #created_e ⇒ Object
- #created_e_ids ⇒ Object
- #created_v ⇒ Object
- #created_v_ids ⇒ Object
- #deleted?(e) ⇒ Boolean
- #deleted_e ⇒ Object
- #deleted_e_ids ⇒ Object
- #deleted_v ⇒ Object
- #deleted_v_ids ⇒ Object
-
#initialize(tx, graph) ⇒ TxDataWrapper
constructor
A new instance of TxDataWrapper.
- #summary ⇒ Object
Constructor Details
#initialize(tx, graph) ⇒ TxDataWrapper
Returns a new instance of TxDataWrapper.
12 13 14 15 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 12 def initialize(tx, graph) @tx = tx @graph = graph 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 |
Instance Method Details
#changed_e ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 70 def changed_e tx.assignedRelationshipProperties.map do |p| { element_type: :edge, id: p.entity.getId, key: p.key, was: graph.decode_property(p.previouslyCommitedValue), is: graph.decode_property(p.value) } end + tx.removedRelationshipProperties.map do |p| { element_type: :edge, id: p.entity.getId, key: p.key, was: graph.decode_property(p.previouslyCommitedValue), is: nil } end end |
#changed_v ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 53 def changed_v tx.assignedNodeProperties.map do |p| { element_type: :vertex, id: p.entity.getId, key: p.key, was: graph.decode_property(p.previouslyCommitedValue), is: graph.decode_property(p.value) } end + tx.removedNodeProperties.map do |p| { element_type: :vertex, id: p.entity.getId, key: p.key, was: graph.decode_property(p.previouslyCommitedValue), is: nil } end end |
#changes ⇒ Object
87 88 89 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 87 def changes changed_v + changed_e end |
#created_e ⇒ Object
25 26 27 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 25 def created_e tx.createdRelationships.map { |n| wrap_edge n } end |
#created_e_ids ⇒ Object
41 42 43 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 41 def created_e_ids tx.createdRelationships.map { |n| n.getId } end |
#created_v ⇒ Object
17 18 19 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 17 def created_v tx.createdNodes.map { |n| wrap_vertex n } end |
#created_v_ids ⇒ Object
33 34 35 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 33 def created_v_ids tx.createdNodes.map { |n| n.getId } end |
#deleted?(e) ⇒ Boolean
49 50 51 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 49 def deleted?(e) tx.is_deleted e.element.rawElement end |
#deleted_e ⇒ Object
29 30 31 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 29 def deleted_e tx.deletedRelationships.map { |n| wrap_edge n } end |
#deleted_e_ids ⇒ Object
45 46 47 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 45 def deleted_e_ids tx.deletedRelationships.map { |n| n.getId } end |
#deleted_v ⇒ Object
21 22 23 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 21 def deleted_v tx.deletedNodes.map { |n| wrap_vertex n } end |
#deleted_v_ids ⇒ Object
37 38 39 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 37 def deleted_v_ids tx.deletedNodes.map { |n| n.getId } end |
#summary ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/pacer-neo4j/tx_data_wrapper.rb', line 91 def summary { created_v: created_v_ids, deleted_v: deleted_v_ids, created_e: created_e_ids, deleted_e: deleted_e_ids, changed_v: changed_v, changed_e: changed_e } end |