Hello, i''m writing an application that needs geocoding information for locations outside of the US. I''m using the brainoff.com geocoding service mappoint = Net::HTTP.new(''brainoff.com'', 80) response = mappoint.get(''/geocoder/rest/?city=Gent,BE'') logger.debug response.body and the body of the response is in the following form : <rdf:RDF xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:rdf=" http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <geo:Point> <geo:long>3.7166667</geo:long> <geo:lat>51.05</geo:lat> </geo:Point> </rdf:RDF> Now my question is : how do i parse this RDF to get to the long and lat values ? Is there a library available or am i on my own to get to the long and lat values ? thanks for your help Werner -- ---------------------------------------------------------------------- ir. Werner Ramaekers Read my Blog at http://www.werner.be "May the source be with you." ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060201/e8c4dcd3/attachment.html
Technically that''s RDF/XML, and you should be able to parse it with any of Ruby''s XML libraries - REXML, XMLParser, libxml, etc. REXML is part of the standard Ruby distribution. On 2/1/06, Werner Ramaekers <werner.ramaekers@gmail.com> wrote:> > Hello, > > i''m writing an application that needs geocoding information for locations > outside of the US. > I''m using the brainoff.com geocoding service > > mappoint = Net::HTTP.new('' brainoff.com'', 80) > response = mappoint.get(''/geocoder/rest/?city=Gent,BE'') > logger.debug response.body > > and the body of the response is in the following form : > > <rdf:RDF xmlns:geo=" http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:rdf=" > http://www.w3.org/1999/02/22-rdf-syntax-ns#"> > <geo:Point> > <geo:long>3.7166667</geo:long> > <geo:lat>51.05</geo:lat> > </geo:Point> > </rdf:RDF> > > Now my question is : how do i parse this RDF to get to the long and lat > values ? > Is there a library available or am i on my own to get to the long and lat > values ? > > thanks for your help > > Werner > > -- > ---------------------------------------------------------------------- > ir. Werner Ramaekers > > Read my Blog at http://www.werner.be > "May the source be with you." > ---------------------------------------------------------------------- > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060201/7933d8bd/attachment.html
You could also take a look at Ruby integration with Redland if you want to do any Sparql related stuff with your RDF: http://librdf.org/docs/ruby.html Here is a good article if you are new to Sparql/Semantic Web with RDF as the underpinnings: http://www.xml.com/pub/a/2005/11/16/introducing-sparql-querying-semantic-web-tutorial.html On 2/1/06, Avdi Grimm <avdi.grimm@gmail.com> wrote:> > Technically that''s RDF/XML, and you should be able to parse it with any of > Ruby''s XML libraries - REXML, XMLParser, libxml, etc. REXML is part of the > standard Ruby distribution. > > On 2/1/06, Werner Ramaekers <werner.ramaekers@gmail.com> wrote: > > > Hello, > > > > i''m writing an application that needs geocoding information for > > locations outside of the US. > > I''m using the brainoff.com geocoding service > > > > mappoint = Net::HTTP.new('' brainoff.com'', 80) > > response = mappoint.get(''/geocoder/rest/?city=Gent,BE'') > > logger.debug response.body > > > > and the body of the response is in the following form : > > > > <rdf:RDF xmlns:geo=" http://www.w3.org/2003/01/geo/wgs84_pos#" > > xmlns:rdf=" http://www.w3.org/1999/02/22-rdf-syntax-ns#"> > > <geo:Point> > > <geo:long>3.7166667</geo:long> > > <geo:lat>51.05</geo:lat> > > </geo:Point> > > </rdf:RDF> > > > > Now my question is : how do i parse this RDF to get to the long and lat > > values ? > > Is there a library available or am i on my own to get to the long and > > lat values ? > > > > thanks for your help > > > > Werner > > > > -- > > ---------------------------------------------------------------------- > > ir. Werner Ramaekers > > > > Read my Blog at http://www.werner.be > > "May the source be with you." > > ---------------------------------------------------------------------- > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060201/b595504a/attachment-0001.html
There is also Rena[1] and Semitar[2] [1] http://raa.ruby-lang.org/project/rena/ [2] http://semitar.projects.semwebcentral.org/ I don''t recommend using just an XML parser for ingesting RDF. That''s sorta like using regex to parse HTML. It''s really better to deal with it as the graph model it is. Sure, it could be done solely with an XML parser in this simplistic case, and maybe that is pragmatically a fine way to go. I''ve often parsed HTML with regex too :) Erik On Feb 1, 2006, at 12:29 PM, Steve Longdo wrote:> You could also take a look at Ruby integration with Redland if you > want to do any Sparql related stuff with your RDF: > http://librdf.org/docs/ruby.html > > Here is a good article if you are new to Sparql/Semantic Web with > RDF as the underpinnings: > http://www.xml.com/pub/a/2005/11/16/introducing-sparql-querying- > semantic-web-tutorial.html > > On 2/1/06, Avdi Grimm <avdi.grimm@gmail.com> wrote: Technically > that''s RDF/XML, and you should be able to parse it with any of > Ruby''s XML libraries - REXML, XMLParser, libxml, etc. REXML is > part of the standard Ruby distribution. > > On 2/1/06, Werner Ramaekers <werner.ramaekers@gmail.com> wrote: > Hello, > > i''m writing an application that needs geocoding information for > locations outside of the US. > I''m using the brainoff.com geocoding service > > mappoint = Net::HTTP.new('' brainoff.com'', 80) > response = mappoint.get(''/geocoder/rest/?city=Gent,BE'') > logger.debug response.body > > and the body of the response is in the following form : > > <rdf:RDF xmlns:geo=" http://www.w3.org/2003/01/geo/wgs84_pos#" > xmlns:rdf=" http://www.w3.org/1999/02/22-rdf-syntax-ns#"> > <geo:Point> > <geo:long>3.7166667</geo:long> > <geo:lat>51.05</geo:lat> > </geo:Point> > </rdf:RDF> > > Now my question is : how do i parse this RDF to get to the long and > lat values ? > Is there a library available or am i on my own to get to the long > and lat values ? > > thanks for your help > > Werner > > -- > ---------------------------------------------------------------------- > ir. Werner Ramaekers > > Read my Blog at http://www.werner.be > "May the source be with you." > ---------------------------------------------------------------------- > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails