Class: NeoScout::GDB_Neo4j::Typer

Inherits:
Typer
  • Object
show all
Includes:
TyperValueTableMixin
Defined in:
lib/neoscout/gdb_neo4j.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TyperValueTableMixin

#valid_value?

Methods inherited from Typer

#valid_value?

Constructor Details

#initializeTyper

Returns a new instance of Typer.



33
34
35
36
37
38
39
# File 'lib/neoscout/gdb_neo4j.rb', line 33

def initialize
  @type_attr        = '_classname'
  @nil_type         = '__NOTYPE__'
  @node_mapper      = nil
  @edge_mapper      = nil
  @value_type_table = {}
end

Instance Attribute Details

#edge_mapperObject

Returns the value of attribute edge_mapper.



29
30
31
# File 'lib/neoscout/gdb_neo4j.rb', line 29

def edge_mapper
  @edge_mapper
end

#nil_typeObject

Returns the value of attribute nil_type.



26
27
28
# File 'lib/neoscout/gdb_neo4j.rb', line 26

def nil_type
  @nil_type
end

#node_mapperObject

Returns the value of attribute node_mapper.



28
29
30
# File 'lib/neoscout/gdb_neo4j.rb', line 28

def node_mapper
  @node_mapper
end

#type_attrObject

Returns the value of attribute type_attr.



25
26
27
# File 'lib/neoscout/gdb_neo4j.rb', line 25

def type_attr
  @type_attr
end

#value_type_tableObject

Returns the value of attribute value_type_table.



27
28
29
# File 'lib/neoscout/gdb_neo4j.rb', line 27

def value_type_table
  @value_type_table
end

Instance Method Details

#checked_edge_type?(edge_type) ⇒ Boolean

Returns:

  • (Boolean)


53
# File 'lib/neoscout/gdb_neo4j.rb', line 53

def checked_edge_type?(edge_type) ; edge_type != self.nil_type end

#checked_node_type?(node_type) ⇒ Boolean

Returns:

  • (Boolean)


52
# File 'lib/neoscout/gdb_neo4j.rb', line 52

def checked_node_type?(node_type) ; node_type != self.nil_type end

#edge_type(edge) ⇒ Object



47
48
49
50
# File 'lib/neoscout/gdb_neo4j.rb', line 47

def edge_type(edge)
  type = edge.rel_type
  if type then edge_mapped(type.to_s) else @nil_type end
end

#node_type(node) ⇒ Object



41
42
43
44
45
# File 'lib/neoscout/gdb_neo4j.rb', line 41

def node_type(node)
  props = node.props
  return node_mapped(props[@type_attr]) if props.has_key? @type_attr
  @nil_type
end

#unknown_edge_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


56
# File 'lib/neoscout/gdb_neo4j.rb', line 56

def unknown_edge_type?(type) ; type == @nil_type end

#unknown_node_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


55
# File 'lib/neoscout/gdb_neo4j.rb', line 55

def unknown_node_type?(type) ; type == @nil_type end