Class: Valkyrie::Persistence::Solr::ModelConverter::SharedStringPropertyValue
- Inherits:
-
ValueMapper
- Object
- ValueMapper
- Valkyrie::Persistence::Solr::ModelConverter::SharedStringPropertyValue
- Defined in:
- lib/valkyrie/persistence/solr/model_converter.rb
Overview
Handles casting language-tagged strings when there are both language-tagged and non-language-tagged strings in Solr. Assumes English for non-language-tagged strings.
Instance Attribute Summary
Attributes inherited from ValueMapper
Class Method Summary collapse
-
.handles?(value) ⇒ Boolean
Determines whether or not a Property value is a String whether or not the Property has an RDF literal specifying the language tag.
Instance Method Summary collapse
-
#result ⇒ CompositeSolrRow
Constructs a CompositeSolrRow object with the language-tagged literal value.
Methods inherited from ValueMapper
Constructor Details
This class inherits a constructor from Valkyrie::ValueMapper
Class Method Details
.handles?(value) ⇒ Boolean
Determines whether or not a Property value is a String whether or not the Property has an RDF literal specifying the language tag
378 379 380 |
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 378 def self.handles?(value) value.is_a?(Property) && value.value.is_a?(String) && value.scope.find { |x| x.is_a?(::RDF::Literal) }.present? end |
Instance Method Details
#result ⇒ CompositeSolrRow
Constructs a CompositeSolrRow object with the language-tagged literal value
384 385 386 387 388 389 390 391 392 |
# File 'lib/valkyrie/persistence/solr/model_converter.rb', line 384 def result CompositeSolrRow.new( [ calling_mapper.for(Property.new(value.key, value.value)).result, calling_mapper.for(Property.new("#{value.key}_lang", "eng")).result, calling_mapper.for(Property.new("#{value.key}_type", "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")).result ] ) end |