Class: Qa::LinkedData::Config::ContextMap

Inherits:
Object
  • Object
show all
Defined in:
app/models/qa/linked_data/config/context_map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context_map = {}, prefixes = {}) ⇒ ContextMap

Returns a new instance of ContextMap.

Examples:

context_map example

{
  "groups": {
    "dates": {
      "group_label_i18n": "qa.linked_data.authority.locnames_ld4l_cache.dates",
      "group_label_default": "Dates"
    }
  },
  "properties": [
    {
      "property_label_i18n": "qa.linked_data.authority.locgenres_ld4l_cache.authoritative_label",
      "property_label_default": "Authoritative Label",
      "ldpath": "madsrdf:authoritativeLabel",
      "selectable": true,
      "drillable": false
    },
    {
      "group_id": "dates",
      "property_label_i18n": "qa.linked_data.authority.locnames_ld4l_cache.birth_date",
      "property_label_default": "Birth",
      "ldpath": "madsrdf:identifiesRWO/madsrdf:birthDate/schema:label",
      "selectable": false,
      "drillable": false
    }
  ]
}

Parameters:

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

    that defines groups and properties for additional context to display during the selection process

  • shortcut (Hash)

    names for URI prefixes with key = part of predicate that is the same for all terms (e.g. { “madsrdf”: “www.loc.gov/mads/rdf/v1#” })

  • groups (Hash)

    a customizable set of options

Options Hash (context_map):

  • :groups (Hash) — default: optional

    predefine group ids and labels to be used in the properties section to group properties

  • :properties (Array<Hash>) — default: optional

    property maps defining how to get and display the additional context (if none, context will not be added)



42
43
44
45
46
47
# File 'app/models/qa/linked_data/config/context_map.rb', line 42

def initialize(context_map = {}, prefixes = {})
  @context_map = context_map
  @prefixes = prefixes
  extract_groups
  extract_properties
end

Instance Attribute Details

#propertiesObject (readonly)

Array<Qa::LinkedData::Config::ContextPropertyMap>

set of property map models



6
7
8
# File 'app/models/qa/linked_data/config/context_map.rb', line 6

def properties
  @properties
end

Instance Method Details

#group_label(group_id) ⇒ Object



49
50
51
# File 'app/models/qa/linked_data/config/context_map.rb', line 49

def group_label(group_id)
  groups[group_id]
end