Class: XES::Log
Overview
Log represents log element of XES.
Instance Attribute Summary collapse
-
#attributes ⇒ Array<Attribute>
XES attribute elements.
-
#classifiers ⇒ Array<Classifier>
XES classifiers.
-
#concept_name ⇒ String
The value of attribute “concept:name”.
-
#event_global ⇒ Array<Global>
XES global elements for event attributes.
-
#extensions ⇒ Array<Extension>
XES extensions.
-
#identity_id ⇒ String
The value of attribute “identity:id”.
-
#lifecycle_model ⇒ String
The value of attribute “lifecycle:model”.
-
#openxes_version ⇒ String
Openxes version for faking ProM.
-
#semantic_modelReference ⇒ String
The value of attribute “semantic:modelReference”.
-
#trace_global ⇒ Array<Global>
XES global elements for trace attributes.
-
#traces ⇒ Array<XESTrace>
XES trace elements.
-
#xes_features ⇒ String
XES features.
-
#xes_version ⇒ String
XES version.
-
#xmlns ⇒ String
Xmlns value.
Class Method Summary collapse
-
.default ⇒ Log
Create new instance with default values.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?) private
-
#format ⇒ REXML::Element
Format as a XML element.
-
#formattable? ⇒ Boolean
Return true if the element is formattable.
- #hash ⇒ Object private
-
#initialize ⇒ Log
constructor
A new instance of Log.
Methods included from AttributeAccessor
Constructor Details
#initialize ⇒ Log
Returns a new instance of Log.
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/xes/log.rb', line 92 def initialize @xes_version = "1.4" @xes_features = "" @openxes_version = nil @xmlns = "http://www.xes-standard.org/" @extensions = [] @event_global = Global.event @trace_global = Global.trace @classifiers = [] @attributes = [] @traces = [] end |
Instance Attribute Details
#attributes ⇒ Array<Attribute>
Returns XES attribute elements.
86 87 88 |
# File 'lib/xes/log.rb', line 86 def attributes @attributes end |
#classifiers ⇒ Array<Classifier>
Returns XES classifiers.
74 75 76 |
# File 'lib/xes/log.rb', line 74 def classifiers @classifiers end |
#concept_name ⇒ String
Returns the value of attribute “concept:name”.
9 |
# File 'lib/xes/log.rb', line 9 define_attribute "concept:name", "string" |
#event_global ⇒ Array<Global>
Returns XES global elements for event attributes.
78 79 80 |
# File 'lib/xes/log.rb', line 78 def event_global @event_global end |
#extensions ⇒ Array<Extension>
Returns XES extensions.
70 71 72 |
# File 'lib/xes/log.rb', line 70 def extensions @extensions end |
#identity_id ⇒ String
Returns the value of attribute “identity:id”.
24 |
# File 'lib/xes/log.rb', line 24 define_attribute "identity:id", "id" |
#lifecycle_model ⇒ String
Returns the value of attribute “lifecycle:model”.
14 |
# File 'lib/xes/log.rb', line 14 define_attribute "lifecycle:model", "string" |
#openxes_version ⇒ String
Returns openxes version for faking ProM.
62 63 64 |
# File 'lib/xes/log.rb', line 62 def openxes_version @openxes_version end |
#semantic_modelReference ⇒ String
Returns the value of attribute “semantic:modelReference”.
19 |
# File 'lib/xes/log.rb', line 19 define_attribute "semantic:modelReference", "string" |
#trace_global ⇒ Array<Global>
Returns XES global elements for trace attributes.
82 83 84 |
# File 'lib/xes/log.rb', line 82 def trace_global @trace_global end |
#traces ⇒ Array<XESTrace>
Returns XES trace elements.
90 91 92 |
# File 'lib/xes/log.rb', line 90 def traces @traces end |
#xes_features ⇒ String
Returns XES features.
58 59 60 |
# File 'lib/xes/log.rb', line 58 def xes_features @xes_features end |
#xes_version ⇒ String
Returns XES version.
54 55 56 |
# File 'lib/xes/log.rb', line 54 def xes_version @xes_version end |
#xmlns ⇒ String
Returns xmlns value.
66 67 68 |
# File 'lib/xes/log.rb', line 66 def xmlns @xmlns end |
Class Method Details
.default ⇒ Log
Create new instance with default values.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/xes/log.rb', line 31 def default new.tap do |log| log.xes_version = "1.4" log.xes_features = "nested-attributes" log.openxes_version = "1.0RC7" log.extensions = [ EXTENSION[:concept], EXTENSION[:identity], EXTENSION[:time], EXTENSION[:lifecycle], EXTENSION[:organizational], ] log.classifiers = [ CLASSIFIER[:mxml_legacy_classifier], CLASSIFIER[:event_name], CLASSIFIER[:resource] ] end end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/xes/log.rb', line 137 def ==(other) return false unless other.kind_of?(self.class) return false unless @xes_version == other.xes_version return false unless @xes_features == other.xes_features return false unless @openxes_version == other.openxes_version return false unless @xmlns == other.xmlns return false unless @extensions == other.extensions return false unless @event_global == other.event_global return false unless @trace_global == other.trace_global return false unless @classifiers == other.classifiers return false unless @attributes == other.attributes return false unless @traces == other.traces return true end |
#format ⇒ REXML::Element
Format as a XML element.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/xes/log.rb', line 119 def format raise FormatError.new(self) unless formattable? REXML::Element.new("log").tap do |log| log.attributes["xes.version"] = @xes_version.to_s if @xes_version log.attributes["xes.features"] = @xes_features.to_s if @xes_features log.attributes["openxes.version"] = @openxes_version.to_s if @openxes_version log.attributes["xmlns"] = @xmlns.to_s if @xmlns @extensions.each {|ext| log.elements << ext.format if ext.formattable?} @classifiers.each {|classifier| log.elements << classifier.format if classifier.formattable?} log.elements << @event_global.format if @event_global.formattable? log.elements << @trace_global.format if @trace_global.formattable? @attributes.each {|attribute| log.elements << attribute.format if attribute.formattable?} @traces.each {|trace| log.elements << trace.format if trace.formattable?} end end |
#formattable? ⇒ Boolean
Return true if the element is formattable.
109 110 111 |
# File 'lib/xes/log.rb', line 109 def formattable? @traces.any? {|trace| trace.formattable?} end |
#hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
154 155 156 |
# File 'lib/xes/log.rb', line 154 def hash @attributes.hash + @events.hash end |