Class: ActiveFedora::RDFXMLWriter

Inherits:
RDF::RDFXML::Writer
  • Object
show all
Defined in:
lib/active_fedora/rdf_xml_writer.rb

Overview

an rdf:type assertion is present; this is incompatible with Fedora 3

Instance Method Summary collapse

Instance Method Details

#subject(subject, options = {}) ⇒ Nokogiri::XML::Element, {Namespace}

Display a subject.

If the Haml template contains an entry matching the subject’s rdf:type URI, that entry will be used as the template for this subject and it’s properties.

Examples:

Displays a subject as a Resource Definition:

<div typeof="rdfs:Resource" about="http://example.com/resource">
  <h1 property="dc:title">label</h1>
  <ul>
    <li content="2009-04-30T06:15:51Z" property="dc:created">2009-04-30T06:15:51+00:00</li>
  </ul>
</div>

Parameters:

  • subject (RDF::Resource)
  • options (Hash{Symbol => Object}) (defaults to: {})

Options Hash (options):

  • :element(:div) (:li, nil)

    Serialize using &lt;li&gt; rather than template default element

  • :rel (RDF::Resource) — default: nil

    Optional @rel property

Returns:

  • (Nokogiri::XML::Element, {Namespace})


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/active_fedora/rdf_xml_writer.rb', line 29

def subject(subject, options = {})
  return if is_done?(subject)

  subject_done(subject)

  properties = properties_for_subject(subject)
  typeof = type_of(properties[RDF.type.to_s], subject)
  prop_list = order_properties(properties)

  add_debug {"subject: #{curie.inspect}, typeof: #{typeof.inspect}, props: #{prop_list.inspect}"}

  render_opts = {:typeof => typeof, :property_values => properties}.merge(options)

  render_subject_template(subject, prop_list, render_opts)
end

#type_of(type, subject) ⇒ Object



45
46
47
# File 'lib/active_fedora/rdf_xml_writer.rb', line 45

def type_of(type, subject)
  ""
end