You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by Danny Ayers <da...@gmail.com> on 2014/08/23 18:31:53 UTC

Configuring SPARQL (Query & Update)

Hi Hasan, everyone,

I'm working on a module [1] intended to plug in to the Fusepool extension
of Stanbol. It's a feed reader back by an RDF store, the store being
addressed entirely through SPARQL (over HTTP).

I developed the app outside of OSGi and am now in the process of
integrating. I have been using a Fuseki store/endpoint but need to move
this over to using Stanbol/Clerezza's SPARQL facilities.

So what I'd like to know is how to set up SPARQL endpoints. The config I've
got for Fuseki is below, essentially I need a dataset in a TDB-like store
that supports named graphs, accessed via SPARQL query (GET) & update (POST).
There's an example of the kind of update I'm doing at [2] - it's actually a
freemarker template with simple placeholder substitution, but the SPARQL is
pretty clear.

Right now with a running Fusepool/Stanbol, pointing a browser at
http://localhost:8080/query?sparql=
gives the kind of SPARQL parsing error you'd expect, but giving it a
genuine query leads to a HTTP 500.

Any help greatly appreciated.

Cheers,
Danny.

## ---------------------------------------------------------------  ##
Updatable in-memory dataset.
 <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
http://host:port/feedreader  fuseki:name "feedreader" ;
  # SPARQL query services e.g.
http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
"sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
"update" ; # SPARQL query service -- /feedreader/update
  # Upload service -- http://host:port/feedreader/upload?graph=default or
?graph=URI or ?default  # followed by a multipart body, each part being RDF
syntax.  # Syntax determined by the file name extension.  fuseki:serviceUpload
"upload" ; # Non-SPARQL upload service
  # SPARQL Graph store protocol (read and write)  # GET, PUT, POST DELETE
to http://host:port/feedreader/data?graph= or ?default=
fuseki:serviceReadWriteGraphStore
"data" ;
  # A separate read-only graph store endpoint:  fuseki:serviceReadGraphStore
"get" ; # Graph store protocol (read only) -- /feedreader/get
  fuseki:dataset <#emptyDataset> ;  .
 ## In-memory, initially empty.  <#emptyDataset> rdf:type ja:RDFDataset .  ##
------------------------------------------------------------------
[1] https://github.com/danja/NewsMonitor

[2]
https://github.com/danja/NewsMonitor/blob/master/src/main/resources/templates/html/it/danja/newsmonitor/resource/update-links.ftl

Re: Configuring SPARQL (Query & Update)

Posted by Danny Ayers <da...@gmail.com>.
On 27 August 2014 16:41, Reto Gmür <re...@apache.org> wrote:

> On Wed, Aug 27, 2014 at 4:13 PM, Danny Ayers <da...@gmail.com>
> wrote:
>
> > On 27 August 2014 12:37, Reto Gmür <re...@apache.org> wrote:
> >
> > >
> > > As I wrote, having the component taking care of accessing the triple
> > store
> > > by being individually configured to use a sparql endpoint is nonsense
> in
> > my
> > > opinion. Using a hardcoded default password even more.
> > >
> > >
> > > In the short term, this is the easiest way of getting my app running in
> > the Fusepool/Stanbol environment. Later I can look at accessing the
> > TcManager through OSGi, for sure. But while auth issues are a big
> > complication, I don't see any problem with the general idea in principle.
> >
> >
> > >What do you mean by totally remote? A Sparql enpoint accessed via HTTP
> is
> > > remote by default.
> > >
> >
> > Running on a seperate server, outside of the OSGi environment. There
> would
> > be certain advantages to this, splitting up the workload being the big
> one.
> > And disadvantages, like the auth stuff.
> >
> Again, if you are accessing graphs available via TcManager you should not
> use HTTP. The distribution that you can have the triple store on a "totally
> remote" server is provided by TcManager. The app should not care about
> this.
>

Ah, right, sounds like TcManager can do a lot more than I imagined. Will
have to read up...

>
> What you are doing is like not taking the stairs in the building, but
> exiting though the window and accessing the first floor with a ladder. Of
> course not without having disabled the alarm before leaving the building
> and breaking into the first floor.
>

Lol, nice analogy. Though I'd picture it as more exiting through the front
door and either being able to go up the fire escape or into a completely
different building. I do see the advantage of being able to use the stairs
inside though...

>
>
> >
> > >
> > >
> > > Are you using any clerezza features? If you just need the SPARQl
> endpoint
> > > it might be more straight forward to have a separate application in its
> > own
> > > OSGi container.
> >
> >
> > It's a bit further down the road, but I want to be able to make use of
> > Stanbol for entity extraction, enhancement etc.
> >
> Link the data NewsMonitor
> > pulls in with other content, throw it in the pool. But as you say,
> having a
> > separate application is another option. Maven profiles might be able to
> > help there.
> >
>
> I would not recommend maven profiles to create different apps. Rather I'd
> recommend to have different maven projects, e.g. "commons", "standalone"
> and "bundle", the bulk of the code would be in "commons", "bundle" would
> provide the few lines to place a query via TcManager and "standalone" would
> provide some more lines to make a remote request and parse the result.
> Obvioulsy one pom creates a runnable jar and another a deployable bundle.
>

Ok, that makes sense, does sound more manageable.

Cheers,
Danny.

Re: Configuring SPARQL (Query & Update)

Posted by Reto Gmür <re...@apache.org>.
On Wed, Aug 27, 2014 at 4:13 PM, Danny Ayers <da...@gmail.com> wrote:

> On 27 August 2014 12:37, Reto Gmür <re...@apache.org> wrote:
>
> >
> > As I wrote, having the component taking care of accessing the triple
> store
> > by being individually configured to use a sparql endpoint is nonsense in
> my
> > opinion. Using a hardcoded default password even more.
> >
> >
> > In the short term, this is the easiest way of getting my app running in
> the Fusepool/Stanbol environment. Later I can look at accessing the
> TcManager through OSGi, for sure. But while auth issues are a big
> complication, I don't see any problem with the general idea in principle.
>
>
> >What do you mean by totally remote? A Sparql enpoint accessed via HTTP is
> > remote by default.
> >
>
> Running on a seperate server, outside of the OSGi environment. There would
> be certain advantages to this, splitting up the workload being the big one.
> And disadvantages, like the auth stuff.
>
Again, if you are accessing graphs available via TcManager you should not
use HTTP. The distribution that you can have the triple store on a "totally
remote" server is provided by TcManager. The app should not care about this.

What you are doing is like not taking the stairs in the building, but
exiting though the window and accessing the first floor with a ladder. Of
course not without having disabled the alarm before leaving the building
and breaking into the first floor.


>
> >
> >
> > Are you using any clerezza features? If you just need the SPARQl endpoint
> > it might be more straight forward to have a separate application in its
> own
> > OSGi container.
>
>
> It's a bit further down the road, but I want to be able to make use of
> Stanbol for entity extraction, enhancement etc.
>
Link the data NewsMonitor
> pulls in with other content, throw it in the pool. But as you say, having a
> separate application is another option. Maven profiles might be able to
> help there.
>

