Class: Pacer::Neo4jGraph
- Inherits:
-
Object
- Object
- Pacer::Neo4jGraph
- Includes:
- Core::Graph::GraphRoute, Core::Route, GraphMixin, GraphTransactionsMixin, ManagedTransactionsMixin
- Defined in:
- lib/pacer/blueprints/neo4j.rb
Overview
Extend the java class imported from blueprints.
Instance Attribute Summary
Attributes included from Core::Route
#graph, #hide_elements, #pipe_args, #pipe_class, #route_name
Attributes included from GraphMixin
Instance Method Summary (collapse)
- - (Object) decode_property(value)
- - (Object) element_type(et = nil)
- - (Object) encode_property(value)
-
- (Object) get_edges
Override to return an enumeration-friendly array of edges.
-
- (Object) get_vertices
Override to return an enumeration-friendly array of vertices.
- - (Object) sanitize_properties(props)
- - (Boolean) supports_circular_edges?
- - (Boolean) supports_custom_element_ids?
Methods included from Core::Graph::GraphRoute
#==, #e, #filter, #graph, #hide_elements, #result, #root?, #v
Methods included from Core::Route
#-, #==, #add_extension, #add_extensions, #each_context, #each_element, #each_object, #each_path, #empty?, #except, #extensions, #extensions=, #from_graph?, #inspect, #only, #root?, #route, #set_pipe_source, #vars
Methods included from ManagedTransactionsMixin
#manage_transactions=, #manage_transactions?, #managed_checkpoint, #managed_commit_transaction, #managed_manual_transaction, #managed_start_transaction, #managed_transaction, #managed_transactions, #unmanaged_transactions
Methods included from GraphTransactionsMixin
#begin_transaction, #checkpoint, #commit_transaction, #in_transaction?, included, #manual_transaction, #manual_transactions, #rollback_transaction, #transaction
Methods included from GraphMixin
#build_automatic_index, #bulk_job_size, #bulk_job_size=, #create_edge, #create_vertex, #edge, #edge_name, #edge_name=, #element_type?, #export, #graph, #import, #in_bulk_job?, included, #index_class, #index_name, #load_edges, #load_vertices, #rebuild_automatic_index, #supports_automatic_indices?, #supports_edge_indices?, #supports_manual_indices?, #vertex, #vertex_name, #vertex_name=
Instance Method Details
- (Object) decode_property(value)
100 101 102 103 104 105 106 |
# File 'lib/pacer/blueprints/neo4j.rb', line 100 def decode_property(value) if value.is_a? String and value[0, 3] == '---' YAML.load(value) else value end end |
- (Object) element_type(et = nil)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/pacer/blueprints/neo4j.rb', line 45 def element_type(et = nil) return nil unless et if et == Neo4jVertex or et == Neo4jEdge or et == Neo4jElement et else case et when :vertex, com.tinkerpop.blueprints.pgm.Vertex, VertexMixin Neo4jVertex when :edge, com.tinkerpop.blueprints.pgm.Edge, EdgeMixin Neo4jEdge when :mixed, com.tinkerpop.blueprints.pgm.Element, ElementMixin Neo4jElement when :object Object else if et == Object Object elsif et == Neo4jVertex.java_class.to_java Neo4jVertex elsif et == Neo4jEdge.java_class.to_java Neo4jEdge else raise ArgumentError, 'Element type may be one of :vertex or :edge' end end end end |
- (Object) encode_property(value)
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/pacer/blueprints/neo4j.rb', line 80 def encode_property(value) case value when nil nil when String value = value.strip value = nil if value == '' value when Numeric if value.is_a? Bignum value.to_yaml else value end else value.to_yaml end end |
- (Object) get_edges
Override to return an enumeration-friendly array of edges.
41 42 43 |
# File 'lib/pacer/blueprints/neo4j.rb', line 41 def get_edges getEdges.to_route(:graph => self, :element_type => :edge) end |
- (Object) get_vertices
Override to return an enumeration-friendly array of vertices.
36 37 38 |
# File 'lib/pacer/blueprints/neo4j.rb', line 36 def get_vertices getVertices.to_route(:graph => self, :element_type => :vertex) end |
- (Object) sanitize_properties(props)
73 74 75 76 77 78 |
# File 'lib/pacer/blueprints/neo4j.rb', line 73 def sanitize_properties(props) pairs = props.map do |name, value| [name, encode_property(value)] end Hash[pairs] end |
- (Boolean) supports_circular_edges?
117 118 119 |
# File 'lib/pacer/blueprints/neo4j.rb', line 117 def supports_circular_edges? false end |
- (Boolean) supports_custom_element_ids?
121 122 123 |
# File 'lib/pacer/blueprints/neo4j.rb', line 121 def supports_custom_element_ids? false end |