Hi all,

I’m using the Jena query builder from the Jena-extras and I was wondering if 
there was a way to add a SERVICE clause to a SelectBuilder object.

I’ve also tried adding the SERVICE clause to a Query object after calling 
builder.build(), but it seems like it’s only possible through the ARQ API using 
body.addElement(new ElementService("http://any.domain/sparql";, elementBlock)). 
The problem is that you can’t get the elementBlock from a Query object or 
SelectBuilder object.

My code right now looks like this:

SelectBuilder builder =

new

SelectBuilder()

.addPrefix(

"rdf"

,

"
http://www.w3.org/1999/02/22-rdf-syntax-ns#
"

)

.addPrefix(

"dbo"

,

"
http://dbpedia.org/ontology/
"

)

.addVar(

"?uri"

)

.addWhere(

"?uri"

,

"rdf:type"

,

"dbo:Company"

)

.setLimit(

100

)

;

Query query = builder.build()

;

System.

out

.println(query)

;

Is there a way to add a SERVICE clause using the query builder or are there 
known workarounds without resorting to the verbose ARQ API, or should I try and 
extend the SelectBuilder API myself?

Reply via email to