Thanks Willie and Andy.

Works a treat now.

Phil.


On Fri, Jan 10, 2014 at 7:13 PM, Willie Milnor <[email protected]> wrote:

> You can just execute the query against the default model:
>
> Model model = ModelFactory.createDefaultModel();
> QueryExecution qexec = QueryExecutionFactory.create(query, model);
>
>
>
>
>
>
> On Fri, Jan 10, 2014 at 2:04 PM, Phil Ashworth <[email protected]>
> wrote:
>
> > Hi All
> >
> > Happy New Year.
> >
> > I've previously used the following code with success to call a sparql
> > endpoint.
> > final com.hp.hpl.jena.query.QueryExecution qexec =
> >
> com.hp.hpl.jena.query.QueryExecutionFactory.sparqlService(serviceUri,query)
> > ;
> >         final com.hp.hpl.jena.query.ResultSet tempresults  =
> > qexec.execSelect() ;
> >
> > This works well and has allowed me seperate the endpoint url from the
> > query.
> >
> > I would now like to handle queries which define the service clause in
> them
> > and without having to set the service uri specifically.
> > e.g
> > select * where
> > {
> >       SERVICE <sparqlepURL> {
> >         .....
> >        }
> > }
> >
> > I can't find an exact code example but I did find the documentation about
> > using the Syntax.syntaxARQ.
> > But it didn't say how to use it.
> >
> > So I tried the following
> > final com.hp.hpl.jena.query.QueryExecution qexec =
> >
> >
> com.hp.hpl.jena.query.QueryExecutionFactory.create(query,com.hp.hpl.jena.query.Syntax.syntaxARQ)
> > ;
> >     final com.hp.hpl.jena.query.ResultSet results  = qexec.execSelect() ;
> >
> > This throws the error
> >
> > com.hp.hpl.jena.query.QueryExecException: No dataset description for
> query
> >     at
> >
> >
> com.hp.hpl.jena.sparql.engine.QueryExecutionBase.prepareDataset(QueryExecutionBase.java:604)
> >     at
> >
> >
> com.hp.hpl.jena.sparql.engine.QueryExecutionBase.getPlan(QueryExecutionBase.java:547)
> > ................
> >
> >
> > I'm a little confused as to how this make it work.
> > There is no dataset to search here as it is an endpoint.
> >
> > If someone could suggest how to do this it would be appreciated
> >
> > Sorry for the dumb question.
> >
> > Phil
> >
>
>
>
> --
> Cheers,
> Willie
>

Reply via email to