Alright, that makes sense now. I only need to find an example to follow and write my own extension.
Thanks. On Wed, May 29, 2013 at 7:08 PM, Rob Vesse <[email protected]> wrote: > One option is to look at the DatasetGraphMonitor class which provides a > for wrapping another dataset (e.g. a TDB one) and then responding to > changes e.g. by validating constraints. Bear in mind that this will see > each change as it arrives and you may not want to validate constraints > until an entire update has finished (since presumably you allow for > inconsistent states mid-update). In principal this should be possible > since the monitor informs a DatasetChanges implementation which has a > start() and finish() method but this doesn't appear to get called anywhere. > > A better alternative might be to implement a custom UpdateEngine and > validate constraints in the finishRequest() call since your guaranteed > that a complete update has happened at that point. You can then throw an > error if the constraints are violated which will have the side effect or > rendering the transaction as failed and causing the updates to be > discarded. If you do this then you will need to use the ja:loadClass > mechanism to integrate into Fuseki since you will need to write some code > to wire in your custom update engine. > > Rob > > > On 5/29/13 2:12 PM, "Matías Parodi" <[email protected]> wrote: > > >Hello, > > > >Thanks for your answer. In my first email on this thread I explained what > >I > >was trying to achieve: > > > >I'm using Jena rhrough Fuseki from a Ruby on Rails web app, now I want to > >add Spin to the stack so I can force some constraints on the insertions. > >What you said in your last paragraph is exactly what I want to do, and > >yes, > >the example I pasted is from Spin's distribution. > > > >Matt > > > > > >On Wed, May 29, 2013 at 6:03 PM, Rob Vesse <[email protected]> wrote: > > > >> The class that Fuseki needs to load can be essentially anything, however > >> when you mentioned a class with ja:loadClass all that actually happens > >>is > >> that the class is initialized I.e. it's static initializer block (if > >>any) > >> gets called. Typically you would use the static initializer block to > >>wire > >> up things into Fuseki e.g. adding custom query engines etc. > >> > >> > >> It is unclear exactly what you are trying to do, the example you copy > >>and > >> pasted (which appears to be direct from the SPIN examples) is a command > >> line program that does a one time validation of some data against some > >> SPIN constraints. If you use the example you gave absolutely nothing > >>will > >> happen since there is no static initializer block and the main() method > >> will never get called. > >> > >> Presumably you are wanting to integrate SPIN with Fuseki so that you can > >> continually validate SPIN constraints as new data is added to the > >>system? > >> If you can explain your goals better then you will get better answers > >> > >> Rob > >> > >> On 5/29/13 1:22 PM, "Matías Parodi" <[email protected]> wrote: > >> > >> >I guess this is it: http://paste.kde.org/753266/ > >> > > >> >I couldn't find any real example of what to put in the class Fuseki > >>needs > >> >to load, all I found is that I can load the class using ja:loadClass > >>(btw, > >> >loadClass is not even in the vocabulary, I don't know where it's > >> >defined......) > >> > > >> >Am I supposed to compile the example I pasted above? How does fuseki > >>know > >> >when to call it? I'm confused now.. > >> > > >> >Thanks. > >> > > >> > > >> >On Wed, May 29, 2013 at 12:10 PM, Martynas Jusevičius > >> ><[email protected] > >> >> wrote: > >> > > >> >> Not sure about Fuseki architecture, as I'm using JAX-RS REST layer > >> >> over Jena instead. But yeah it looks like you'll need to write some > >> >> Java code and plug it in. It could work as a request filter of some > >> >> kind. > >> >> > >> >> SPINConstraints is probably the class you need, I think an example > >> >> should be included with the API: > >> >> > >> >> > >> >> > >> > >> > http://topbraid.org/spin/api/1.2.0/spin/apidocs/org/topbraid/spin/constra > >> >>ints/SPINConstraints.html > >> >> 1.3.0 Javadoc is not online though, you would have to look in the > >> >> distribution. > >> >> > >> >> Martynas > >> >> > >> >> On Wed, May 29, 2013 at 6:01 PM, Matías Parodi > >><[email protected]> > >> >> wrote: > >> >> > Thank you for your answer. The Spin's distribution I downloaded > >>from > >> >>the > >> >> > link you pasted above only has Java examples, useful when your > >> >> application > >> >> > is using Jena directly. I'm using Jena through Fuseki, it's a Ruby > >>on > >> >> Rails > >> >> > app... > >> >> > > >> >> > I guess I'll have to write a class with <something> and ask Fuseki > >>to > >> >> load > >> >> > it on startup, I'm trying to find an example now. > >> >> > > >> >> > > >> >> > On Wed, May 29, 2013 at 11:44 AM, Martynas Jusevičius < > >> >> [email protected] > >> >> >> wrote: > >> >> > > >> >> >> Hey Matias, > >> >> >> > >> >> >> I'm using SPIN API in Graphity Linked Data platform. Here's an > >> >>example > >> >> >> of a SPIN-based SPARQL QueryBuilder: > >> >> >> > >> >> >> > >> >> > >> >> > >> > >> > https://github.com/Graphity/graphity-browser/blob/master/src/main/java/or > >> >>g/graphity/processor/query/QueryBuilder.java > >> >> >> > >> >> >> I'm also planning to use SPIN constraints to validate incoming RDF > >> >> input. > >> >> >> > >> >> >> You can add SPIN dependency as described here: > >> >> >> http://topbraid.org/spin/api/ > >> >> >> The documentation is scarce, but you can look at the code since > >>it's > >> >> >> open-source. Constraints are handled by the SPINConstraints > >>class, as > >> >> >> far as I remember. You can also get help from Holger in the Google > >> >> >> Group: > >> >> >> > https://groups.google.com/forum/?fromgroups=#!forum/topbraid-users > >> >> >> > >> >> >> Martynas > >> >> >> graphityhq.com > >> >> >> > >> >> >> On Wed, May 29, 2013 at 5:23 PM, David Jordan > >><[email protected]> > >> >> >> wrote: > >> >> >> > I have the same interests, but don't have a commitment to > >>Pellet, > >> >>at > >> >> >> least not yet. > >> >> >> > > >> >> >> > -----Original Message----- > >> >> >> > From: Matías Parodi [mailto:[email protected]] > >> >> >> > Sent: Wednesday, May 29, 2013 10:17 AM > >> >> >> > To: [email protected] > >> >> >> > Subject: Spin integration > >> >> >> > > >> >> >> > Hello, > >> >> >> > > >> >> >> > I haven't found information about how to integrate Spin > >> >>(spinrdf.org) > >> >> >> with Jena. Is there any way to do so? > >> >> >> > > >> >> >> > I'll really appreciate any information on that matter since the > >> >> >> application I'm working on uses Jena through Fuseki, and now I > >>need > >> >>to > >> >> >> force some constraints when an insertion is done in TDB. > >> >> >> > > >> >> >> > By the way, I'm using the reasoner Pellet. > >> >> >> > > >> >> >> > Thank you, > >> >> >> > Matt > >> >> >> > >> >> > >> > >> > >
