Sha256: f4d8dcdf0ebffc0fa175e824a11eace3e2592003ec140204843f74ded56043a0
Contents?: true
Size: 1.02 KB
Versions: 39
Compression:
Stored size: 1.02 KB
Contents
module Ddr::Models class MetadataVocabulary extend MetadataVocabularies attr_reader :rdf_vocab, :except, :only_properties # @param rdf_vocab [RDF::Vocabulary] an RDF vocabulary class # @param except [RDF::Vocabulary::Term, Array<RDF::Vocabulary::Term>] term(s) to exclude # @param only_properties [Boolean] whether to include only RDF properties # -- i.e., having RDF type http://www.w3.org/1999/02/22-rdf-syntax-ns#Property # -- default: true def initialize(rdf_vocab, except: nil, only_properties: true) @rdf_vocab = rdf_vocab @except = Array(except) @only_properties = only_properties end # @return [Array<RDF::Vocabulary::Term>] def terms @terms ||= rdf_properties.map { |term| MetadataTerm.new(term) } end private def rdf_properties props = rdf_vocab.properties if only_properties props.select! { |prop| prop.type.include?("http://www.w3.org/1999/02/22-rdf-syntax-ns#Property") } end props - except end end end
Version data entries
39 entries across 39 versions & 1 rubygems