You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jason Koh <jb...@eng.ucsd.edu> on 2016/09/26 19:51:02 UTC

SPIN-Fuseki integration

Dear all,

I found a related thread about this issue back in the old days.
http://markmail.org/message/h4shizbsw2ezdojn

I however cannot find a proper implementation of SPIN API (
http://topbraid.org/spin/api/) integration to Fuseki yet. Does anybody know
a pointer to how to integrate of SPIN API and Fuseki?

I would like to store triples into Fuseki and run SPIN rules on triples in
TDB via HTTP query to Fuseki.

Thank you.


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

Re: SPIN-Fuseki integration

Posted by Andy Seaborne <an...@apache.org>.
Jason - in Eclipse, you just import the maven module and it sorts out 
setting up the project.  Or you can import the top-level POM and Eclipse 
lets you choose the modules to import.  Other IDEs act the same way.

You probably want a minimal set of jena-core, jena-arq, jena-tdb and 
jena-fuseki-core.

     Andy


On 28/09/16 23:59, Jason Koh wrote:
> OK. Then, I would like to "try" to embed SPIN into Fuseki by myself. Maybe
> I could push it later. (if people have an interest in this... It looks
> people lost interests in either Fuseki or SPIN... Otherwise, is the
> integration not a good idea?)
>
> I succeeded at cloning the repo and building Fuseki by maven, but I still
> have a few questions if you can help me.
>
> Here's what I want to do:
> 1. Whenever a flag (I define) is set in a GET and POST request, it performs
> SPIN inference or validation based on the given graph.
> 2. With a custom HTTP request, Fuseki performs SPIN inference on the entire
> graph.
>
> Questions:
> 1. What is the functions related to SPARQL query processing? I am looking
> at SPARQL_Query.java, ActionSPARQL.java, etc., but this kinda
> reverse-engineering does not work well until now. I will look into the
> JavaDoc more, but I would appreciate if I can get an enlightment here.
> 2. How can I import the entire project into an IDE? Is there a general
> recommendation on this? Text editor + mvn is quite painful to me as I am a
> junior engineer.
>
> Thank you!
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
>
> On Wed, Sep 28, 2016 at 12:33 PM, Andy Seaborne <an...@apache.org> wrote:
>
>> Jason,
>>
>> I don't know of a proper integration - it will need some kind of repacking
>> Fuseki because of getting java code into the fuseki jar or war files.
>>
>> Maybe the place to ask is the spin users list :
>> http://groups.google.com/group/topbraid-users
>>
>>     Andy
>>
>>
>> On 26/09/16 20:51, Jason Koh wrote:
>>
>>> Dear all,
>>>
>>> I found a related thread about this issue back in the old days.
>>> http://markmail.org/message/h4shizbsw2ezdojn
>>>
>>> I however cannot find a proper implementation of SPIN API (
>>> http://topbraid.org/spin/api/) integration to Fuseki yet. Does anybody
>>> know
>>> a pointer to how to integrate of SPIN API and Fuseki?
>>>
>>> I would like to store triples into Fuseki and run SPIN rules on triples in
>>> TDB via HTTP query to Fuseki.
>>>
>>> Thank you.
>>>
>>>
>>> With regards,
>>> Jason Koh
>>> cseweb.ucsd.edu/~jbkoh
>>>
>>>
>

Re: SPIN-Fuseki integration

Posted by Andy Seaborne <an...@apache.org>.

On 29/09/16 17:47, A. Soroka wrote:
> DatasetGraph covers the same ground as an RDF Dataset. So you have a
> default graph and many named graphs, each with its own triples. When
> an update is made, it is via methods that work with a single quad at
> a time. _BUT_ those methods can be (always are with Fuseki) used
> within the boundaries of a transaction, which is declared by other
> methods on DatasetGraph. So at a given moment during an update in
> Fuseki, you will have a bunch of triples sorted into different
> graphs, and you will be calling different add and remove methods.
> When the update is done, a commit method will be called on the
> DatasetGraph.
>
> So you could hook into the begin method (called to begin a
> transaction) and the add and delete methods (to keep track of what is
> being changed during the transaction/update) and then the commit
> method (so that you can trigger your rules then, using whatever
> context is appropriate).
>
> --- A. Soroka The University of Virginia Library

Yes - the unit of transactions is the dataset (= a default graph and 
zero or more named graphs)

Transactions are significant here for two reasons:

* API: Meaningful boundaries for changes from the application-domain - 
SPIN works against a whole graph so which the graph is changing, seeing 
incomplete updates is not useful.  If adding a person is 3 triples, 
foaf:Person, first name, last name values, then seeing the graph while 1 
of those 3 has been added but not the other two yet, then a rule for 
"Persons" isn't useful.  A transaction marks with begin-commit a set of 
changes.

* Unit of persistent change. A graph (model) is a view of a dataset and 
datasets are the units of transactions for robustness, persistence etc 
(all the ACID properties).

That does not preclude processing changes as they stream in. Any 
inference changes get applied to the permanent storage at the 
transaction commit.

     Andy

Re: SPIN-Fuseki integration

Posted by "A. Soroka" <aj...@virginia.edu>.
DatasetGraph covers the same ground as an RDF Dataset. So you have a default graph and many named graphs, each with its own triples. When an update is made, it is via methods that work with a single quad at a time. _BUT_ those methods can be (always are with Fuseki) used within the boundaries of a transaction, which is declared by other methods on DatasetGraph. So at a given moment during an update in Fuseki, you will have a bunch of triples sorted into different graphs, and you will be calling different add and remove methods. When the update is done, a commit method will be called on the DatasetGraph.

So you could hook into the begin method (called to begin a transaction) and the add and delete methods (to keep track of what is being changed during the transaction/update) and then the commit method (so that you can trigger your rules then, using whatever context is appropriate).

---
A. Soroka
The University of Virginia Library

> On Sep 29, 2016, at 12:42 PM, Jason Koh <jb...@eng.ucsd.edu> wrote:
> 
> Thanks for the idea. I think it is great! Though this id due to my lack of
> knowledge, one thing I am curious of is that DatasetGraph wrapper seems to
> be for the entire graph. Does it mean that it runs SPIN inference to the
> entire graph whenever I write something? I may want to apply SPIN partially
> sometimes like applying SPIN on the new triples (not sure if it sounds
> reasonable.)
> 
> I will start looking at it!
> 
> 
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
> 
> On Thu, Sep 29, 2016 at 8:37 AM, A. Soroka <aj...@virginia.edu> wrote:
> 
>> This seems a lot stronger in the end-- you get the Fuseki integration
>> desired, but this would also be useful outside that context. And the code
>> is going to be rather a lot easier to write. Much of Fuseki's code concerns
>> managing HTTP action, which isn't really of the essence to your goal.
>> 
>> ---
>> A. Soroka
>> The University of Virginia Library
>> 
>>> On Sep 29, 2016, at 11:34 AM, Andy Seaborne <an...@apache.org> wrote:
>>> 
>>> 
>>> 
>>> On 28/09/16 23:59, Jason Koh wrote:
>>> ...
>>>> Questions:
>>>> 1. What is the functions related to SPARQL query processing? I am
>> looking
>>>> at SPARQL_Query.java, ActionSPARQL.java, etc., but this kinda
>>>> reverse-engineering does not work well until now. I will look into the
>>>> JavaDoc more, but I would appreciate if I can get an enlightment here.
>>> 
>>> There is another way to hook in that may be useful.
>>> 
>>> Instead of the HTTP request lifecycle, hook into the transaction
>> lifecycle on the dataset.
>>> 
>>> 
>>> A DatasetGraph wrapper means you can add the functionality to any
>> existing dataset.
>>> 
>>> This is in jena-arq.
>>> 
>>> All Fuseki requests on the data are performed inside a transaction so if
>> you catch a write transaction, and when it commits, trigger SPIN processing.
>>> 
>>> Fuseki uses Jena's assembler mechanism to describe datasets so they can
>> be setup and configured with needing application Java code
>>> 
>>>      Andy
>> 
>> 


Re: SPIN-Fuseki integration

Posted by Jason Koh <jb...@eng.ucsd.edu>.
Thanks for the idea. I think it is great! Though this id due to my lack of
knowledge, one thing I am curious of is that DatasetGraph wrapper seems to
be for the entire graph. Does it mean that it runs SPIN inference to the
entire graph whenever I write something? I may want to apply SPIN partially
sometimes like applying SPIN on the new triples (not sure if it sounds
reasonable.)

I will start looking at it!


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Thu, Sep 29, 2016 at 8:37 AM, A. Soroka <aj...@virginia.edu> wrote:

> This seems a lot stronger in the end-- you get the Fuseki integration
> desired, but this would also be useful outside that context. And the code
> is going to be rather a lot easier to write. Much of Fuseki's code concerns
> managing HTTP action, which isn't really of the essence to your goal.
>
> ---
> A. Soroka
> The University of Virginia Library
>
> > On Sep 29, 2016, at 11:34 AM, Andy Seaborne <an...@apache.org> wrote:
> >
> >
> >
> > On 28/09/16 23:59, Jason Koh wrote:
> > ...
> >> Questions:
> >> 1. What is the functions related to SPARQL query processing? I am
> looking
> >> at SPARQL_Query.java, ActionSPARQL.java, etc., but this kinda
> >> reverse-engineering does not work well until now. I will look into the
> >> JavaDoc more, but I would appreciate if I can get an enlightment here.
> >
> > There is another way to hook in that may be useful.
> >
> > Instead of the HTTP request lifecycle, hook into the transaction
> lifecycle on the dataset.
> >
> >
> > A DatasetGraph wrapper means you can add the functionality to any
> existing dataset.
> >
> > This is in jena-arq.
> >
> > All Fuseki requests on the data are performed inside a transaction so if
> you catch a write transaction, and when it commits, trigger SPIN processing.
> >
> > Fuseki uses Jena's assembler mechanism to describe datasets so they can
> be setup and configured with needing application Java code
> >
> >       Andy
>
>

Re: SPIN-Fuseki integration

Posted by "A. Soroka" <aj...@virginia.edu>.
This seems a lot stronger in the end-- you get the Fuseki integration desired, but this would also be useful outside that context. And the code is going to be rather a lot easier to write. Much of Fuseki's code concerns managing HTTP action, which isn't really of the essence to your goal.

---
A. Soroka
The University of Virginia Library

> On Sep 29, 2016, at 11:34 AM, Andy Seaborne <an...@apache.org> wrote:
> 
> 
> 
> On 28/09/16 23:59, Jason Koh wrote:
> ...
>> Questions:
>> 1. What is the functions related to SPARQL query processing? I am looking
>> at SPARQL_Query.java, ActionSPARQL.java, etc., but this kinda
>> reverse-engineering does not work well until now. I will look into the
>> JavaDoc more, but I would appreciate if I can get an enlightment here.
> 
> There is another way to hook in that may be useful.
> 
> Instead of the HTTP request lifecycle, hook into the transaction lifecycle on the dataset.
> 
> 
> A DatasetGraph wrapper means you can add the functionality to any existing dataset.
> 
> This is in jena-arq.
> 
> All Fuseki requests on the data are performed inside a transaction so if you catch a write transaction, and when it commits, trigger SPIN processing.
> 
> Fuseki uses Jena's assembler mechanism to describe datasets so they can be setup and configured with needing application Java code
> 
> 	Andy


Re: SPIN-Fuseki integration

Posted by Andy Seaborne <an...@apache.org>.

On 28/09/16 23:59, Jason Koh wrote:
...
> Questions:
> 1. What is the functions related to SPARQL query processing? I am looking
> at SPARQL_Query.java, ActionSPARQL.java, etc., but this kinda
> reverse-engineering does not work well until now. I will look into the
> JavaDoc more, but I would appreciate if I can get an enlightment here.

There is another way to hook in that may be useful.

Instead of the HTTP request lifecycle, hook into the transaction 
lifecycle on the dataset.


A DatasetGraph wrapper means you can add the functionality to any 
existing dataset.

This is in jena-arq.

All Fuseki requests on the data are performed inside a transaction so if 
you catch a write transaction, and when it commits, trigger SPIN processing.

Fuseki uses Jena's assembler mechanism to describe datasets so they can 
be setup and configured with needing application Java code

	Andy

Re: SPIN-Fuseki integration

Posted by Jason Koh <jb...@eng.ucsd.edu>.
OK. Then, I would like to "try" to embed SPIN into Fuseki by myself. Maybe
I could push it later. (if people have an interest in this... It looks
people lost interests in either Fuseki or SPIN... Otherwise, is the
integration not a good idea?)

I succeeded at cloning the repo and building Fuseki by maven, but I still
have a few questions if you can help me.

Here's what I want to do:
1. Whenever a flag (I define) is set in a GET and POST request, it performs
SPIN inference or validation based on the given graph.
2. With a custom HTTP request, Fuseki performs SPIN inference on the entire
graph.

Questions:
1. What is the functions related to SPARQL query processing? I am looking
at SPARQL_Query.java, ActionSPARQL.java, etc., but this kinda
reverse-engineering does not work well until now. I will look into the
JavaDoc more, but I would appreciate if I can get an enlightment here.
2. How can I import the entire project into an IDE? Is there a general
recommendation on this? Text editor + mvn is quite painful to me as I am a
junior engineer.

Thank you!


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Wed, Sep 28, 2016 at 12:33 PM, Andy Seaborne <an...@apache.org> wrote:

> Jason,
>
> I don't know of a proper integration - it will need some kind of repacking
> Fuseki because of getting java code into the fuseki jar or war files.
>
> Maybe the place to ask is the spin users list :
> http://groups.google.com/group/topbraid-users
>
>     Andy
>
>
> On 26/09/16 20:51, Jason Koh wrote:
>
>> Dear all,
>>
>> I found a related thread about this issue back in the old days.
>> http://markmail.org/message/h4shizbsw2ezdojn
>>
>> I however cannot find a proper implementation of SPIN API (
>> http://topbraid.org/spin/api/) integration to Fuseki yet. Does anybody
>> know
>> a pointer to how to integrate of SPIN API and Fuseki?
>>
>> I would like to store triples into Fuseki and run SPIN rules on triples in
>> TDB via HTTP query to Fuseki.
>>
>> Thank you.
>>
>>
>> With regards,
>> Jason Koh
>> cseweb.ucsd.edu/~jbkoh
>>
>>

Re: SPIN-Fuseki integration

Posted by Andy Seaborne <an...@apache.org>.
Jason,

I don't know of a proper integration - it will need some kind of 
repacking Fuseki because of getting java code into the fuseki jar or war 
files.

Maybe the place to ask is the spin users list : 
http://groups.google.com/group/topbraid-users

     Andy

On 26/09/16 20:51, Jason Koh wrote:
> Dear all,
>
> I found a related thread about this issue back in the old days.
> http://markmail.org/message/h4shizbsw2ezdojn
>
> I however cannot find a proper implementation of SPIN API (
> http://topbraid.org/spin/api/) integration to Fuseki yet. Does anybody know
> a pointer to how to integrate of SPIN API and Fuseki?
>
> I would like to store triples into Fuseki and run SPIN rules on triples in
> TDB via HTTP query to Fuseki.
>
> Thank you.
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
>