lib/rdf/json/writer.rb
##
# Stores the RDF/JSON representation of a triple.
#
# @param  [RDF::Resource] subject
# @param  [RDF::URI]      predicate
# @param  [RDF::Value]    object
# @return [void]
# @see    #write_epilogue
Stores the RDF/JSON representation of a triple.
Stores the RDF / JSON representation of a triple .
def write_triple(subject, predicate, object)
      s = subject.to_s
      p = predicate.to_s
      o = object.is_a?(RDF::Value) ? object : RDF::Literal.new(object)
      @json       ||= {}
      @json[s]    ||= {}
      @json[s][p] ||= []
      @json[s][p] << o.to_rdf_json
    end
def write_triple ( subject , predicate , object ) s = subject . to_s p = predicate . to_s o = object . is_a? ( RDF :: Value ) ? object : RDF :: Literal . new ( object ) @json ||= { } @json [ s ] ||= { } @json [ s ] [ p ] ||= [ ] @json [ s ] [ p ] << o . to_rdf_json end
Stores the RDF/JSON representation of a triple.
Stores the RDF / JSON representation of a triple .
None
void
subject
predicate
object
None
see
None