W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > February 2011

Language options in rdf.rb

From: Alex Kremer <alex@entitylab.com>
Date: Sun, 27 Feb 2011 08:11:01 -0800
To: "public-rdf-ruby@w3.org" <public-rdf-ruby@w3.org>
Message-ID: <028F19FE-0CF0-4111-977E-1C9D4C0BDED6@entitylab.com>
Hi,

Apologies if the following seems very elementary, but here goes:

I'm trying to retrieve an abstract from a DBPedia page in English. The problem is it seems like rdf.rb thinks every result it gets back is english, even results in foreign languages:

graph = RDF::Graph.load("http://dbpedia.org/page/Vienna")
dbp = RDF::Vocabulary.new("http://dbpedia.org/ontology/")

query = RDF::Query.new(:article => {dbp.abstract => :abstract})
=> #<RDF::Query:0x1094812c8 @solutions=[], @options={}, @variables={}, @patterns=[#<RDF::Query::Pattern:0x84a40770(?article <http://dbpedia.org/ontology/abstract> ?abstract .)>]>
a = query.execute(graph)

a.first
<RDF::Query::Solution:0x84ba74d8({:abstract=>#<RDF::Literal:0x812bc7b8("Wien ist die Bundeshauptstadt der Republik \u00D6sterreich und zugleich eines der neun \u00F6sterreichischen (...shortened for brevity...) gefolgt von Z\u00FCrich und Genf an zweiter und dritter Stelle."@en)>, :article=>#<RDF::URI:0x81724044(http://dbpedia.org/resource/Vienna)>})>

As you can see, rdf.rb seems to think the language for the first abstract is english, when in fact it's german. If I query DBPedia via their SPARQL endpoint I do get correct results, so I am sure their data isn't the problem here. I tried to filter the solutions by language per http://rdf.rubyforge.org/RDF/Query/Solutions.html but since they're all tagged with @en, they all come back when I ask for English.

Does anyone have any idea what could be causing this or how to solve it? Am I querying wrong? If so, how would I structure the query to get the proper language result? 

Thanks in advance!

-Alex
Received on Monday, 28 February 2011 09:55:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 28 February 2011 09:55:08 GMT