lib/rdf/json/reader.rb
def parse_object(object)
      log_error("missing 'type' key in #{object.inspect}", exception: RDF::ReaderError) unless object.has_key?('type')
      log_error("missing 'value' key in #{object.inspect}", exception: RDF::ReaderError) unless object.has_key?('value')

      case type = object['type']
        when 'bnode'
          parse_node(object['value'])
        when 'uri'
          parse_uri(object['value'])
        when 'literal'
          literal = RDF::Literal.new(object['value'],
            language: object['lang'],
            datatype: object['datatype'],
            )
          literal.validate!     if validate?
          literal.canonicalize! if canonicalize?
          literal
        else
          log_error("expected 'type' to be 'bnode', 'uri', or 'literal', but got #{type.inspect}", exception: RDF::ReaderError)
      end
    rescue RDF::ReaderError
      nil
    end
##
# Parses an RDF/JSON object string into an RDF value.
#
# @param  [Hash{String => Object}] object
# @return [RDF::Value]
Parses an RDF/JSON object string into an RDF value.
Parses an RDF / JSON object string into an RDF value .
def parse_object(object)
      log_error("missing 'type' key in #{object.inspect}", exception: RDF::ReaderError) unless object.has_key?('type')
      log_error("missing 'value' key in #{object.inspect}", exception: RDF::ReaderError) unless object.has_key?('value')
      case type = object['type']
        when 'bnode'
          parse_node(object['value'])
        when 'uri'
          parse_uri(object['value'])
        when 'literal'
          literal = RDF::Literal.new(object['value'],
            language: object['lang'],
            datatype: object['datatype'],
            )
          literal.validate!     if validate?
          literal.canonicalize! if canonicalize?
          literal
        else
          log_error("expected 'type' to be 'bnode', 'uri', or 'literal', but got #{type.inspect}", exception: RDF::ReaderError)
      end
    rescue RDF::ReaderError
      nil
    end
def parse_object ( object ) log_error ( "missing 'type' key in #{object.inspect}" , exception : RDF :: ReaderError ) unless object . has_key? ( 'type' ) log_error ( "missing 'value' key in #{object.inspect}" , exception : RDF :: ReaderError ) unless object . has_key? ( 'value' ) case type = object [ 'type' ] when 'bnode' parse_node ( object [ 'value' ] ) when 'uri' parse_uri ( object [ 'value' ] ) when 'literal' literal = RDF :: Literal . new ( object [ 'value' ] , language : object [ 'lang' ] , datatype : object [ 'datatype' ] , ) literal . validate! if validate? literal . canonicalize! if canonicalize? literal else log_error ( "expected 'type' to be 'bnode', 'uri', or 'literal', but got #{type.inspect}" , exception : RDF :: ReaderError ) end rescue RDF :: ReaderError nil end
Parses an RDF/JSON object string into an RDF value.
Parses an RDF / JSON object string into an RDF value .
None
RDF::Value
object
None