Sha256: 33e30379ed13c6a39aa67874c95879a700c640bce17efc8f9887d36b789f2815

Contents?: true

Size: 912 Bytes

Versions: 20

Compression:

Stored size: 912 Bytes

Contents

module Ddr
  module Metadata
    class Vocabulary

      def self.label(rdf_vocabulary)
        case rdf_vocabulary.to_uri
        when RDF::DC.to_uri
          "DC Terms"
        when DukeTerms.to_uri
          "Duke Terms"
        end
      end

      def self.namespace_prefix(rdf_vocabulary)
        case rdf_vocabulary.to_uri
        when RDF::DC.to_uri
          "dcterms"
        when DukeTerms.to_uri
          "duke"
        end
      end

      def self.property_terms(rdf_vocabulary)
        rdf_vocabulary.properties.select { |p| p.type.include?("http://www.w3.org/1999/02/22-rdf-syntax-ns#Property") }
      end

      def self.term_names(rdf_vocabulary)
        self.property_terms(rdf_vocabulary).map { |term| self.term_name(rdf_vocabulary, term) }
      end

      def self.term_name(rdf_vocabulary, term)
        term.to_s.gsub(rdf_vocabulary.to_uri.to_s, "").to_sym
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ddr-models-1.11.8 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.7 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.6 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.5 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.4 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.3 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.2 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.1 lib/ddr/metadata/vocabulary.rb
ddr-models-1.11.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.10.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.9.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.8.1 lib/ddr/metadata/vocabulary.rb
ddr-models-1.8.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.7.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.6.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.5.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.4.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.3.0 lib/ddr/metadata/vocabulary.rb
ddr-models-1.2.1 lib/ddr/metadata/vocabulary.rb
ddr-models-1.2.0 lib/ddr/metadata/vocabulary.rb