Re: Some questions on sparql/client

I confess that I haven't really used SPARQL::Client much, even though I released the latest version; Ben can probably answer better.

Gregg Kellogg
Sent from my iPhone

On Oct 20, 2011, at 1:30 PM, "Jim Amsden" <jamsden@us.ibm.com<mailto:jamsden@us.ibm.com>> wrote:

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<https://sma-cqwebvm01.ratl.swg.usma.ibm.com/CRT/>
919-461-3689
<ATT00001.gif>

Received on Thursday, 20 October 2011 20:43:15 UTC