- From: Sean Johnson <belucid@acm.org>
- Date: Fri, 07 Nov 2014 08:08:07 -0500
- To: public-linked-json@w3.org
- Message-ID: <077954FB-E83C-4099-AB68-67D22D8A2924@acm.org>
Hello, I'm curious about the value expansion implementation in the Ruby library, jsonld. In particular, the expanding of native types. Here's some tests from the library: "native boolean" => ["foo", true, {"@value" => true}], "native integer" => ["foo", 1, {"@value" => 1}], "native double" => ["foo", 1.1e1, {"@value" => 1.1E1}], "native date" => ["foo", Date.parse("2011-12-27"), {"@value" => "2011-12-27", "@type" => RDF::XSD.date.to_s}], "native time" => ["foo", Time.parse("10:11:12Z"), {"@value" => "10:11:12Z", "@type" => RDF::XSD.time.to_s}], "native dateTime" =>["foo", DateTime.parse("2011-12-27T10:11:12Z"), {"@value" => "2011-12-27T10:11:12Z", "@type" => RDF::XSD.dateTime.to_s}], Why does a native date, time and dateTime get expanded to include an @type, but a native integer does not? That seems inconsistent. And why does the @type get added in this case when the spec doesn't mention adding @type unless the active context includes a type mapping? http://www.w3.org/TR/json-ld-api/#value-expansion Similarly, I don't understand this value expansion behavior: %w(boolean integer string dateTime date time).each do |dt| it "expands datatype xsd:#{dt}" do expect(subject.expand_value("foo", RDF::XSD[dt])).to produce({"@id" => "http://www.w3.org/2001/XMLSchema##{dt}"}, @debug) end end If I'm translating the Ruby correctly, it's if the value is literally a Ruby type, then expand it to an IRI pointing to the W3C XML Schema IRI for the type. Again… I don't see any mention of that in the value expansion portion of the spec: http://www.w3.org/TR/json-ld-api/#value-expansion Thanks for the help! I'm just trying to ensure I do the right thing with value expansion and I'm confused by these differences in the spec and the Ruby implementation. Cheers, Sean
Received on Friday, 7 November 2014 14:42:57 UTC