Sha256: bae7eb3fbce30c48d0bcbc41e0d3d52712fee5b0b00daa99a38e88cf8ccd3c3d

Contents?: true

Size: 933 Bytes

Versions: 13

Compression:

Stored size: 933 Bytes

Contents

require 'rdf/vocab'

module Ddr::Vocab
  class Vocabulary

    warn "[DEPRECATION] `#{self.name}` is deprecated."

    def self.label(rdf_vocabulary)
      case rdf_vocabulary.to_uri
      when RDF::Vocab::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::Vocab::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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ddr-core-1.17.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.16.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.15.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.14.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.13.2 lib/ddr/vocab/vocabulary.rb
ddr-core-1.13.1 lib/ddr/vocab/vocabulary.rb
ddr-core-1.13.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.12.2 lib/ddr/vocab/vocabulary.rb
ddr-core-1.12.1 lib/ddr/vocab/vocabulary.rb
ddr-core-1.12.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.11.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.10.0 lib/ddr/vocab/vocabulary.rb
ddr-core-1.9.0 lib/ddr/vocab/vocabulary.rb