Sha256: 41ad4d0367a47bd40f0da4d38bf3c6f830b6be823598fb35c63bb05f6d331af9

Contents?: true

Size: 910 Bytes

Versions: 113

Compression:

Stored size: 910 Bytes

Contents

module Ddr
  module Vocab
    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

113 entries across 113 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.17 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.16 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.15 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.14 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.13 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.12 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.11 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.7 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.6 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.5 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.10 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.9 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.8 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.7 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.4 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.6 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.3 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.2 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.0.beta.4 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.1 lib/ddr/vocab/vocabulary.rb