Class: OCI::Oda::Models::EntityAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/oda/models/entity_attribute.rb

Overview

Attribute of an entity

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_TEXT = 'TEXT'.freeze,
  TYPE_NUMBER = 'NUMBER'.freeze,
  TYPE_DATE_TIME = 'DATE_TIME'.freeze,
  TYPE_DATE = 'DATE'.freeze,
  TYPE_ENTITY = 'ENTITY'.freeze,
  TYPE_COMPOSITE_ENTITY = 'COMPOSITE_ENTITY'.freeze,
  TYPE_ATTRIBUTE_REFERENCE = 'ATTRIBUTE_REFERENCE'.freeze,
  TYPE_BOOLEAN = 'BOOLEAN'.freeze
].freeze
TEMPORAL_PREFERENCE_ENUM =
[
  TEMPORAL_PREFERENCE_PAST = 'PAST'.freeze,
  TEMPORAL_PREFERENCE_FUTURE = 'FUTURE'.freeze,
  TEMPORAL_PREFERENCE_NEAREST = 'NEAREST'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ EntityAttribute

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/oci/oda/models/entity_attribute.rb', line 105

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.name = attributes[:'name'] if attributes[:'name']

  self.type = attributes[:'type'] if attributes[:'type']

  self.natural_language_mapping = attributes[:'naturalLanguageMapping'] if attributes[:'naturalLanguageMapping']

  raise 'You cannot provide both :naturalLanguageMapping and :natural_language_mapping' if attributes.key?(:'naturalLanguageMapping') && attributes.key?(:'natural_language_mapping')

  self.natural_language_mapping = attributes[:'natural_language_mapping'] if attributes[:'natural_language_mapping']

  self.is_multi_value = attributes[:'isMultiValue'] unless attributes[:'isMultiValue'].nil?

  raise 'You cannot provide both :isMultiValue and :is_multi_value' if attributes.key?(:'isMultiValue') && attributes.key?(:'is_multi_value')

  self.is_multi_value = attributes[:'is_multi_value'] unless attributes[:'is_multi_value'].nil?

  self.is_fuzzy_match = attributes[:'isFuzzyMatch'] unless attributes[:'isFuzzyMatch'].nil?

  raise 'You cannot provide both :isFuzzyMatch and :is_fuzzy_match' if attributes.key?(:'isFuzzyMatch') && attributes.key?(:'is_fuzzy_match')

  self.is_fuzzy_match = attributes[:'is_fuzzy_match'] unless attributes[:'is_fuzzy_match'].nil?

  self.is_invert_comparisons = attributes[:'isInvertComparisons'] unless attributes[:'isInvertComparisons'].nil?

  raise 'You cannot provide both :isInvertComparisons and :is_invert_comparisons' if attributes.key?(:'isInvertComparisons') && attributes.key?(:'is_invert_comparisons')

  self.is_invert_comparisons = attributes[:'is_invert_comparisons'] unless attributes[:'is_invert_comparisons'].nil?

  self.temporal_preference = attributes[:'temporalPreference'] if attributes[:'temporalPreference']

  raise 'You cannot provide both :temporalPreference and :temporal_preference' if attributes.key?(:'temporalPreference') && attributes.key?(:'temporal_preference')

  self.temporal_preference = attributes[:'temporal_preference'] if attributes[:'temporal_preference']

  self.entity_name = attributes[:'entityName'] if attributes[:'entityName']

  raise 'You cannot provide both :entityName and :entity_name' if attributes.key?(:'entityName') && attributes.key?(:'entity_name')

  self.entity_name = attributes[:'entity_name'] if attributes[:'entity_name']
end

Instance Attribute Details

#entity_nameString

Name of referenced entity.

Returns:

  • (String)


57
58
59
# File 'lib/oci/oda/models/entity_attribute.rb', line 57

def entity_name
  @entity_name
end

#is_fuzzy_matchBOOLEAN

Is the entity attribute a fuzzy match

Returns:

  • (BOOLEAN)


45
46
47
# File 'lib/oci/oda/models/entity_attribute.rb', line 45

def is_fuzzy_match
  @is_fuzzy_match
end

#is_invert_comparisonsBOOLEAN

Are comparisons inverted in the entity attribute

Returns:

  • (BOOLEAN)


49
50
51
# File 'lib/oci/oda/models/entity_attribute.rb', line 49

def is_invert_comparisons
  @is_invert_comparisons
end

#is_multi_valueBOOLEAN

Is the entity attribute multi-value

Returns:

  • (BOOLEAN)


41
42
43
# File 'lib/oci/oda/models/entity_attribute.rb', line 41

def is_multi_value
  @is_multi_value
end

#nameString

[Required] The name of an entity attribute

Returns:

  • (String)


30
31
32
# File 'lib/oci/oda/models/entity_attribute.rb', line 30

def name
  @name
end

#natural_language_mappingOCI::Oda::Models::EntityAttributeNaturalLanguageMapping



37
38
39
# File 'lib/oci/oda/models/entity_attribute.rb', line 37

def natural_language_mapping
  @natural_language_mapping
end

#temporal_preferenceString

Temporal preference of an attribute

Returns:

  • (String)


53
54
55
# File 'lib/oci/oda/models/entity_attribute.rb', line 53

def temporal_preference
  @temporal_preference
end

#typeString

[Required] The type of an entity attribute

Returns:

  • (String)


34
35
36
# File 'lib/oci/oda/models/entity_attribute.rb', line 34

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/oci/oda/models/entity_attribute.rb', line 60

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'type': :'type',
    'natural_language_mapping': :'naturalLanguageMapping',
    'is_multi_value': :'isMultiValue',
    'is_fuzzy_match': :'isFuzzyMatch',
    'is_invert_comparisons': :'isInvertComparisons',
    'temporal_preference': :'temporalPreference',
    'entity_name': :'entityName'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/oci/oda/models/entity_attribute.rb', line 76

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'type': :'String',
    'natural_language_mapping': :'OCI::Oda::Models::EntityAttributeNaturalLanguageMapping',
    'is_multi_value': :'BOOLEAN',
    'is_fuzzy_match': :'BOOLEAN',
    'is_invert_comparisons': :'BOOLEAN',
    'temporal_preference': :'String',
    'entity_name': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/oci/oda/models/entity_attribute.rb', line 175

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    name == other.name &&
    type == other.type &&
    natural_language_mapping == other.natural_language_mapping &&
    is_multi_value == other.is_multi_value &&
    is_fuzzy_match == other.is_fuzzy_match &&
    is_invert_comparisons == other.is_invert_comparisons &&
    temporal_preference == other.temporal_preference &&
    entity_name == other.entity_name
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/oci/oda/models/entity_attribute.rb', line 212

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


192
193
194
# File 'lib/oci/oda/models/entity_attribute.rb', line 192

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



201
202
203
# File 'lib/oci/oda/models/entity_attribute.rb', line 201

def hash
  [name, type, natural_language_mapping, is_multi_value, is_fuzzy_match, is_invert_comparisons, temporal_preference, entity_name].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



245
246
247
248
249
250
251
252
253
254
# File 'lib/oci/oda/models/entity_attribute.rb', line 245

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



239
240
241
# File 'lib/oci/oda/models/entity_attribute.rb', line 239

def to_s
  to_hash.to_s
end