lib/rdf/json/reader.rb in rdf-json-3.1.0 vs lib/rdf/json/reader.rb in rdf-json-3.2.0
- old
+ new
@@ -4,25 +4,25 @@
#
# @example Loading RDF/JSON parsing support
# require 'rdf/json'
#
# @example Obtaining an RDF/JSON reader class
- # RDF::Reader.for(:json) #=> RDF::JSON::Reader
- # RDF::Reader.for("etc/doap.json")
- # RDF::Reader.for(:file_name => "etc/doap.json")
- # RDF::Reader.for(:file_extension => "json")
- # RDF::Reader.for(:content_type => "application/json")
+ # RDF::Reader.for(:rj) #=> RDF::JSON::Reader
+ # RDF::Reader.for("etc/doap.rj")
+ # RDF::Reader.for(:file_name => "etc/doap.rj")
+ # RDF::Reader.for(:file_extension => "rj")
+ # RDF::Reader.for(:content_type => "application/rj")
#
# @example Parsing RDF statements from an RDF/JSON file
- # RDF::JSON::Reader.open("etc/doap.json") do |reader|
+ # RDF::JSON::Reader.open("etc/doap.rj") do |reader|
# reader.each_statement do |statement|
# puts statement.inspect
# end
# end
#
# @example Parsing RDF statements from an RDF/JSON string
- # data = StringIO.new(File.read("etc/doap.json"))
+ # data = StringIO.new(File.read("etc/doap.rj"))
# RDF::JSON::Reader.new(data) do |reader|
# reader.each_statement do |statement|
# puts statement.inspect
# end
# end
@@ -93,13 +93,13 @@
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 = 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)