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.1.1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.1.0 lib/ddr/vocab/vocabulary.rb
ddr-models-2.1.0.rc2 lib/ddr/vocab/vocabulary.rb
ddr-models-2.1.0.rc1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.rc6 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.rc5 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.rc4 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.rc3 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.rc2 lib/ddr/vocab/vocabulary.rb
ddr-models-1.17.1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.rc1 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.pre.5 lib/ddr/vocab/vocabulary.rb
ddr-models-1.17.0 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.pre.4 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.pre.3 lib/ddr/vocab/vocabulary.rb
ddr-models-1.16.2 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.pre.2 lib/ddr/vocab/vocabulary.rb
ddr-models-2.0.0.pre.1 lib/ddr/vocab/vocabulary.rb