I would not recommend maven profiles to create different apps. Rather I'd
recommend to have different maven projects, e.g. "commons", "standalone"
and "bundle", the bulk of the code would be in "commons", "bundle" would
provide the few lines to place a query via TcManager and "standalone" would
provide some more lines to make a remote request and parse the result.
Obvioulsy one pom creates a runnable jar and another a deployable bundle.

Cheers,
Reto

>
> Ceers,
> Danny.
>

Re: Configuring SPARQL (Query & Update)

Posted by Danny Ayers <da...@gmail.com>.
On 27 August 2014 12:37, Reto Gmür <re...@apache.org> wrote:

>
> As I wrote, having the component taking care of accessing the triple store
> by being individually configured to use a sparql endpoint is nonsense in my
> opinion. Using a hardcoded default password even more.
>
>
> In the short term, this is the easiest way of getting my app running in
the Fusepool/Stanbol environment. Later I can look at accessing the
TcManager through OSGi, for sure. But while auth issues are a big
complication, I don't see any problem with the general idea in principle.


What do you mean by totally remote? A Sparql enpoint accessed via HTTP is
> remote by default.
>

Running on a seperate server, outside of the OSGi environment. There would
be certain advantages to this, splitting up the workload being the big one.
And disadvantages, like the auth stuff.

>
>
> Are you using any clerezza features? If you just need the SPARQl endpoint
> it might be more straight forward to have a separate application in its own
> OSGi container.


It's a bit further down the road, but I want to be able to make use of
Stanbol for entity extraction, enhancement etc. Link the data NewsMonitor
pulls in with other content, throw it in the pool. But as you say, having a
separate application is another option. Maven profiles might be able to
help there.

Ceers,
Danny.

Re: Configuring SPARQL (Query & Update)

Posted by Reto Gmür <re...@apache.org>.
On Wed, Aug 27, 2014 at 12:15 PM, Danny Ayers <da...@gmail.com> wrote:

> On 27 August 2014 09:41, Reto Gmür <re...@apache.org> wrote:
>
> > On Tue, Aug 26, 2014 at 6:07 PM, Danny Ayers <da...@gmail.com>
> > wrote:
> >
> > >
> >
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html
> > >
> > > but I'm still getting the 401 challenge, so I guess I'll try doing the
> > > regular two-step auth.
> >
> > I think I'm now making progress there...
>
>
> > > >
> > > > But if you're application is running in OSGi you definitively
> shouldn't
> > > do
> > > > this. You don't want to have to configure your app to store the
> > password
> > > of
> > > > the instance it is running on (and need to reconfigure it, wehn the
> > > > password is changed).
> > >
> > >
> > > Hmm, I see your point, but what if an account is set up, reserved for
> the
> > > app, on install, wouldn't that be feasible?
> > >
> > Well you app could set up an account for its own access. It would still
> > need to store the (random) password it set for its user on disk, which is
> > not ideal but certainly better than requiring the user to provide the
> > password.
> >
>
> Right. I reckon for now I'll go this route. In fact until I've got the
> thing running integrated, I'll just use the default admin/admin. Can look
> at improving things later.
>

As I wrote, having the component taking care of accessing the triple store
by being individually configured to use a sparql endpoint is nonsense in my
opinion. Using a hardcoded default password even more.


> >
> >
> > >
> > > I would prefer keeping the comms as much as possible still over HTTP
> > rather
> > > than OSGi, more potential for distributed systems.
> > >
> >
> > Interesting. Did you have a look at DOSGi?
>
>
> I hadn't, very interesting.
>
>
> > Currently what I've been using
> > it to separate the triple store from the OSGi instance by using the
> > clerezza virtuoso binding. You are thinking of each bundle having a
> > different Triple store configured as Sparql HTTP endpoind?
>
>
> Potentially going even farther than that, so the data could go to a totally
> remote SPARQL store.


What do you mean by totally remote? A Sparql enpoint accessed via HTTP is
remote by default.


> I can't think of a use case for that in itself, though
> there may be situations when it'd be useful to go to an external proxy, set
> up so that both the local store and a remote one have copies of the data.
> (The remote could take the query-for-display workload).
>
>
> > This might be a
> > usecase for having TcManager provided by a service factory, this way it
> > would be possible to have another instance of TcManager depending on the
> > bundle requesting it. This would be transparent for the bundles, because
> I
> > think it really shouldn't be necessary for service implementors to care
> > about the backend. On the other hand there should be a unified interface
> > for the administrator to manage this distributed system.
> >
> > That does sounds like it might be useful...but also quite a lot of work.
> Another use case or two would probably be desirable.
>
>  fyi, this integration is proving an uphill struggle! (mostly due to my
> inexperience with OSGi & Stanbol). There are only 4 aspects that I need to
> do for minimal integration :
> * load files from bundles (templates etc) - basically done, though I have
> just run into an error that's probably just a typo in the path somewhere...
> * HTTP SPARQL access - I think I'm slowly getting there
> * serve UI - at minimum the UI is just 3 static HTML pages (containing
> Ajaxy Javascript addressing the SPARQL endpoint). I've only have a quick go
> at serving the pages inside Stanbol, something in my jax-rs isn't quite
> right, probably got my paths wrong somewhere there too
> * service control UI - at minimum just buttons for start/stop of the
> feedreader and linkexplorer (the discovery bit) thread. I guess ideally
> this should be integrated with the Felix Web Console, but if I get really
> stuck on that there's always the possibility of a short-term workaround by
> using the SPARQL store as a message whiteboard, between the Ajaxy client
> and the server-side code.
>

Are you using any clerezza features? If you just need the SPARQl endpoint
it might be more straight forward to have a separate application in its own
OSGi container.

Cheers,
Reto

Re: Configuring SPARQL (Query & Update)

Posted by Danny Ayers <da...@gmail.com>.
On 27 August 2014 09:41, Reto Gmür <re...@apache.org> wrote:

> On Tue, Aug 26, 2014 at 6:07 PM, Danny Ayers <da...@gmail.com>
> wrote:
>
> >
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html
> >
> > but I'm still getting the 401 challenge, so I guess I'll try doing the
> > regular two-step auth.
>
> I think I'm now making progress there...


> > >
> > > But if you're application is running in OSGi you definitively shouldn't
> > do
> > > this. You don't want to have to configure your app to store the
> password
> > of
> > > the instance it is running on (and need to reconfigure it, wehn the
> > > password is changed).
> >
> >
> > Hmm, I see your point, but what if an account is set up, reserved for the
> > app, on install, wouldn't that be feasible?
> >
> Well you app could set up an account for its own access. It would still
> need to store the (random) password it set for its user on disk, which is
> not ideal but certainly better than requiring the user to provide the
> password.
>

Right. I reckon for now I'll go this route. In fact until I've got the
thing running integrated, I'll just use the default admin/admin. Can look
at improving things later.

>
>
> >
> > I would prefer keeping the comms as much as possible still over HTTP
> rather
> > than OSGi, more potential for distributed systems.
> >
>
> Interesting. Did you have a look at DOSGi?


I hadn't, very interesting.


> Currently what I've been using
> it to separate the triple store from the OSGi instance by using the
> clerezza virtuoso binding. You are thinking of each bundle having a
> different Triple store configured as Sparql HTTP endpoind?


