Giter VIP home page Giter VIP logo

rdf-json's People

Contributors

artob avatar dkinzer avatar gkellogg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rdf-json's Issues

Unable to read NYT's JSON files

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

Should unserialize a JSON-serialized Repository to a Repository

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.