select.where clause

Hi there,

recently getting into ruby and rdf, I am now running queries with
sparql-client and its pretty sweet.

Up to now, I just lazyly pass the query as a string to the client, but I
what to define the select clause properly.

##Starting from here (this works fine),
client = SPARQL::Client.new(target)
result = client.select.where(
	"SELECT distinct ?herp ?derp WHERE {
	?herp <http://www.w3.org/2000/01/rdf-schema#comment> ?derp.
} LIMIT 5"
)
result.each do |asolution|
asolution.each {|key, value| puts "#{ key} has value #{value}" }
end
##

Starting from the documentation I tried some stuff like this but.. what
am I doing wrong here?

s1 = RDF::Query::Variable.new(:herp)
p1 = RDF::Query::Variable.new(:p1,
"<http://www.w3.org/2000/01/rdf-schema#comment>")
o1 = RDF::Query::Variable.new(:derp)
result = client.select.where([:herp, :p1, :derp]).limit(5)

Regards
Peter

Received on Friday, 13 April 2012 08:11:14 UTC