Potentially going even farther than that, so the data could go to a totally
remote SPARQL store. I can't think of a use case for that in itself, though
there may be situations when it'd be useful to go to an external proxy, set
up so that both the local store and a remote one have copies of the data.
(The remote could take the query-for-display workload).


> This might be a
> usecase for having TcManager provided by a service factory, this way it
> would be possible to have another instance of TcManager depending on the
> bundle requesting it. This would be transparent for the bundles, because I
> think it really shouldn't be necessary for service implementors to care
> about the backend. On the other hand there should be a unified interface
> for the administrator to manage this distributed system.
>
> That does sounds like it might be useful...but also quite a lot of work.
Another use case or two would probably be desirable.

 fyi, this integration is proving an uphill struggle! (mostly due to my
inexperience with OSGi & Stanbol). There are only 4 aspects that I need to
do for minimal integration :
* load files from bundles (templates etc) - basically done, though I have
just run into an error that's probably just a typo in the path somewhere...
* HTTP SPARQL access - I think I'm slowly getting there
* serve UI - at minimum the UI is just 3 static HTML pages (containing
Ajaxy Javascript addressing the SPARQL endpoint). I've only have a quick go
at serving the pages inside Stanbol, something in my jax-rs isn't quite
right, probably got my paths wrong somewhere there too
* service control UI - at minimum just buttons for start/stop of the
feedreader and linkexplorer (the discovery bit) thread. I guess ideally
this should be integrated with the Felix Web Console, but if I get really
stuck on that there's always the possibility of a short-term workaround by
using the SPARQL store as a message whiteboard, between the Ajaxy client
and the server-side code.

Cheers,
Danny.

Re: Configuring SPARQL (Query & Update)

Posted by Reto Gmür <re...@apache.org>.
On Tue, Aug 26, 2014 at 6:07 PM, Danny Ayers <da...@gmail.com> wrote:

> On 26 August 2014 11:08, Reto Gmür <re...@apache.org> wrote:
>
> > That should be an easy one....
> >
>
> Should be :) Just tried doing pre-emptive auth, according to:
>
>
> http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html
>
> but I'm still getting the 401 challenge, so I guess I'll try doing the
> regular two-step auth.
>
> >
> > But if you're application is running in OSGi you definitively shouldn't
> do
> > this. You don't want to have to configure your app to store the password
> of
> > the instance it is running on (and need to reconfigure it, wehn the
> > password is changed).
>
>
> Hmm, I see your point, but what if an account is set up, reserved for the
> app, on install, wouldn't that be feasible?
>
Well you app could set up an account for its own access. It would still
need to store the (random) password it set for its user on disk, which is
not ideal but certainly better than requiring the user to provide the
password.


>
> I would prefer keeping the comms as much as possible still over HTTP rather
> than OSGi, more potential for distributed systems.
>

Interesting. Did you have a look at DOSGi? Currently what I've been using
it to separate the triple store from the OSGi instance by using the
clerezza virtuoso binding. You are thinking of each bundle having a
different Triple store configured as Sparql HTTP endpoind? This might be a
usecase for having TcManager provided by a service factory, this way it
would be possible to have another instance of TcManager depending on the
bundle requesting it. This would be transparent for the bundles, because I
think it really shouldn't be necessary for service implementors to care
about the backend. On the other hand there should be a unified interface
for the administrator to manage this distributed system.

Cheers,
Reto



>
> Cheers,
> Danny.
>

Re: Configuring SPARQL (Query & Update)

Posted by Danny Ayers <da...@gmail.com>.
On 26 August 2014 11:08, Reto Gmür <re...@apache.org> wrote:

> That should be an easy one....
>

Should be :) Just tried doing pre-emptive auth, according to:

http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html

but I'm still getting the 401 challenge, so I guess I'll try doing the
regular two-step auth.

>
> But if you're application is running in OSGi you definitively shouldn't do
> this. You don't want to have to configure your app to store the password of
> the instance it is running on (and need to reconfigure it, wehn the
> password is changed).


Hmm, I see your point, but what if an account is set up, reserved for the
app, on install, wouldn't that be feasible?

I would prefer keeping the comms as much as possible still over HTTP rather
than OSGi, more potential for distributed systems.

Cheers,
Danny.

Re: Configuring SPARQL (Query & Update)

Posted by Reto Gmür <re...@apache.org>.
That should be an easy one....

But if you're application is running in OSGi you definitively shouldn't do
this. You don't want to have to configure your app to store the password of
the instance it is running on (and need to reconfigure it, wehn the
password is changed).

Cheers,
Reto


On Tue, Aug 26, 2014 at 10:56 AM, Danny Ayers <da...@gmail.com> wrote:

