Forum: Ruby on Rails Parsing RDF coming from a URL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ad3896932739fdb501adb67356d6b2d8?d=identicon&s=25 Werner Ramaekers (Guest)
on 2006-02-01 15:56
(Received via mailing list)
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."
Fea3202718832fe11a0db6bb44a5cc37?d=identicon&s=25 Avdi Grimm (Guest)
on 2006-02-01 17:48
(Received via mailing list)
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.
5ce55767684e0cd1727db2b8b8975640?d=identicon&s=25 Steve Longdo (Guest)
on 2006-02-01 18:30
(Received via mailing list)
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-sp...
4d6a47158a7c8a032e5f6a4da8976d7d?d=identicon&s=25 Erik Hatcher (Guest)
on 2006-02-02 16:54
(Received via mailing list)
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
This topic is locked and can not be replied to.