Some questions on sparql/client

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

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