module ActiveFedora::RDFDatastream::ModelMethods::ClassMethods

def config

def config
  ActiveFedora::Predicates.predicate_config
end

def map_predicates(&block)

def map_predicates(&block)
  yield self
end

def method_missing(name, *args, &block)

def method_missing(name, *args, &block)
  args = args.first if args.respond_to? :first
  raise "mapping must specify RDF vocabulary as :in argument" unless args.has_key? :in
  vocab = args[:in]
  predicate = args.fetch(:to, name)
  raise "Vocabulary '#{vocab.inspect}' does not define property '#{predicate.inspect}'" unless vocab.respond_to? predicate
  indexing = false
  if block_given?
    # needed for solrizer integration
    indexing = true
    iobj = IndexObject.new
    yield iobj
    data_type = iobj.data_type
    behaviors = iobj.behaviors
  end
  # needed for AF::Predicates integration & drives all other
  # functionality below
  vocab = vocab.to_s
  name = self.prefix(name)
  if config
    if config[:predicate_mapping].has_key? vocab
      config[:predicate_mapping][vocab][name] = predicate
    else
      config[:predicate_mapping][vocab] = { name => predicate } 
    end
    # stuff data_type and behaviors in there for to_solr support
    config[:predicate_mapping][vocab]["#{name}type".to_sym] = data_type if indexing
    config[:predicate_mapping][vocab]["#{name}behaviors".to_sym] = behaviors if indexing
  else
    config = {
      :default_namespace => vocab,
      :predicate_mapping => {
        vocab => { name => predicate }
      }
    }
    # stuff data_type and behaviors in there for to_solr support
    config[:predicate_mapping][vocab]["#{name}type".to_sym] = data_type if indexing
    config[:predicate_mapping][vocab]["#{name}behaviors".to_sym] = behaviors if indexing
  end
end

def prefix(name)

def prefix(name)
  name = name.to_s unless name.is_a? String
  pre = self.to_s.sub(/RDFDatastream$/, '').underscore
  return "#{pre}__#{name}".to_sym
end

def rdf_subject &block

Other tags:
    Yield: - 'ds' is the datastream instance
def rdf_subject &block
  if block_given?
     return @subject_block = block
  end
  @subject_block ||= lambda { |ds| "info:fedora/#{ds.pid}" }
end

def register_vocabularies(*vocabs)

def register_vocabularies(*vocabs)
  @vocabularies ||= {}
  vocabs.each do |v|
    if v.is_a?(RDF::Vocabulary) or (v.respond_to? :property and v.respond_to? :to_uri)
      @vocabularies[v.to_uri] = v 
    else
      raise "not an RDF vocabulary: #{v}"
    end
  end
  ActiveFedora::Predicates.vocabularies(@vocabularies)
  @vocabularies
end