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-2.6.2 lib/ddr/vocab/vocabulary.rb
ddr-models-2.6.1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.6.0 lib/ddr/vocab/vocabulary.rb
ddr-models-2.6.0.rc4 lib/ddr/vocab/vocabulary.rb
ddr-models-2.6.0.rc3 lib/ddr/vocab/vocabulary.rb
ddr-models-2.6.0.rc2 lib/ddr/vocab/vocabulary.rb
ddr-models-2.6.0.rc1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.5.3 lib/ddr/vocab/vocabulary.rb
ddr-models-2.5.2 lib/ddr/vocab/vocabulary.rb
ddr-models-2.5.1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.5.0 lib/ddr/vocab/vocabulary.rb
ddr-models-2.5.0.rc1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.16 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.15 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.14 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.13 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.12 lib/ddr/vocab/vocabulary.rb
ddr-models-2.4.11 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.8 lib/ddr/vocab/vocabulary.rb
ddr-models-3.0.7 lib/ddr/vocab/vocabulary.rb