Class: Ddr::Vocab::Vocabulary
- Inherits:
-
Object
- Object
- Ddr::Vocab::Vocabulary
- Defined in:
- lib/ddr/vocab/vocabulary.rb
Class Method Summary collapse
- .label(rdf_vocabulary) ⇒ Object
- .namespace_prefix(rdf_vocabulary) ⇒ Object
- .property_terms(rdf_vocabulary) ⇒ Object
- .term_name(rdf_vocabulary, term) ⇒ Object
- .term_names(rdf_vocabulary) ⇒ Object
Class Method Details
.label(rdf_vocabulary) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ddr/vocab/vocabulary.rb', line 8 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 |
.namespace_prefix(rdf_vocabulary) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/ddr/vocab/vocabulary.rb', line 17 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 |
.property_terms(rdf_vocabulary) ⇒ Object
26 27 28 |
# File 'lib/ddr/vocab/vocabulary.rb', line 26 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 |
.term_name(rdf_vocabulary, term) ⇒ Object
34 35 36 |
# File 'lib/ddr/vocab/vocabulary.rb', line 34 def self.term_name(rdf_vocabulary, term) term.to_s.gsub(rdf_vocabulary.to_uri.to_s, "").to_sym end |
.term_names(rdf_vocabulary) ⇒ Object
30 31 32 |
# File 'lib/ddr/vocab/vocabulary.rb', line 30 def self.term_names(rdf_vocabulary) self.property_terms(rdf_vocabulary).map { |term| self.term_name(rdf_vocabulary, term) } end |