Sha256: 3be4b4fd90d9887671b8518441a3b6e64ab756f32483ad11afa7214d4be2ded3

Contents?: true

Size: 587 Bytes

Versions: 12

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module ControlledVocabularies
    class Location < ActiveTriples::Resource
      configure rdf_label: ::RDF::Vocab::GEONAMES.name

      include ResourceLabelCaching

      # Return a tuple of url & label
      def solrize
        label = full_label || rdf_label.first.to_s
        return [rdf_subject.to_s] if label.blank? || label == rdf_subject.to_s
        [rdf_subject.to_s, { label: "#{label}$#{rdf_subject}" }]
      end

      def full_label
        Hyrax::LocationService.new.full_label(rdf_subject.to_s)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyrax-5.0.0.rc1 lib/hyrax/controlled_vocabularies/location.rb
hyrax-3.6.0 lib/hyrax/controlled_vocabularies/location.rb
hyrax-4.0.0 lib/hyrax/controlled_vocabularies/location.rb
hyrax-4.0.0.rc3 lib/hyrax/controlled_vocabularies/location.rb
hyrax-4.0.0.rc2 lib/hyrax/controlled_vocabularies/location.rb
hyrax-4.0.0.rc1 lib/hyrax/controlled_vocabularies/location.rb
hyrax-3.5.0 lib/hyrax/controlled_vocabularies/location.rb
hyrax-4.0.0.beta2 lib/hyrax/controlled_vocabularies/location.rb
hyrax-3.4.2 lib/hyrax/controlled_vocabularies/location.rb
hyrax-4.0.0.beta1 lib/hyrax/controlled_vocabularies/location.rb
hyrax-3.4.1 lib/hyrax/controlled_vocabularies/location.rb
hyrax-3.4.0 lib/hyrax/controlled_vocabularies/location.rb