lib/ddr/vocab/rdf_vocabulary_parser.rb in ddr-models-2.11.0 vs lib/ddr/vocab/rdf_vocabulary_parser.rb in ddr-models-3.0.0.alpha.1

- old
+ new

@@ -1,43 +1,45 @@ require 'rdf/rdfxml' -module Ddr::Vocab - class RDFVocabularyParser +module Ddr + module Vocab + class RDFVocabularyParser - attr_reader :source, :prefix + attr_reader :source, :prefix - def initialize(source, prefix = "") - @source = source - @prefix = prefix - end + def initialize(source, prefix = "") + @source = source + @prefix = prefix + end - def term_names - @term_names ||= terms.collect { |t| t[:resource].to_s.sub(prefix, "") }.freeze - end + def term_names + @term_names ||= terms.collect { |t| t[:resource].to_s.sub(prefix, "") }.freeze + end - def term_symbols - term_names.map(&:to_sym) - end + def term_symbols + term_names.map(&:to_sym) + end - def terms - properties.map(&:to_hash) - end + def terms + properties.map(&:to_hash) + end - def properties - RDF::Query.execute(graph, properties_query) - end + def properties + RDF::Query.execute(graph, properties_query) + end - def properties_query - {:resource => { - RDF.type => RDF.Property, - RDF::RDFS.label => :label, - RDF::RDFS.comment => :comment - } - } - end + def properties_query + {:resource => { + RDF.type => RDF.Property, + RDF::RDFS.label => :label, + RDF::RDFS.comment => :comment + } + } + end - def graph - @graph ||= RDF::Graph.load(source).freeze - end + def graph + @graph ||= RDF::Graph.load(source).freeze + end + end end end