ruby-rdf / rdf-json Goto Github PK
View Code? Open in Web Editor NEWRDF.rb plugin for parsing/serializing RDF/JSON data.
Home Page: http://rubygems.org/gems/rdf-json
License: The Unlicense
RDF.rb plugin for parsing/serializing RDF/JSON data.
Home Page: http://rubygems.org/gems/rdf-json
License: The Unlicense
According to the docs RDF::Reader.for(:json)
should return RDF::JSON::Reader
but is returning nil instead.
It's time to change from the json_pure dependency to using the multi-json gem.
As a straightforward extension of strict RDF/JSON, consider implementing support for parsing CURIE predicates (e.g. "[foaf:name]" instead of "http://xmlns.com/foaf/0.1/name") in the RDF::JSON::Reader
class.
When I try to load a json file from an nyt example (http://data.nytimes.com/home/about.html), I get:
NoMethodError: undefined method `has_key?' for "2009-10-25":String
from /Library/Ruby/Gems/1.8/gems/rdf-json-0.1.0/lib/rdf/json/reader.rb:89:in `parse_object'
from /Library/Ruby/Gems/1.8/gems/rdf-json-0.1.0/lib/rdf/json/reader.rb:51:in `initialize'
from /Library/Ruby/Gems/1.8/gems/rdf-json-0.1.0/lib/rdf/json/reader.rb:50:in `each'
It seems that this gem is expecting a hash when iterating over array elements.
I've verified the same error occurs on any of the nyt json files i.e. http://data.nytimes.com/home/a.html
To reproduce this error, use ruby 1.8.6 and this code:
require 'rdf'
require 'rdf/json'
RDF::Graph.load "http://data.nytimes.com/60694995023816375851.json"
I'm new to rdf so feel free to correct me if the error is on nyt's side.
Thanks,
Gabriel
These specs should pass :
require 'rdf/json'
describe 'Extensions' do
it 'should serialize/unserialize a repository' do
repo = RDF::Repository.new
repo << RDF::Statement.new(RDF::URI('http://www.dsfs.com#pp'), RDF::DC.pop, RDF::Literal.new(42, :datatype => RDF::XSD.newtype))
str = repo.to_json
str.should be_an_instance_of(String)
JSON.parse(str).should be_an_instance_of(RDF::Repository)
end
it 'should serialize/unserialize a graph' do
repo = RDF::Graph.new
repo << RDF::Statement.new(RDF::URI('http://www.dsfs.com#pp'), RDF::DC.pop, RDF::Literal.new(42, :datatype => RDF::XSD.newtype))
str = repo.to_json
str.should be_an_instance_of(String)
JSON.parse(str).should be_an_instance_of(RDF::Graph)
end
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.