Class: CamTool::EdgeCounter

Inherits:
ProvJSONParser show all
Defined in:
lib/camtool/edge_counter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ProvJSONParser

#activity, #agent, #entity, #parse_json, #prefix, #read_json_file, #read_log_file, #relation

Constructor Details

#initializeEdgeCounter

Returns a new instance of EdgeCounter.



5
6
7
# File 'lib/camtool/edge_counter.rb', line 5

def initialize
  @map = Hash.new(0)
end

Instance Attribute Details

#mapObject (readonly)

Returns the value of attribute map.



3
4
5
# File 'lib/camtool/edge_counter.rb', line 3

def map
  @map
end

Instance Method Details

#add(key) ⇒ Object



9
10
11
# File 'lib/camtool/edge_counter.rb', line 9

def add key
  @map[key]=@map[key]+1
end

#showObject



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

def show
  puts "\n\n-------------\nEdge types\n-------------\n"
  @map = @map.sort_by { |key, value| value }.reverse
  @map.each do |key, value|
    puts "#{key}:#{value}"
  end
end

#used(k, v) ⇒ Object



13
14
15
# File 'lib/camtool/edge_counter.rb', line 13

def used k, v
  self.add v['prov:type']
end

#wasAssociatedWith(k, v) ⇒ Object



29
30
31
# File 'lib/camtool/edge_counter.rb', line 29

def wasAssociatedWith k, v
  self.add v['prov:type']
end

#wasDerivedFrom(k, v) ⇒ Object



21
22
23
# File 'lib/camtool/edge_counter.rb', line 21

def wasDerivedFrom k, v
  self.add v['prov:type']
end

#wasGeneratedBy(k, v) ⇒ Object



17
18
19
# File 'lib/camtool/edge_counter.rb', line 17

def wasGeneratedBy k, v
  self.add v['prov:type']
end

#wasInformedBy(k, v) ⇒ Object



25
26
27
# File 'lib/camtool/edge_counter.rb', line 25

def wasInformedBy k, v
  self.add v['prov:type']
end