lib/rdf/rdfxml/writer.rb
# Render a subject using `haml_template[:subject]`.
#
# The _subject_ template may be called either as a top-level element, or recursively under another element if the _rel_ local is not nil.
#
#  For RDF/XML, removes from predicates those that can be rendered as attributes, and adds the `:attr_props` local for the Haml template, which includes all attributes to be rendered as properties.
#
# Yields each predicate/property to be rendered separately (@see #render_property_value and `#render_property_values`).
#
# @param [Array<RDF::Resource>] subject
#   Subject to render
# @param [Array<RDF::Resource>] predicates
#   Predicates of subject. Each property is yielded for separate rendering.
# @param [Hash{Symbol => Object}] options Rendering options passed to Haml render.
# @option options [String] about (nil)
#   About description, a CURIE, URI or Node definition.
#   May be nil if no @about is rendered (e.g. unreferenced Nodes)
# @option options [String] resource (nil)
#   Resource description, a CURIE, URI or Node definition.
#   May be nil if no @resource is rendered
# @option options [String] rel (nil)
#   Optional @rel property description, a CURIE, URI or Node definition.
# @option options [String] typeof (nil)
#   RDF type as a CURIE, URI or Node definition.
#   If :about is nil, this defaults to the empty string ("").
# @option options [:li, nil] element (nil)
#   Render with &lt;li&gt;, otherwise with template default.
# @option options [String] haml (haml_template[:subject])
#   Haml template to render.
# @yield [predicate]
#   Yields each predicate
# @yieldparam [RDF::URI] predicate
# @yieldreturn [:ignored]
# @return String
#   The rendered document is returned as a string
# Return Haml template for document from `haml_template[:subject]`
Render a subject using `haml_template[:subject]`.
The _subject_ template may be called either as a top-level element, or recursively under another element if the _rel_ local is not nil.

For RDF/XML, removes from predicates those that can be rendered as attributes, and adds the `:attr_props` local for the Haml template, which includes all attributes to be rendered as properties.

Yields each predicate/property to be rendered separately (@see #render_property_value and `#render_property_values`).
Render a subject using ` haml_template [ : subject ] ` . The _subject_ template may be called either as a top - level element or recursively under another element if the _rel_ local is not nil . For RDF / XML removes from predicates those that can be rendered as attributes and adds the ` : attr_props ` local for the Haml template which includes all attributes to be rendered as properties . Yields each predicate / property to be rendered separately ( @see #render_property_value and ` #render_property_values ` ) .
def render_subject(subject, predicates, **options, &block)
      attr_props = if [:untyped, :typed].include?(@attributes)
        options[:property_values].inject({}) do |memo, (prop, values)|
          object = values.first
          if values.length == 1 &&
            object.literal? &&
            (object.plain? || @attributes == :typed) &&
            get_lang(object).nil?
            memo[get_qname(RDF::URI(prop))] = object.value
          end
          memo
        end
      else
        {}
      end
      predicates -= attr_props.keys.map {|k| expand_curie(k).to_s}
      super(subject, predicates, **options.merge(attr_props: attr_props), &block)
    end
def render_subject ( subject , predicates , ** options , & block ) attr_props = if [ :untyped , :typed ] . include? ( @attributes ) options [ :property_values ] . inject ( { } ) do | memo , ( prop , values ) | object = values . first if values . length == 1 && object . literal? && ( object . plain? || @attributes == :typed ) && get_lang ( object ) . nil? memo [ get_qname ( RDF :: URI ( prop ) ) ] = object . value end memo end else { } end predicates -= attr_props . keys . map { | k | expand_curie ( k ) . to_s } super ( subject , predicates , ** options . merge ( attr_props : attr_props ) , & block ) end
Render a subject using `haml_template[:subject]`.
Render a subject using ` haml_template [ : subject ] ` .
# extract those properties that can be rendered as attributes
None
:ignored
String The rendered document is returned as a string Return Haml template for document from `haml_template`
String The rendered document is returned as a string Return Haml template for document from ` haml_template `
:subject
subject
<not_specific>
predicates
<not_specific>
options
haml (haml_template[:subject]) Haml template to render.
haml ( haml_template [ : subject ] ) Haml template to render .
block
<not_specific>
<not_specific>
None
]
<not_specific>
Yields each predicate
Yields each predicate