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

Some questions on sparql/client

From: Jim Amsden <jamsden@us.ibm.com>
Date: Thu, 20 Oct 2011 10:29:37 -0400
To: public-rdf-ruby@w3.org
Message-ID: <OF3DF7F7A1.CFBFDE77-ON8525792F.004E6CCF-8525792F.004F9EFF@us.ibm.com>
I'm doing some experimenting with RDF.rb and sparql-client. I ran into a 
couple of problems, possibly because I'm just not understanding how to use 
the APIs. 

1. Distinct not working:

query = sparql.select.where([:thing, RDF.type, 
:type]).order_by(:type).distinct

The query has duplicates whether distinct is called or not. The query look 
right (has the distinct keyword) and executing:

query = 'SELECT DISTINCT ?type WHERE { ?thing a ?type . } ORDER BY ?type'

works properly.

2. Construct not working?

query2 = sparql.construct([:s, :s, :o]).where([:s, :p, :o]).limit(10)

doesn't return any statements. Nor does 

query2 = sparql.query("construct {?s ?p o} where {?s ?p ?o} limit 10")

But if I execute the construct through RestClient.post endpoint :query => 
"construct {?s ?p o} where {?s ?p ?o} limit 10"

does return RDF/XML that I can parse into an RDF:Graph


Jim Amsden, Senior Technical Staff Member
Unleash the Labs Solution Architect for Rational EA and ADC Tools
Make a new ULL Request
919-461-3689





picture
(image/gif attachment: 01-part)

Received on Thursday, 20 October 2011 20:29:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 20 October 2011 20:29:57 GMT