Class: Qa::LinkedData::Config::ContextPropertyMap
- Inherits:
-
Object
- Object
- Qa::LinkedData::Config::ContextPropertyMap
- Defined in:
- app/models/qa/linked_data/config/context_property_map.rb
Constant Summary collapse
- VALUE_ON_ERROR =
[].freeze
Instance Attribute Summary collapse
-
#group_id ⇒ Object
readonly
id that identifies which group the property should be in.
-
#label ⇒ Object
readonly
id that identifies which group the property should be in.
Instance Method Summary collapse
-
#drillable? ⇒ Boolean
Can this property be used as a new query.
-
#expand_uri? ⇒ Boolean
Should this URI value be expanded to include its label?.
-
#expanded_values(graph, subject_uri) ⇒ Array<Hash>
Values of this property for a specfic subject URI with URI values expanded to include id and label.
- #group? ⇒ Boolean
-
#initialize(property_map = {}, prefixes = {}) ⇒ ContextPropertyMap
constructor
A new instance of ContextPropertyMap.
-
#selectable? ⇒ Boolean
Can this property be the selected value?.
-
#values(graph, subject_uri) ⇒ Array<String>
Values of this property for a specfic subject URI.
Constructor Details
#initialize(property_map = {}, prefixes = {}) ⇒ ContextPropertyMap
Returns a new instance of ContextPropertyMap.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 33 def initialize(property_map = {}, prefixes = {}) @property_map = property_map @group_id = Qa::LinkedData::Config::Helper.fetch_symbol(property_map, :group_id, nil) @label = extract_label @ldpath = Qa::LinkedData::Config::Helper.fetch_required(property_map, :ldpath, false) @selectable = Qa::LinkedData::Config::Helper.fetch_boolean(property_map, :selectable, false) @drillable = Qa::LinkedData::Config::Helper.fetch_boolean(property_map, :drillable, false) @expansion_label_ldpath = Qa::LinkedData::Config::Helper.fetch(property_map, :expansion_label_ldpath, nil) @expansion_id_ldpath = Qa::LinkedData::Config::Helper.fetch(property_map, :expansion_id_ldpath, nil) @prefixes = prefixes end |
Instance Attribute Details
#group_id ⇒ Object (readonly)
id that identifies which group the property should be in
10 11 12 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 10 def group_id @group_id end |
#label ⇒ Object (readonly)
id that identifies which group the property should be in
10 11 12 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 10 def label @label end |
Instance Method Details
#drillable? ⇒ Boolean
Can this property be used as a new query
53 54 55 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 53 def drillable? @drillable end |
#expand_uri? ⇒ Boolean
Should this URI value be expanded to include its label?
63 64 65 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 63 def expansion_label_ldpath.present? end |
#expanded_values(graph, subject_uri) ⇒ Array<Hash>
Values of this property for a specfic subject URI with URI values expanded to include id and label.
81 82 83 84 85 86 87 88 89 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 81 def (graph, subject_uri) values = values(graph, subject_uri) return values unless return values unless values.respond_to? :map! values.map! do |uri| { uri: uri, id: expansion_id(graph, uri), label: expansion_label(graph, uri) } end values end |
#group? ⇒ Boolean
57 58 59 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 57 def group? group_id.present? end |
#selectable? ⇒ Boolean
Can this property be the selected value?
47 48 49 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 47 def selectable? @selectable end |
#values(graph, subject_uri) ⇒ Array<String>
Values of this property for a specfic subject URI
69 70 71 |
# File 'app/models/qa/linked_data/config/context_property_map.rb', line 69 def values(graph, subject_uri) ldpath_evaluate(basic_program, graph, subject_uri) end |