> %-encoding the {} gets it past the parsing error, thanks!
>
> http://localhost:8080/sparql?query=SELECT+*+WHERE+%7B%3Fs+%3Fp+%3Fo%7D
>
> now gets me to the auth stage, next hurdle to jump :)
>
> Cheers,
> Danny.
>
>
> On 25 August 2014 19:29, Andy Seaborne <an...@apache.org> wrote:
>
> > Jetty is quite happy about the string:
> >
> > sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}
> >
> > {} is special to Jersey though which _may_ be a source of confusion.
> >
> > >> "in a path template"
> >               ^^^^^^^^
> >
> > Try %-encoding the {}.
> >
> >         Andy
> >
> >
> > On 25/08/14 15:38, Reto Gmür wrote:
> >
> >> Hi Danny
> >>
> >> It seems to be an issue with jetty who doesn't like that URI. If you
> want
> >> to access sparql via HTTP I suggest you use POST.
> >>
> >> If your code is running in OSGi than simply get a refrence to TcManager
> >> (for an example, see the stanbol staefuull webapp maven archetype) and
> >> access one of its executeSparqlQuery methods:
> >> http://clerezza.apache.org/apidocs/org/apache/clerezza/
> >> rdf/core/access/TcManager.html#executeSparqlQuery%
> >> 28java.lang.String,%20org.apache.clerezza.rdf.core.UriRef%29
> >>
> >> Cheers,
> >> Reto
> >>
> >>
> >> On Mon, Aug 25, 2014 at 8:58 AM, Danny Ayers <da...@gmail.com>
> >> wrote:
> >>
> >>  On 23 August 2014 19:24, Reto Gmür <re...@apache.org> wrote:
> >>>
> >>>  Hi Danny
> >>>>
> >>>> Could you tell more about what error you get when you run the query
> >>>>
> >>> against
> >>>
> >>>> http://localhost:8080/sparql. What does the log say?
> >>>>
> >>>>
> >>> Taking the query :
> >>>
> >>> SELECT * WHERE {?s ?p ?o}
> >>>
> >>> converted to URL becomes :
> >>>
> >>> http://localhost:8080/sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}
> >>> <
> http://localhost:8080/sparql?query=SELECT+*+WHERE+%7B%3Fs+%3Fp+%3Fo%7D>
> >>>
> >>> with a GET gives the error :
> >>>
> >>> 25.08.2014 08:39:16.792 *WARN* [qtp22576245-34]
> >>> org.eclipse.jetty.servlet.ServletHandler /sparql
> >>> java.lang.IllegalArgumentException: Illegal character "%" at position
> >>> 22 is
> >>> not allowed as a start of a name in a path template
> >>> "query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}&output=text&stylesheet=".
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.internal.UriTemplateParser.
> >>> parseName(UriTemplateParser.java:305)
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.internal.UriTemplateParser.
> >>> parse(UriTemplateParser.java:235)
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.internal.UriTemplateParser.<
> >>> init>(UriTemplateParser.java:107)
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.UriTemplate.createURIComponent(
> >>> UriTemplate.java:891)
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(
> >>> UriTemplate.java:858)
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(
> >>> UriTemplate.java:797)
> >>>      at org.glassfish.jersey.uri.UriTemplate.createURI(
> >>> UriTemplate.java:762)
> >>>      at
> >>>
> >>> org.glassfish.jersey.uri.internal.JerseyUriBuilder._
> >>> build(JerseyUriBuilder.java:893)
> >>> ...
> >>>
> >>> looks like it's not decoding the query in GETs per
> >>> http://www.w3.org/TR/sparql11-protocol/#query-via-get
> >>>
> >>>
> >>>> Also, the sparql HTTP endpoint is so that external can query the data.
> >>>>
> >>> You
> >>>
> >>>> write that you're integrating it into OSGi, so why should you by
> >>>> acessing
> >>>> the HTTP endpoint?
> >>>>
> >>>>
> >>> So it's possible to flip to using an external store by just changing
> the
> >>> 2
> >>> SPARQL URLs, i.e. more loosely coupled. The messages being passed
> around
> >>> are relatively small so shouldn't be a major hit on performance,
> though I
> >>> guess accessing the store more directly would be an idea if this
> becomes
> >>> an
> >>> issue for later UI elements.
> >>>
> >>> Having said that, because I need to get this thing integrated asap, if
> >>> there's a quick way of modifying code to do the comms through OSGi I'd
> >>> love
> >>> to hear it :)
> >>>
> >>> Cheers,
> >>> Danny.
> >>>
> >>>
> >>>  Cheers,
> >>>> Reto
> >>>>
> >>>>
> >>>> On Sat, Aug 23, 2014 at 6:31 PM, Danny Ayers <da...@gmail.com>
> >>>> wrote:
> >>>>
> >>>>  Hi Hasan, everyone,
> >>>>>
> >>>>> I'm working on a module [1] intended to plug in to the Fusepool
> >>>>>
> >>>> extension
> >>>
> >>>> of Stanbol. It's a feed reader back by an RDF store, the store being
> >>>>> addressed entirely through SPARQL (over HTTP).
> >>>>>
> >>>>> I developed the app outside of OSGi and am now in the process of
> >>>>> integrating. I have been using a Fuseki store/endpoint but need to
> move
> >>>>> this over to using Stanbol/Clerezza's SPARQL facilities.
> >>>>>
> >>>>> So what I'd like to know is how to set up SPARQL endpoints. The
> config
> >>>>>
> >>>> I've
> >>>>
> >>>>> got for Fuseki is below, essentially I need a dataset in a TDB-like
> >>>>>
> >>>> store
> >>>
> >>>> that supports named graphs, accessed via SPARQL query (GET) & update
> >>>>> (POST).
> >>>>> There's an example of the kind of update I'm doing at [2] - it's
> >>>>>
> >>>> actually a
> >>>>
> >>>>> freemarker template with simple placeholder substitution, but the
> >>>>>
> >>>> SPARQL
> >>>
> >>>> is
> >>>>
> >>>>> pretty clear.
> >>>>>
> >>>>> Right now with a running Fusepool/Stanbol, pointing a browser at
> >>>>> http://localhost:8080/query?sparql=
> >>>>> gives the kind of SPARQL parsing error you'd expect, but giving it a
> >>>>> genuine query leads to a HTTP 500.
> >>>>>
> >>>>> Any help greatly appreciated.
> >>>>>
> >>>>> Cheers,
> >>>>> Danny.
> >>>>>
> >>>>> ## ---------------------------------------------------------------
> ##
> >>>>> Updatable in-memory dataset.
> >>>>>   <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
> >>>>> http://host:port/feedreader  fuseki:name "feedreader" ;
> >>>>>    # SPARQL query services e.g.
> >>>>> http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
> >>>>> "sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
> >>>>> http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
> >>>>> "update" ; # SPARQL query service -- /feedreader/update
> >>>>>    # Upload service -- http://host:port/feedreader/
> >>>>> upload?graph=default
> >>>>>
> >>>> or
> >>>>
> >>>>> ?graph=URI or ?default  # followed by a multipart body, each part
> being
> >>>>>
> >>>> RDF
> >>>>
> >>>>> syntax.  # Syntax determined by the file name extension.
> >>>>> fuseki:serviceUpload
> >>>>> "upload" ; # Non-SPARQL upload service
> >>>>>    # SPARQL Graph store protocol (read and write)  # GET, PUT, POST
> >>>>>
> >>>> DELETE
> >>>
> >>>> to http://host:port/feedreader/data?graph= or ?default=
> >>>>> fuseki:serviceReadWriteGraphStore
> >>>>> "data" ;
> >>>>>    # A separate read-only graph store endpoint:
> >>>>> fuseki:serviceReadGraphStore
> >>>>> "get" ; # Graph store protocol (read only) -- /feedreader/get
> >>>>>    fuseki:dataset <#emptyDataset> ;  .
> >>>>>   ## In-memory, initially empty.  <#emptyDataset> rdf:type
> >>>>>
> >>>> ja:RDFDataset .
> >>>
> >>>> ##
> >>>>> ------------------------------------------------------------------
> >>>>> [1] https://github.com/danja/NewsMonitor
> >>>>>
> >>>>> [2]
> >>>>>
> >>>>>
> >>>>>
> >>>>  https://github.com/danja/NewsMonitor/blob/master/src/
> >>> main/resources/templates/html/it/danja/newsmonitor/resource/
> >>> update-links.ftl
> >>>
> >>>>
> >>>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> http://dannyayers.com
> >>>
> >>> http://webbeep.it  - text to tones and back again
> >>>
> >>>
> >>
> >
>
>
> --
> http://dannyayers.com
>
> http://webbeep.it  - text to tones and back again
>

Re: Configuring SPARQL (Query & Update)

Posted by Danny Ayers <da...@gmail.com>.
%-encoding the {} gets it past the parsing error, thanks!

http://localhost:8080/sparql?query=SELECT+*+WHERE+%7B%3Fs+%3Fp+%3Fo%7D

now gets me to the auth stage, next hurdle to jump :)

Cheers,
Danny.


On 25 August 2014 19:29, Andy Seaborne <an...@apache.org> wrote:

> Jetty is quite happy about the string:
>
> sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}
>
> {} is special to Jersey though which _may_ be a source of confusion.
>
> >> "in a path template"
>               ^^^^^^^^
>
> Try %-encoding the {}.
>
>         Andy
>
>
> On 25/08/14 15:38, Reto Gmür wrote:
>
>> Hi Danny
>>
>> It seems to be an issue with jetty who doesn't like that URI. If you want
>> to access sparql via HTTP I suggest you use POST.
>>
>> If your code is running in OSGi than simply get a refrence to TcManager
>> (for an example, see the stanbol staefuull webapp maven archetype) and
>> access one of its executeSparqlQuery methods:
>> http://clerezza.apache.org/apidocs/org/apache/clerezza/
>> rdf/core/access/TcManager.html#executeSparqlQuery%
>> 28java.lang.String,%20org.apache.clerezza.rdf.core.UriRef%29
>>
>> Cheers,
>> Reto
>>
>>
>> On Mon, Aug 25, 2014 at 8:58 AM, Danny Ayers <da...@gmail.com>
>> wrote:
>>
>>  On 23 August 2014 19:24, Reto Gmür <re...@apache.org> wrote:
>>>
>>>  Hi Danny
>>>>
>>>> Could you tell more about what error you get when you run the query
>>>>
>>> against
>>>
>>>> http://localhost:8080/sparql. What does the log say?
>>>>
>>>>
>>> Taking the query :
>>>
>>> SELECT * WHERE {?s ?p ?o}
>>>
>>> converted to URL becomes :
>>>
>>> http://localhost:8080/sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}
>>> <http://localhost:8080/sparql?query=SELECT+*+WHERE+%7B%3Fs+%3Fp+%3Fo%7D>
>>>
>>> with a GET gives the error :
>>>
>>> 25.08.2014 08:39:16.792 *WARN* [qtp22576245-34]
>>> org.eclipse.jetty.servlet.ServletHandler /sparql
>>> java.lang.IllegalArgumentException: Illegal character "%" at position
>>> 22 is
>>> not allowed as a start of a name in a path template
>>> "query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}&output=text&stylesheet=".
>>>      at
>>>
>>> org.glassfish.jersey.uri.internal.UriTemplateParser.
>>> parseName(UriTemplateParser.java:305)
>>>      at
>>>
>>> org.glassfish.jersey.uri.internal.UriTemplateParser.
>>> parse(UriTemplateParser.java:235)
>>>      at
>>>
>>> org.glassfish.jersey.uri.internal.UriTemplateParser.<
>>> init>(UriTemplateParser.java:107)
>>>      at
>>>
>>> org.glassfish.jersey.uri.UriTemplate.createURIComponent(
>>> UriTemplate.java:891)
>>>      at
>>>
>>> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(
>>> UriTemplate.java:858)
>>>      at
>>>
>>> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(
>>> UriTemplate.java:797)
>>>      at org.glassfish.jersey.uri.UriTemplate.createURI(
>>> UriTemplate.java:762)
>>>      at
>>>
>>> org.glassfish.jersey.uri.internal.JerseyUriBuilder._
>>> build(JerseyUriBuilder.java:893)
>>> ...
>>>
>>> looks like it's not decoding the query in GETs per
>>> http://www.w3.org/TR/sparql11-protocol/#query-via-get
>>>
>>>
>>>> Also, the sparql HTTP endpoint is so that external can query the data.
>>>>
>>> You
>>>
>>>> write that you're integrating it into OSGi, so why should you by
>>>> acessing
>>>> the HTTP endpoint?
>>>>
>>>>
>>> So it's possible to flip to using an external store by just changing the
>>> 2
>>> SPARQL URLs, i.e. more loosely coupled. The messages being passed around
>>> are relatively small so shouldn't be a major hit on performance, though I
>>> guess accessing the store more directly would be an idea if this becomes
>>> an
>>> issue for later UI elements.
>>>
>>> Having said that, because I need to get this thing integrated asap, if
>>> there's a quick way of modifying code to do the comms through OSGi I'd
>>> love
>>> to hear it :)
>>>
>>> Cheers,
>>> Danny.
>>>
>>>
>>>  Cheers,
>>>> Reto
>>>>
>>>>
>>>> On Sat, Aug 23, 2014 at 6:31 PM, Danny Ayers <da...@gmail.com>
>>>> wrote:
>>>>
>>>>  Hi Hasan, everyone,
>>>>>
>>>>> I'm working on a module [1] intended to plug in to the Fusepool
>>>>>
>>>> extension
>>>
>>>> of Stanbol. It's a feed reader back by an RDF store, the store being
>>>>> addressed entirely through SPARQL (over HTTP).
>>>>>
>>>>> I developed the app outside of OSGi and am now in the process of
>>>>> integrating. I have been using a Fuseki store/endpoint but need to move
>>>>> this over to using Stanbol/Clerezza's SPARQL facilities.
>>>>>
>>>>> So what I'd like to know is how to set up SPARQL endpoints. The config
>>>>>
>>>> I've
>>>>
>>>>> got for Fuseki is below, essentially I need a dataset in a TDB-like
>>>>>
>>>> store
>>>
>>>> that supports named graphs, accessed via SPARQL query (GET) & update
>>>>> (POST).
>>>>> There's an example of the kind of update I'm doing at [2] - it's
>>>>>
>>>> actually a
>>>>
>>>>> freemarker template with simple placeholder substitution, but the
>>>>>
>>>> SPARQL
>>>
>>>> is
>>>>
>>>>> pretty clear.
>>>>>
>>>>> Right now with a running Fusepool/Stanbol, pointing a browser at
>>>>> http://localhost:8080/query?sparql=
>>>>> gives the kind of SPARQL parsing error you'd expect, but giving it a
>>>>> genuine query leads to a HTTP 500.
>>>>>
>>>>> Any help greatly appreciated.
>>>>>
>>>>> Cheers,
>>>>> Danny.
>>>>>
>>>>> ## ---------------------------------------------------------------  ##
>>>>> Updatable in-memory dataset.
>>>>>   <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
>>>>> http://host:port/feedreader  fuseki:name "feedreader" ;
>>>>>    # SPARQL query services e.g.
>>>>> http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
>>>>> "sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
>>>>> http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
>>>>> "update" ; # SPARQL query service -- /feedreader/update
>>>>>    # Upload service -- http://host:port/feedreader/
>>>>> upload?graph=default
>>>>>
>>>> or
>>>>
>>>>> ?graph=URI or ?default  # followed by a multipart body, each part being
>>>>>
>>>> RDF
>>>>
>>>>> syntax.  # Syntax determined by the file name extension.
>>>>> fuseki:serviceUpload
>>>>> "upload" ; # Non-SPARQL upload service
>>>>>    # SPARQL Graph store protocol (read and write)  # GET, PUT, POST
>>>>>
>>>> DELETE
>>>
>>>> to http://host:port/feedreader/data?graph= or ?default=
>>>>> fuseki:serviceReadWriteGraphStore
>>>>> "data" ;
>>>>>    # A separate read-only graph store endpoint:
>>>>> fuseki:serviceReadGraphStore
>>>>> "get" ; # Graph store protocol (read only) -- /feedreader/get
>>>>>    fuseki:dataset <#emptyDataset> ;  .
>>>>>   ## In-memory, initially empty.  <#emptyDataset> rdf:type
>>>>>
>>>> ja:RDFDataset .
>>>
>>>> ##
>>>>> ------------------------------------------------------------------
>>>>> [1] https://github.com/danja/NewsMonitor
>>>>>
>>>>> [2]
>>>>>
>>>>>
>>>>>
>>>>  https://github.com/danja/NewsMonitor/blob/master/src/
>>> main/resources/templates/html/it/danja/newsmonitor/resource/
>>> update-links.ftl
>>>
>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> http://dannyayers.com
>>>
>>> http://webbeep.it  - text to tones and back again
>>>
>>>
>>
>


-- 
http://dannyayers.com

http://webbeep.it  - text to tones and back again

Re: Configuring SPARQL (Query & Update)

Posted by Andy Seaborne <an...@apache.org>.
Jetty is quite happy about the string:

sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}

{} is special to Jersey though which _may_ be a source of confusion.

 >> "in a path template"
               ^^^^^^^^

Try %-encoding the {}.

	Andy

On 25/08/14 15:38, Reto Gmür wrote:
> Hi Danny
>
> It seems to be an issue with jetty who doesn't like that URI. If you want
> to access sparql via HTTP I suggest you use POST.
>
> If your code is running in OSGi than simply get a refrence to TcManager
> (for an example, see the stanbol staefuull webapp maven archetype) and
> access one of its executeSparqlQuery methods:
> http://clerezza.apache.org/apidocs/org/apache/clerezza/rdf/core/access/TcManager.html#executeSparqlQuery%28java.lang.String,%20org.apache.clerezza.rdf.core.UriRef%29
>
> Cheers,
> Reto
>
>
> On Mon, Aug 25, 2014 at 8:58 AM, Danny Ayers <da...@gmail.com> wrote:
>
>> On 23 August 2014 19:24, Reto Gmür <re...@apache.org> wrote:
>>
>>> Hi Danny
>>>
>>> Could you tell more about what error you get when you run the query
>> against
>>> http://localhost:8080/sparql. What does the log say?
>>>
>>
>> Taking the query :
>>
>> SELECT * WHERE {?s ?p ?o}
>>
>> converted to URL becomes :
>>
>> http://localhost:8080/sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}
>>
>> with a GET gives the error :
>>
>> 25.08.2014 08:39:16.792 *WARN* [qtp22576245-34]
>> org.eclipse.jetty.servlet.ServletHandler /sparql
>> java.lang.IllegalArgumentException: Illegal character "%" at position 22 is
>> not allowed as a start of a name in a path template
>> "query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}&output=text&stylesheet=".
>>      at
>>
>> org.glassfish.jersey.uri.internal.UriTemplateParser.parseName(UriTemplateParser.java:305)
>>      at
>>
>> org.glassfish.jersey.uri.internal.UriTemplateParser.parse(UriTemplateParser.java:235)
>>      at
>>
>> org.glassfish.jersey.uri.internal.UriTemplateParser.<init>(UriTemplateParser.java:107)
>>      at
>>
>> org.glassfish.jersey.uri.UriTemplate.createURIComponent(UriTemplate.java:891)
>>      at
>>
>> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:858)
>>      at
>>
>> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:797)
>>      at org.glassfish.jersey.uri.UriTemplate.createURI(UriTemplate.java:762)
>>      at
>>
>> org.glassfish.jersey.uri.internal.JerseyUriBuilder._build(JerseyUriBuilder.java:893)
>> ...
>>
>> looks like it's not decoding the query in GETs per
>> http://www.w3.org/TR/sparql11-protocol/#query-via-get
>>
>>>
>>> Also, the sparql HTTP endpoint is so that external can query the data.
>> You
>>> write that you're integrating it into OSGi, so why should you by acessing
>>> the HTTP endpoint?
>>>
>>
>> So it's possible to flip to using an external store by just changing the 2
>> SPARQL URLs, i.e. more loosely coupled. The messages being passed around
>> are relatively small so shouldn't be a major hit on performance, though I
>> guess accessing the store more directly would be an idea if this becomes an
>> issue for later UI elements.
>>
>> Having said that, because I need to get this thing integrated asap, if
>> there's a quick way of modifying code to do the comms through OSGi I'd love
>> to hear it :)
>>
>> Cheers,
>> Danny.
>>
>>
>>> Cheers,
>>> Reto
>>>
>>>
>>> On Sat, Aug 23, 2014 at 6:31 PM, Danny Ayers <da...@gmail.com>
>>> wrote:
>>>
>>>> Hi Hasan, everyone,
>>>>
>>>> I'm working on a module [1] intended to plug in to the Fusepool
>> extension
>>>> of Stanbol. It's a feed reader back by an RDF store, the store being
>>>> addressed entirely through SPARQL (over HTTP).
>>>>
>>>> I developed the app outside of OSGi and am now in the process of
>>>> integrating. I have been using a Fuseki store/endpoint but need to move
>>>> this over to using Stanbol/Clerezza's SPARQL facilities.
>>>>
>>>> So what I'd like to know is how to set up SPARQL endpoints. The config
>>> I've
>>>> got for Fuseki is below, essentially I need a dataset in a TDB-like
>> store
>>>> that supports named graphs, accessed via SPARQL query (GET) & update
>>>> (POST).
>>>> There's an example of the kind of update I'm doing at [2] - it's
>>> actually a
>>>> freemarker template with simple placeholder substitution, but the
>> SPARQL
>>> is
>>>> pretty clear.
>>>>
>>>> Right now with a running Fusepool/Stanbol, pointing a browser at
>>>> http://localhost:8080/query?sparql=
>>>> gives the kind of SPARQL parsing error you'd expect, but giving it a
>>>> genuine query leads to a HTTP 500.
>>>>
>>>> Any help greatly appreciated.
>>>>
>>>> Cheers,
>>>> Danny.
>>>>
>>>> ## ---------------------------------------------------------------  ##
>>>> Updatable in-memory dataset.
>>>>   <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
>>>> http://host:port/feedreader  fuseki:name "feedreader" ;
>>>>    # SPARQL query services e.g.
>>>> http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
>>>> "sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
>>>> http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
>>>> "update" ; # SPARQL query service -- /feedreader/update
>>>>    # Upload service -- http://host:port/feedreader/upload?graph=default
>>> or
>>>> ?graph=URI or ?default  # followed by a multipart body, each part being
>>> RDF
>>>> syntax.  # Syntax determined by the file name extension.
>>>> fuseki:serviceUpload
>>>> "upload" ; # Non-SPARQL upload service
>>>>    # SPARQL Graph store protocol (read and write)  # GET, PUT, POST
>> DELETE
>>>> to http://host:port/feedreader/data?graph= or ?default=
>>>> fuseki:serviceReadWriteGraphStore
>>>> "data" ;
>>>>    # A separate read-only graph store endpoint:
>>>> fuseki:serviceReadGraphStore
>>>> "get" ; # Graph store protocol (read only) -- /feedreader/get
>>>>    fuseki:dataset <#emptyDataset> ;  .
>>>>   ## In-memory, initially empty.  <#emptyDataset> rdf:type
>> ja:RDFDataset .
>>>> ##
>>>> ------------------------------------------------------------------
>>>> [1] https://github.com/danja/NewsMonitor
>>>>
>>>> [2]
>>>>
>>>>
>>>
>> https://github.com/danja/NewsMonitor/blob/master/src/main/resources/templates/html/it/danja/newsmonitor/resource/update-links.ftl
>>>>
>>>
>>
>>
>>
>> --
>> http://dannyayers.com
>>
>> http://webbeep.it  - text to tones and back again
>>
>


Re: Configuring SPARQL (Query & Update)

Posted by Reto Gmür <re...@wymiwyg.com>.
Hi Danny

It seems to be an issue with jetty who doesn't like that URI. If you want
to access sparql via HTTP I suggest you use POST.

If your code is running in OSGi than simply get a refrence to TcManager
(for an example, see the stanbol staefuull webapp maven archetype) and
access one of its executeSparqlQuery methods:
http://clerezza.apache.org/apidocs/org/apache/clerezza/rdf/core/access/TcManager.html#executeSparqlQuery%28java.lang.String,%20org.apache.clerezza.rdf.core.UriRef%29

Cheers,
Reto


On Mon, Aug 25, 2014 at 8:58 AM, Danny Ayers <da...@gmail.com> wrote:

> On 23 August 2014 19:24, Reto Gmür <re...@apache.org> wrote:
>
> > Hi Danny
> >
> > Could you tell more about what error you get when you run the query
> against
> > http://localhost:8080/sparql. What does the log say?
> >
>
> Taking the query :
>
> SELECT * WHERE {?s ?p ?o}
>
> converted to URL becomes :
>
> http://localhost:8080/sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}
>
> with a GET gives the error :
>
> 25.08.2014 08:39:16.792 *WARN* [qtp22576245-34]
> org.eclipse.jetty.servlet.ServletHandler /sparql
> java.lang.IllegalArgumentException: Illegal character "%" at position 22 is
> not allowed as a start of a name in a path template
> "query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}&output=text&stylesheet=".
>     at
>
> org.glassfish.jersey.uri.internal.UriTemplateParser.parseName(UriTemplateParser.java:305)
>     at
>
> org.glassfish.jersey.uri.internal.UriTemplateParser.parse(UriTemplateParser.java:235)
>     at
>
> org.glassfish.jersey.uri.internal.UriTemplateParser.<init>(UriTemplateParser.java:107)
>     at
>
> org.glassfish.jersey.uri.UriTemplate.createURIComponent(UriTemplate.java:891)
>     at
>
> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:858)
>     at
>
> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:797)
>     at org.glassfish.jersey.uri.UriTemplate.createURI(UriTemplate.java:762)
>     at
>
> org.glassfish.jersey.uri.internal.JerseyUriBuilder._build(JerseyUriBuilder.java:893)
> ...
>
> looks like it's not decoding the query in GETs per
> http://www.w3.org/TR/sparql11-protocol/#query-via-get
>
> >
> > Also, the sparql HTTP endpoint is so that external can query the data.
> You
> > write that you're integrating it into OSGi, so why should you by acessing
> > the HTTP endpoint?
> >
>
> So it's possible to flip to using an external store by just changing the 2
> SPARQL URLs, i.e. more loosely coupled. The messages being passed around
> are relatively small so shouldn't be a major hit on performance, though I
> guess accessing the store more directly would be an idea if this becomes an
> issue for later UI elements.
>
> Having said that, because I need to get this thing integrated asap, if
> there's a quick way of modifying code to do the comms through OSGi I'd love
> to hear it :)
>
> Cheers,
> Danny.
>
>
> > Cheers,
> > Reto
> >
> >
> > On Sat, Aug 23, 2014 at 6:31 PM, Danny Ayers <da...@gmail.com>
> > wrote:
> >
> > > Hi Hasan, everyone,
> > >
> > > I'm working on a module [1] intended to plug in to the Fusepool
> extension
> > > of Stanbol. It's a feed reader back by an RDF store, the store being
> > > addressed entirely through SPARQL (over HTTP).
> > >
> > > I developed the app outside of OSGi and am now in the process of
> > > integrating. I have been using a Fuseki store/endpoint but need to move
> > > this over to using Stanbol/Clerezza's SPARQL facilities.
> > >
> > > So what I'd like to know is how to set up SPARQL endpoints. The config
> > I've
> > > got for Fuseki is below, essentially I need a dataset in a TDB-like
> store
> > > that supports named graphs, accessed via SPARQL query (GET) & update
> > > (POST).
> > > There's an example of the kind of update I'm doing at [2] - it's
> > actually a
> > > freemarker template with simple placeholder substitution, but the
> SPARQL
> > is
> > > pretty clear.
> > >
> > > Right now with a running Fusepool/Stanbol, pointing a browser at
> > > http://localhost:8080/query?sparql=
> > > gives the kind of SPARQL parsing error you'd expect, but giving it a
> > > genuine query leads to a HTTP 500.
> > >
> > > Any help greatly appreciated.
> > >
> > > Cheers,
> > > Danny.
> > >
> > > ## ---------------------------------------------------------------  ##
> > > Updatable in-memory dataset.
> > >  <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
> > > http://host:port/feedreader  fuseki:name "feedreader" ;
> > >   # SPARQL query services e.g.
> > > http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
> > > "sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
> > > http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
> > > "update" ; # SPARQL query service -- /feedreader/update
> > >   # Upload service -- http://host:port/feedreader/upload?graph=default
> > or
> > > ?graph=URI or ?default  # followed by a multipart body, each part being
> > RDF
> > > syntax.  # Syntax determined by the file name extension.
> > > fuseki:serviceUpload
> > > "upload" ; # Non-SPARQL upload service
> > >   # SPARQL Graph store protocol (read and write)  # GET, PUT, POST
> DELETE
> > > to http://host:port/feedreader/data?graph= or ?default=
> > > fuseki:serviceReadWriteGraphStore
> > > "data" ;
> > >   # A separate read-only graph store endpoint:
> > > fuseki:serviceReadGraphStore
> > > "get" ; # Graph store protocol (read only) -- /feedreader/get
> > >   fuseki:dataset <#emptyDataset> ;  .
> > >  ## In-memory, initially empty.  <#emptyDataset> rdf:type
> ja:RDFDataset .
> > > ##
> > > ------------------------------------------------------------------
> > > [1] https://github.com/danja/NewsMonitor
> > >
> > > [2]
> > >
> > >
> >
> https://github.com/danja/NewsMonitor/blob/master/src/main/resources/templates/html/it/danja/newsmonitor/resource/update-links.ftl
> > >
> >
>
>
>
> --
> http://dannyayers.com
>
> http://webbeep.it  - text to tones and back again
>

Re: Configuring SPARQL (Query & Update)

Posted by Danny Ayers <da...@gmail.com>.
On 23 August 2014 19:24, Reto Gmür <re...@apache.org> wrote:

> Hi Danny
>
> Could you tell more about what error you get when you run the query against
> http://localhost:8080/sparql. What does the log say?
>

Taking the query :

SELECT * WHERE {?s ?p ?o}

converted to URL becomes :

http://localhost:8080/sparql?query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}

with a GET gives the error :

25.08.2014 08:39:16.792 *WARN* [qtp22576245-34]
org.eclipse.jetty.servlet.ServletHandler /sparql
java.lang.IllegalArgumentException: Illegal character "%" at position 22 is
not allowed as a start of a name in a path template
"query=SELECT+*+WHERE+{%3Fs+%3Fp+%3Fo}&output=text&stylesheet=".
    at
org.glassfish.jersey.uri.internal.UriTemplateParser.parseName(UriTemplateParser.java:305)
    at
org.glassfish.jersey.uri.internal.UriTemplateParser.parse(UriTemplateParser.java:235)
    at
org.glassfish.jersey.uri.internal.UriTemplateParser.<init>(UriTemplateParser.java:107)
    at
