Class: CamTool::VertexCounter
Instance Attribute Summary collapse
Instance Method Summary
collapse
#parse_json, #prefix, #read_json_file, #read_log_file, #relation, #used, #wasAssociatedWith, #wasDerivedFrom, #wasGeneratedBy, #wasInformedBy
Constructor Details
Returns a new instance of VertexCounter.
5
6
7
|
# File 'lib/camtool/vertex_counter.rb', line 5
def initialize
@map = Hash.new(0)
end
|
Instance Attribute Details
#map ⇒ Object
Returns the value of attribute map.
3
4
5
|
# File 'lib/camtool/vertex_counter.rb', line 3
def map
@map
end
|
Instance Method Details
#activity(k, v) ⇒ Object
17
18
19
|
# File 'lib/camtool/vertex_counter.rb', line 17
def activity k, v
self.add v['prov:type']
end
|
#add(key) ⇒ Object
9
10
11
|
# File 'lib/camtool/vertex_counter.rb', line 9
def add key
@map[key]=@map[key]+1
end
|
#agent(k, v) ⇒ Object
21
22
23
|
# File 'lib/camtool/vertex_counter.rb', line 21
def agent k, v
self.add v['prov:type']
end
|
#entity(k, v) ⇒ Object
13
14
15
|
# File 'lib/camtool/vertex_counter.rb', line 13
def entity k, v
self.add v['prov:type']
end
|
#show ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/camtool/vertex_counter.rb', line 25
def show
puts "\n\n-------------\nVertex types\n-------------\n"
@map = @map.sort_by { |key, value| value }.reverse
@map.each do |key, value|
puts "#{key}:#{value}"
end
end
|