- From: Franco Rondini <rondinif@yahoo.it>
- Date: Wed, 10 Aug 2011 10:45:50 +0200
- To: Gregg Kellogg <gregg@kellogg-assoc.com>
- Cc: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>, Marcel Otto <marcelotto@gmx.de>
- Message-Id: <3D5EF2D2-FAAA-4F1E-A3CD-63E53A8B47A2@yahoo.it>
Thank you very much, was actually pretty trivial, but I could not find the solution by myself following the documentation. Now everything works fine ruby-1.9.2-p290 :008 > uri = RDF::URI.new("/Users/ronda/Downloads/owl.owl") => #<RDF::URI:0x806f6820(/Users/ronda/Downloads/owl.owl)> ruby-1.9.2-p290 :009 > g2 = RDF::Graph.load(uri, :format => :rdfxml) Ronda filename:/Users/ronda/Downloads/owl.owl => #<RDF::Graph:0x806ce668(/Users/ronda/Downloads/owl.owl)> ruby-1.9.2-p290 :010 > g2.count => 450 ruby-1.9.2-p290 :013 > g2 = RDF::Graph.load("/Users/ronda/Downloads/opencyc-2009-04-07-readable.owl", :format => :rdfxml) Ronda filename:/Users/ronda/Downloads/opencyc-2009-04-07-readable.owl => #<RDF::Graph:0x80e400f4(/Users/ronda/Downloads/opencyc-2009-04-07-readable..owl)> ruby-1.9.2-p290 :014 > g2.count => 1954696 My intention is to try out some queries to a file quite large (185.815.778 bytes), on which I can not work well with protecting the value of raising the memory heap to the max, ..linkeddata Graph.load take a while (about 30' ) till now works and left some free memory (800Mb) I hope let me the ability to query the ontology thanks again, regards. Franco Il giorno 09/ago/2011, alle ore 21.00, Gregg Kellogg ha scritto: > On Aug 9, 2011, at 11:49 AM, Franco Rondini wrote: > >> excuse me if the problem may seem trivial but I'm still not able to load a Graph from a owl file directly stored on the local filesystem. Can you help me to point the right direction? >> >> ### attempt N.1 >> from /Users/ronda/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>' >> ruby-1.9.2-p290 :038 > uri = RDF::URI.new(:scheme => 'file', :path => 'owl.owl', :host => '/Users/ronda/Downloads') >> => #<RDF::URI:0x80fc6004(file:///Users/ronda/Downloads/owl.owl)> >> ruby-1.9.2-p290 :039 > g2 = RDF::Graph.load( uri ) >> Errno::ENOENT: No such file or directory - file:///Users/ronda/Downloads/owl.owl > > The RDF::URI.new syntax you use here would seem to be for Addressable::URI, not RDF::URI. RDF::URI.new takes a String, or #to_s. > >> ### attempt N.2 >> ruby-1.9.2-p290 :029 > g3 = RDF::Graph.load("/Users/ronda/Downloads/owl.owl") >> Ronda filename:/Users/ronda/Downloads/owl.owlRDF::FormatError: unknown RDF format: {:base_uri=>#<RDF::URI:0x82c96ae4(/Users/ronda/Downloads/owl.owl)>, :file_name=>"/Users/ronda/Downloads/owl.owl"} > > RDF::Graph.load takes hints from the path name, file extension and mime-type. In this case, it can't associate the file extension ".owl" with an appropriate reader. You can tell it what reader to use using :format, or set the :mime_type explicitly. Try the following: > > g3 = RDF::Graph.load("/Users/rohnda/Downloads/owl.owl", :format => :rdfxml) > > In a separate project, I have an RDF::All::Reader, which will sniff the input and choose one or more readers to use based upon the detected types. At some point, we'll roll that into the linkeddata gem. > > RDF::Graph.load() takes options like RDF::Reader.for() and RDF::Reader.new(). > >> orks fine from http >> ruby-1.9.2-p290 :004 > g = RDF::Graph.load( RDF::OWL ) >> => #<RDF::Graph:0x81469084(http://www.w3.org/2002/07/owl#)> >> ruby-1.9.2-p290 :005 > g.count # => 450 > > Yes, this is because they're returning an appropriate mime-type when you download file file, note the application/rdf+xml in the content-type below. > >> the file used for the tests is obtaineid this way: >> [ 02:55:46 ] > cd ~/Downloads/ >> [ ronda@MacBook-di-Franco-Rondini.local ~/Downloads ] >> [ 08:37:31 ] > wget http://www.w3.org/2002/07/owl >> --2011-08-09 20:37:49-- http://www.w3.org/2002/07/owl >> Resolving www.w3.org... 128.30.52.37 >> Connecting to www.w3.org|128.30.52.37|:80... connected. >> HTTP request sent, awaiting response... 200 OK >> Length: 31861 (31K) [application/rdf+xml] >> Saving to: `owl.1' >>
Attachments
- text/html attachment: stored
- image/png attachment: Schermata_2011-08-10_a_10.34.20.png
Received on Thursday, 11 August 2011 22:39:41 UTC