ruby-xes 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,90 @@
1
+ require 'xes'
2
+
3
+ describe "XES::Log" do
4
+ it "should equal" do
5
+ XES::Log.new.should == XES::Log.new
6
+ end
7
+
8
+ it "should not equal" do
9
+ XES::Log.new.tap{|log| log.traces << XES::Trace.new}.should != XES::Log.new
10
+ end
11
+
12
+ it "should set and get xes_version" do
13
+ XES::Log.new.tap{|log| log.xes_version = "1.1"}.xes_version.should == "1.1"
14
+ end
15
+
16
+ it "should set and get xes_featuers" do
17
+ XES::Log.new.tap{|log| log.xes_features = ""}.xes_features.should == ""
18
+ end
19
+
20
+ it "should set and get openxes_version" do
21
+ XES::Log.new.tap{|log| log.openxes_version = "1.9"}.openxes_version.should == "1.9"
22
+ end
23
+
24
+ it "should set and get xmlns" do
25
+ XES::Log.new.tap{|log| log.xmlns = "test"}.xmlns.should == "test"
26
+ end
27
+
28
+ it "should set and get extensions" do
29
+ XES::Log.new.tap do |log|
30
+ log.extensions << XES::EXTENSION[:semantic]
31
+ end.extensions.should.include(XES::EXTENSION[:semantic])
32
+ end
33
+
34
+ it "should set and get classifiers" do
35
+ XES::Log.new.tap do |log|
36
+ log.classifiers << XES::Classifier.new("test", "time:timestamp")
37
+ end.classifiers.should.include(XES::Classifier.new("test", "time:timestamp"))
38
+ end
39
+
40
+ it "should set and get event_global" do
41
+ XES::Log.new.tap do |log|
42
+ log.event_global.concept_name = "__INVALID__"
43
+ end.event_global.attributes.should.include(XES.string("concept:name", "__INVALID__"))
44
+ end
45
+
46
+ it "should set and get trace_global" do
47
+ XES::Log.new.tap do |log|
48
+ log.trace_global.concept_name = "__INVALID__"
49
+ end.trace_global.attributes.should.include(XES.string("concept:name", "__INVALID__"))
50
+ end
51
+
52
+ it "should set and get attributes" do
53
+ XES::Log.new.tap do |log|
54
+ log.attributes << XES.string("concept:name", "test")
55
+ end.attributes.should.include(XES.string("concept:name", "test"))
56
+ end
57
+
58
+ it "should set and get traces" do
59
+ XES::Log.new.tap do |log|
60
+ log.traces << XES::Trace.new
61
+ end.traces.should.include(XES::Trace.new)
62
+ end
63
+
64
+ it "should be formattable" do
65
+ XES::Log.new.tap do |log|
66
+ log.traces << XES::Trace.new.tap do |trace|
67
+ trace.events << XES::Event.new.tap do |event|
68
+ event.attributes << XES.string("concept:name", "test")
69
+ end
70
+ end
71
+ end.should.formattable
72
+ end
73
+
74
+ it "should be not formattable" do
75
+ XES::Log.new.tap do |log|
76
+ log.traces << XES::Trace.new
77
+ end.should.not.formattable
78
+ end
79
+
80
+ it "should format as XML element" do
81
+ XES::Log.new.tap do |log|
82
+ log.traces << XES::Trace.new.tap do |trace|
83
+ trace.events << XES::Event.new.tap do |event|
84
+ event.attributes << XES.string("concept:name", "test")
85
+ end
86
+ end
87
+ end.format.to_s.should ==
88
+ "<log xes.features='' xes.version='1.4' xmlns='http://www.xes-standard.org/'><trace><event><string key='concept:name' value='test'/></event></trace></log>"
89
+ end
90
+ end
@@ -0,0 +1,113 @@
1
+ require 'xes'
2
+
3
+ describe "XES::Trace" do
4
+ it "should equal" do
5
+ XES::Trace.new.tap do |x|
6
+ x.attributes << XES.string("concept:name", "A")
7
+ x.events << XES::Event.new([XES.string("concept:name", "B")])
8
+ end.should ==
9
+ XES::Trace.new.tap do |x|
10
+ x.attributes << XES.string("concept:name", "A")
11
+ x.events << XES::Event.new([XES.string("concept:name", "B")])
12
+ end
13
+ end
14
+
15
+ it "should not equal" do
16
+ XES::Trace.new.tap do |x|
17
+ x.attributes << XES.string("concept:name", "A")
18
+ x.events << XES::Event.new([XES.string("concept:name", "B")])
19
+ end.should !=
20
+ XES::Trace.new.tap do |x|
21
+ x.attributes << XES.string("concept:name", "A")
22
+ x.events << XES::Event.new([XES.string("concept:name", "C")])
23
+ end
24
+ end
25
+
26
+ it "should get attributes" do
27
+ XES::Trace.new.tap do |x|
28
+ x.attributes << XES.string("concept:name", "A")
29
+ x.events << XES::Event.new([XES.string("concept:name", "B")])
30
+ end.attributes.should == [XES.string("concept:name", "A")]
31
+ end
32
+
33
+ it "should get events" do
34
+ XES::Trace.new.tap do |x|
35
+ x.attributes << XES.string("concept:name", "A")
36
+ x.events << XES::Event.new([XES.string("concept:name", "B")])
37
+ end.events.should == [XES::Event.new([XES.string("concept:name", "B")])]
38
+ end
39
+
40
+ it "should get concept:name" do
41
+ XES::Trace.new.tap do |x|
42
+ x.attributes << XES.string("concept:name", "A")
43
+ end.concept_name.should == "A"
44
+ end
45
+
46
+ it "should set concept:name" do
47
+ XES::Trace.new.tap{|x| x.concept_name = "A"}.concept_name.should == "A"
48
+ end
49
+
50
+ it "should get semantic:modelReference" do
51
+ XES::Trace.new.tap do |x|
52
+ x.attributes << XES.string("semantic:modelReference", "A")
53
+ end.semantic_modelReference.should == "A"
54
+ end
55
+
56
+ it "should set semantic:modelReference" do
57
+ XES::Trace.new.tap{|x| x.semantic_modelReference = "A"}.semantic_modelReference.should == "A"
58
+ end
59
+
60
+ it "should get identity:id" do
61
+ XES::Trace.new.tap do |x|
62
+ x.attributes << XES.id("identity:id", "A")
63
+ end.identity_id.should == "A"
64
+ end
65
+
66
+ it "should set identity:id" do
67
+ XES::Trace.new.tap{|x| x.identity_id = "A"}.identity_id.should == "A"
68
+ end
69
+
70
+ it "should get cost:total" do
71
+ XES::Trace.new.tap do |x|
72
+ x.attributes << XES.float("cost:total", "A")
73
+ end.cost_total.should == "A"
74
+ end
75
+
76
+ it "should set cost:total" do
77
+ XES::Trace.new.tap{|x| x.cost_total = "A"}.cost_total.should == "A"
78
+ end
79
+
80
+ it "should get cost:currency" do
81
+ XES::Trace.new.tap do |x|
82
+ x.attributes << XES.string("cost:currency", "AUD")
83
+ end.cost_currency.should == "AUD"
84
+ end
85
+
86
+ it "should set cost:currency" do
87
+ XES::Trace.new.tap{|x| x.cost_currency = "AUD"}.cost_currency.should == "AUD"
88
+ end
89
+
90
+ it "should be formattable" do
91
+ XES::Trace.new.tap{|x| x.events << XES::Event.new([XES.string("concept:name", "B")])}.should.formattable
92
+ end
93
+
94
+ it "should be not formattable when the trace have no events" do
95
+ XES::Trace.new.should.not.formattable
96
+ end
97
+
98
+ it "should be not formattable when the trace have only invalid event" do
99
+ XES::Trace.new.tap{|x| x.events << XES::Event.new}.should.not.formattable
100
+ end
101
+
102
+ it "should raise FormatError because the trace has no events" do
103
+ should.raise(XES::FormatError) do
104
+ XES::Trace.new.format
105
+ end
106
+ end
107
+
108
+ it "should raise FormatError because events of the trace are invalid" do
109
+ should.raise(XES::FormatError) do
110
+ XES::Trace.new.tap{|x| x.events << XES::Event.new}.format
111
+ end
112
+ end
113
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-xes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Keita Yamaguchi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bacon
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: yard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.8.5
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.8.5
46
+ - !ruby/object:Gem::Dependency
47
+ name: redcarpet
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: ruby-xes is a library for generating XES event log.
63
+ email:
64
+ - keita.yamaguchi@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - lib/xes.rb
75
+ - lib/xes/attribute-accessor.rb
76
+ - lib/xes/attribute.rb
77
+ - lib/xes/classifier.rb
78
+ - lib/xes/document.rb
79
+ - lib/xes/event.rb
80
+ - lib/xes/extension.rb
81
+ - lib/xes/format-error.rb
82
+ - lib/xes/global.rb
83
+ - lib/xes/log.rb
84
+ - lib/xes/trace.rb
85
+ - lib/xes/version.rb
86
+ - ruby-xes.gemspec
87
+ - test/spec_attribute.rb
88
+ - test/spec_classifier.rb
89
+ - test/spec_document.rb
90
+ - test/spec_event.rb
91
+ - test/spec_extension.rb
92
+ - test/spec_global.rb
93
+ - test/spec_log.rb
94
+ - test/spec_trace.rb
95
+ homepage: https://github.com/pione/ruby-xes
96
+ licenses: []
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 1.8.24
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: ruby-xes is a library for generating XES event log.
119
+ test_files:
120
+ - test/spec_attribute.rb
121
+ - test/spec_classifier.rb
122
+ - test/spec_document.rb
123
+ - test/spec_event.rb
124
+ - test/spec_extension.rb
125
+ - test/spec_global.rb
126
+ - test/spec_log.rb
127
+ - test/spec_trace.rb
128
+ has_rdoc: