Modifying Data with SPARQLMotion Web Services

35 views
Skip to first unread message

Dean Rzonca

unread,
Dec 14, 2010, 1:22:46 PM12/14/10
to TopBraid Suite Users
The SPARQLMotion Tutorial (http://www.topquadrant.com/sparqlmotion/
tutorial/SPARQLMotionTutorial-2.0.pdf) describes a way to run
SPARQLMotion scripts as web services, which we are currently doing for
several scripts that retrieve and export data.

However, we also have a number of scripts that modify session data.
They use the PerformUpdate module with statements like INSERT INTO
<http://tb-session> or DELETE FROM <http://tb-session>. Is it possible
to run these as web services as well?

Thanks for your help,
Dean

Scott Henninger

unread,
Dec 14, 2010, 2:23:49 PM12/14/10
to TopBraid Suite Users
Dean; Yes it is possible to run these scripts via a Web service, but
you will not be able to use the ImportCurrentRDF module. A Web
service is stateless, so the script will need to explicitly state
which graph is the source for the script data. I.e. you will need to
use ImportRDFFromWorkspace, etc.

One way to explain this is through the documentation for
ImportCurrentRDF, which states:

"Depending on the context, this module delivers different results.

When called from a TBE session, this will return the session's RDF
graph.

When called from TBC, this will also return the RDF graph of the
currently open file. In many use cases this will include the script
itself, unless the script is a background service such as an
sml:TrackChanges script.

When called from a user-defined SPARQLMotion/SPIN Function, this
module will return the context graph, which is the graph that the
surrounding SPARQL query will currently operate on.

When called as a TopBraid Live (stand-alone) web service, this module
will throw an exception because there is no current graph available."

-- Scott

Dean Rzonca

unread,
Dec 14, 2010, 3:08:24 PM12/14/10
to TopBraid Suite Users
Thanks, Scott.

I assumed this was the case, but I wanted to be sure.

We have several scripts that modify session data that we need to be
able to run outside of Ensemble (really, outside Flex in general) from
a Java service. Is there any way to programmatically create a session,
and run these scripts within the context of that session?

Since there is already documentation on running scripts as web
services, that seemed like the best place to start, but we can use
other mechanisms if need be.

On Dec 14, 2:23 pm, Scott Henninger <shennin...@topquadrant.com>
wrote:

Scott Henninger

unread,
Dec 14, 2010, 11:19:59 PM12/14/10
to TopBraid Suite Users
Dean; Yes, a SPARQLMotion script can be executed programmatically by
any entity that can call a Web service. For example, copy the example
script found at http://www.topquadrant.com/products/SPARQLMotion_docs/SPARQLMotion_ex_dbpedia.html
into your TBL workspace. The use the following URL to invoke the
script:
http://[server]:[port]/tbl/tbl/actions?action=sparqlmotion&id=FindByCallingCode&callingCode=61

...replacing the server and port with your TBL server information.
This service can be called by any entity that can invoke the above
query string.
-- Scott

Dean Rzonca

unread,
Dec 15, 2010, 1:20:27 PM12/15/10
to TopBraid Suite Users
Right, but I also need to be able to programmatically create a
session, and then programmatically run a script within that session.

Is that possible?

On Dec 14, 11:19 pm, Scott Henninger <shennin...@topquadrant.com>
wrote:
> Dean; Yes, a SPARQLMotion script can be executed programmatically by
> any entity that can call a Web service.  For example, copy the example
> script found athttp://www.topquadrant.com/products/SPARQLMotion_docs/SPARQLMotion_ex...

Scott Henninger

unread,
Dec 15, 2010, 2:26:25 PM12/15/10
to TopBraid Suite Users
Well, I'm not sure exactly what you mean. One can, of course,
programmatically create a session with Java. See, for example,
http://en.wikipedia.org/wiki/Session_%28computer_science%29 for more
on HTTP sessions. Note that a concept of a REST Web service, which is
stateless, and a session, which represents state information, are in
conflict.

A SPARQLMotion script automatically creates a session while it
executes. Therefore invoking a script automatically "programmatically
create[s] a session, and then programmatically run[s] a script within
that session". But this is a low-level detail that does not concern a
TBL Web service client.

So all you need for executing a script is already taken care of by
TBL. No further session programming is necessary. For example, it is
possible to create a Web application without Ensemble or Live SDK/Flex
by using Web service calls to the TBL server. Semantic Web Pages
(SWP, formerly known as UISPIN) is a technology for creating such
applications. See http://uispin.org/

If you need some other than this, we'll need a bit more of a
description of the use case. In particular, I'm not sure what you
would need HTTP sessions for beyond what is provided by TBL.

-- Scott

Holger Knublauch

unread,
Dec 15, 2010, 5:37:01 PM12/15/10
to topbrai...@googlegroups.com
I am speculating a bit here, but maybe Dean's use case is that he wants to access a TBE user session, so that http://tb-session (aka urn:x-tb:session) becomes meaningful. This is not supported in stand-alone web service calls. You need to figure out the URI (graph name) of the target graph instead. Programmatically creating TopBraid sessions is not supported.

Holger

> --
> You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
> TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
> To post to this group, send email to
> topbrai...@googlegroups.com
> To unsubscribe from this group, send email to
> topbraid-user...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/topbraid-users?hl=en

Dean Rzonca

unread,
Dec 16, 2010, 5:18:29 PM12/16/10
to TopBraid Suite Users
Thanks, Holger. That's exactly what we need to be able to do- sorry if
I wasn't clear at first. I was afraid it wasn't going to work, but I
wanted to be sure.

I have a somewhat related question. In the TopBraid Suite Console, I
can get a list of currently active users and sessions by going to
TopBraid Live Server Administration -> Session Management. Is there
any programmatic way to get this same information, such as a call to a
web service or a method in the Ensemble SDK?

Thanks,
Dean


On Dec 15, 5:37 pm, Holger Knublauch <hol...@topquadrant.com> wrote:
> I am speculating a bit here, but maybe Dean's use case is that he wants to access a TBE user session, so thathttp://tb-session(aka urn:x-tb:session) becomes meaningful. This is not supported in stand-alone web service calls. You need to figure out the URI (graph name) of the target graph instead. Programmatically creating TopBraid sessions is not supported.
>
> Holger
>
> On Dec 16, 2010, at 5:26 AM, Scott Henninger wrote:
>
>
>
>
>
>
>
> > Well, I'm not sure exactly what you mean.  One can, of course,
> > programmatically create a session with Java.  See, for example,
> >http://en.wikipedia.org/wiki/Session_%28computer_science%29for more
> > on HTTP sessions.  Note that a concept of a REST Web service, which is
> > stateless, and a session, which represents state information, are in
> > conflict.
>
> > A SPARQLMotion script automatically creates a session while it
> > executes.  Therefore invoking a script automatically "programmatically
> > create[s] a session, and then programmatically run[s] a script within
> > that session".  But this is a low-level detail that does not concern a
> > TBL Web service client.
>
> > So all you need for executing a script is already taken care of by
> > TBL.  No further session programming is necessary.  For example, it is
> > possible to create a Web application without Ensemble or Live SDK/Flex
> > by using Web service calls to the TBL server.  Semantic Web Pages
> > (SWP, formerly known as UISPIN) is a technology for creating such
> > applications.  Seehttp://uispin.org/

Scott Henninger

unread,
Dec 19, 2010, 2:48:05 PM12/19/10
to TopBraid Suite Users
Dean; We don't currently support a way to get a list of currently
active users. We will add this as an enhancement request.

-- Scott

On Dec 16, 4:18 pm, Dean Rzonca <dean.rzo...@gmail.com> wrote:
> Thanks, Holger. That's exactly what we need to be able to do- sorry if
> I wasn't clear at first. I was afraid it wasn't going to work, but I
> wanted to be sure.
>
> I have a somewhat related question. In the TopBraid Suite Console, I
> can get a list of currently active users and sessions by going to
> TopBraid Live Server Administration -> Session Management. Is there
> any programmatic way to get this same information, such as a call to a
> web service or a method in the Ensemble SDK?
>
> Thanks,
> Dean
>
> On Dec 15, 5:37 pm, Holger Knublauch <hol...@topquadrant.com> wrote:
>
> > I am speculating a bit here, but maybe Dean's use case is that he wants to access a TBE user session, so thathttp://tb-session(akaurn:x-tb:session) becomes meaningful. This is not supported in stand-alone web service calls. You need to figure out the URI (graph name) of the target graph instead. Programmatically creating TopBraid sessions is not supported.
Reply all
Reply to author
Forward
0 new messages