Class: Ddr::Models::MetadataVocabulary

Inherits:
Object
  • Object
show all
Extended by:
MetadataVocabularies
Defined in:
lib/ddr/models/metadata/metadata_vocabulary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MetadataVocabularies

dc11, dcterms, duketerms

Constructor Details

#initialize(rdf_vocab, except: nil, only_properties: true) ⇒ MetadataVocabulary

Returns a new instance of MetadataVocabulary.

Parameters:

  • rdf_vocab (RDF::Vocabulary)

    an RDF vocabulary class

  • except (RDF::Vocabulary::Term, Array<RDF::Vocabulary::Term>) (defaults to: nil)

    term(s) to exclude

  • only_properties (Boolean) (defaults to: true)

    whether to include only RDF properties – i.e., having RDF type www.w3.org/1999/02/22-rdf-syntax-ns#Property – default: true



12
13
14
15
16
# File 'lib/ddr/models/metadata/metadata_vocabulary.rb', line 12

def initialize(rdf_vocab, except: nil, only_properties: true)
  @rdf_vocab = rdf_vocab
  @except = Array(except)
  @only_properties = only_properties
end

Instance Attribute Details

#exceptObject (readonly)

Returns the value of attribute except.



5
6
7
# File 'lib/ddr/models/metadata/metadata_vocabulary.rb', line 5

def except
  @except
end

#only_propertiesObject (readonly)

Returns the value of attribute only_properties.



5
6
7
# File 'lib/ddr/models/metadata/metadata_vocabulary.rb', line 5

def only_properties
  @only_properties
end

#rdf_vocabObject (readonly)

Returns the value of attribute rdf_vocab.



5
6
7
# File 'lib/ddr/models/metadata/metadata_vocabulary.rb', line 5

def rdf_vocab
  @rdf_vocab
end

Instance Method Details

#termsArray<RDF::Vocabulary::Term>

Returns:

  • (Array<RDF::Vocabulary::Term>)


19
20
21
# File 'lib/ddr/models/metadata/metadata_vocabulary.rb', line 19

def terms
  @terms ||= rdf_properties.map { |term| MetadataTerm.new(term) }
end