org.glassfish.jersey.uri.UriTemplate.createURIComponent(UriTemplate.java:891)
    at
org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:858)
    at
org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:797)
    at org.glassfish.jersey.uri.UriTemplate.createURI(UriTemplate.java:762)
    at
org.glassfish.jersey.uri.internal.JerseyUriBuilder._build(JerseyUriBuilder.java:893)
...

looks like it's not decoding the query in GETs per
http://www.w3.org/TR/sparql11-protocol/#query-via-get

>
> Also, the sparql HTTP endpoint is so that external can query the data. You
> write that you're integrating it into OSGi, so why should you by acessing
> the HTTP endpoint?
>

So it's possible to flip to using an external store by just changing the 2
SPARQL URLs, i.e. more loosely coupled. The messages being passed around
are relatively small so shouldn't be a major hit on performance, though I
guess accessing the store more directly would be an idea if this becomes an
issue for later UI elements.

Having said that, because I need to get this thing integrated asap, if
there's a quick way of modifying code to do the comms through OSGi I'd love
to hear it :)

Cheers,
Danny.


> Cheers,
> Reto
>
>
> On Sat, Aug 23, 2014 at 6:31 PM, Danny Ayers <da...@gmail.com>
> wrote:
>
> > Hi Hasan, everyone,
> >
> > I'm working on a module [1] intended to plug in to the Fusepool extension
> > of Stanbol. It's a feed reader back by an RDF store, the store being
> > addressed entirely through SPARQL (over HTTP).
> >
> > I developed the app outside of OSGi and am now in the process of
> > integrating. I have been using a Fuseki store/endpoint but need to move
> > this over to using Stanbol/Clerezza's SPARQL facilities.
> >
> > So what I'd like to know is how to set up SPARQL endpoints. The config
> I've
> > got for Fuseki is below, essentially I need a dataset in a TDB-like store
> > that supports named graphs, accessed via SPARQL query (GET) & update
> > (POST).
> > There's an example of the kind of update I'm doing at [2] - it's
> actually a
> > freemarker template with simple placeholder substitution, but the SPARQL
> is
> > pretty clear.
> >
> > Right now with a running Fusepool/Stanbol, pointing a browser at
> > http://localhost:8080/query?sparql=
> > gives the kind of SPARQL parsing error you'd expect, but giving it a
> > genuine query leads to a HTTP 500.
> >
> > Any help greatly appreciated.
> >
> > Cheers,
> > Danny.
> >
> > ## ---------------------------------------------------------------  ##
> > Updatable in-memory dataset.
> >  <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
> > http://host:port/feedreader  fuseki:name "feedreader" ;
> >   # SPARQL query services e.g.
> > http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
> > "sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
> > http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
> > "update" ; # SPARQL query service -- /feedreader/update
> >   # Upload service -- http://host:port/feedreader/upload?graph=default
> or
> > ?graph=URI or ?default  # followed by a multipart body, each part being
> RDF
> > syntax.  # Syntax determined by the file name extension.
> > fuseki:serviceUpload
> > "upload" ; # Non-SPARQL upload service
> >   # SPARQL Graph store protocol (read and write)  # GET, PUT, POST DELETE
> > to http://host:port/feedreader/data?graph= or ?default=
> > fuseki:serviceReadWriteGraphStore
> > "data" ;
> >   # A separate read-only graph store endpoint:
> > fuseki:serviceReadGraphStore
> > "get" ; # Graph store protocol (read only) -- /feedreader/get
> >   fuseki:dataset <#emptyDataset> ;  .
> >  ## In-memory, initially empty.  <#emptyDataset> rdf:type ja:RDFDataset .
> > ##
> > ------------------------------------------------------------------
> > [1] https://github.com/danja/NewsMonitor
> >
> > [2]
> >
> >
> https://github.com/danja/NewsMonitor/blob/master/src/main/resources/templates/html/it/danja/newsmonitor/resource/update-links.ftl
> >
>



-- 
http://dannyayers.com

http://webbeep.it  - text to tones and back again

Re: Configuring SPARQL (Query & Update)

Posted by Reto Gmür <re...@apache.org>.
Hi Danny

Could you tell more about what error you get when you run the query against
http://localhost:8080/sparql. What does the log say?

Also, the sparql HTTP endpoint is so that external can query the data. You
write that you're integrating it into OSGi, so why should you by acessing
the HTTP endpoint?

Cheers,
Reto


On Sat, Aug 23, 2014 at 6:31 PM, Danny Ayers <da...@gmail.com> wrote:

> Hi Hasan, everyone,
>
> I'm working on a module [1] intended to plug in to the Fusepool extension
> of Stanbol. It's a feed reader back by an RDF store, the store being
> addressed entirely through SPARQL (over HTTP).
>
> I developed the app outside of OSGi and am now in the process of
> integrating. I have been using a Fuseki store/endpoint but need to move
> this over to using Stanbol/Clerezza's SPARQL facilities.
>
> So what I'd like to know is how to set up SPARQL endpoints. The config I've
> got for Fuseki is below, essentially I need a dataset in a TDB-like store
> that supports named graphs, accessed via SPARQL query (GET) & update
> (POST).
> There's an example of the kind of update I'm doing at [2] - it's actually a
> freemarker template with simple placeholder substitution, but the SPARQL is
> pretty clear.
>
> Right now with a running Fusepool/Stanbol, pointing a browser at
> http://localhost:8080/query?sparql=
> gives the kind of SPARQL parsing error you'd expect, but giving it a
> genuine query leads to a HTTP 500.
>
> Any help greatly appreciated.
>
> Cheers,
> Danny.
>
> ## ---------------------------------------------------------------  ##
> Updatable in-memory dataset.
>  <#feedreader> rdf:type fuseki:Service ;  # URI of the dataset --
> http://host:port/feedreader  fuseki:name "feedreader" ;
>   # SPARQL query services e.g.
> http://host:port/feedreader/sparql?query=...  fuseki:serviceQuery
> "sparql" ;  fuseki:serviceQuery "query" ;  # SPARQL Update service --
> http://host:port/feedreader/update?request=...  fuseki:serviceUpdate
> "update" ; # SPARQL query service -- /feedreader/update
>   # Upload service -- http://host:port/feedreader/upload?graph=default or
> ?graph=URI or ?default  # followed by a multipart body, each part being RDF
> syntax.  # Syntax determined by the file name extension.
> fuseki:serviceUpload
> "upload" ; # Non-SPARQL upload service
>   # SPARQL Graph store protocol (read and write)  # GET, PUT, POST DELETE
> to http://host:port/feedreader/data?graph= or ?default=
> fuseki:serviceReadWriteGraphStore
> "data" ;
>   # A separate read-only graph store endpoint:
> fuseki:serviceReadGraphStore
> "get" ; # Graph store protocol (read only) -- /feedreader/get
>   fuseki:dataset <#emptyDataset> ;  .
>  ## In-memory, initially empty.  <#emptyDataset> rdf:type ja:RDFDataset .
> ##
> ------------------------------------------------------------------
> [1] https://github.com/danja/NewsMonitor
>
> [2]
>
> https://github.com/danja/NewsMonitor/blob/master/src/main/resources/templates/html/it/danja/newsmonitor/resource/update-links.ftl
>