You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by anuj kumar <an...@gmail.com> on 2017/10/27 10:42:54 UTC

How to derive Change Statements

Hi Jena Users,
 I have a query regarding the most effective way to capture changes in the
underlying Triple Store.
I have a requirement where:
1. Every time a property of a Node (represented as a Triple Statement)
changes, I also need to generate certain change statements to capture what
has changed, who changed it, when it was changed etc.
2. If I delete a Node (represented as a Set of Triples in the RDF Store), I
need to capture the action DELETE on this node, who deleted the node, when
it was deleted etc.

Basically, I need to have a audit trail developed so that I  can create the
graph as it was at a given moment in time.

The question is:
1. What is the best way to implement such functionality? Does Jena support
such a thing either natively or through some standard mechanism?

Thanks,
-- 
*Anuj Kumar*

Re: How to derive Change Statements

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

Jena has some building blocks: GraphListener, DatasetChanges

GraphListener enables an app to watch every change on a graph.
DatasetGraphMonitor/DatasetChanges can be used if you want to look at a 
dataset.

Both give you triggers on individual triple/quad changes on which you 
can add application code.

GraphListener includes some identification of groups of changes but only 
when the changes are made as a single operation which might be hard in 
the app (e.g. deletes and inserts). Even then, the bulk operations can 
get lost in hierarchies of graphs wrapping other graphs. 
DatasetGraphMonitor does not provide grouped operations anyway.

See also org.apache.jena.graph.GraphUtil

----

I have the need to work with logical collections of changes.

Caution:
   work-in-progress alter
   not part of Jena

https://afs.github.io/rdf-delta/rdf-patch.html

Here, transactions are captured so there are logical groups of changes 
such as your #2 requirement.

Annotating, or linking to RDF Patches gives an audit.

In my $job, this is used to replicate changes between databases (High 
Availability).

     Andy

On 27/10/17 11:42, anuj kumar wrote:
> Hi Jena Users,
>   I have a query regarding the most effective way to capture changes in the
> underlying Triple Store.
> I have a requirement where:
> 1. Every time a property of a Node (represented as a Triple Statement)
> changes, I also need to generate certain change statements to capture what
> has changed, who changed it, when it was changed etc.
> 2. If I delete a Node (represented as a Set of Triples in the RDF Store), I
> need to capture the action DELETE on this node, who deleted the node, when
> it was deleted etc.
> 
> Basically, I need to have a audit trail developed so that I  can create the
> graph as it was at a given moment in time.
> 
> The question is:
> 1. What is the best way to implement such functionality? Does Jena support
> such a thing either natively or through some standard mechanism?
> 
> Thanks,
> 

Re: How to derive Change Statements

Posted by Claude Warren <cl...@xenei.com>.
Just to clear up any misunderstanding, the permissions layers in not tied
to Fuseki, I was thinking Fuseki in my answer as you wanted to know who was
making changes and Fuseki would handle that part.  If you have another
mechanism to track who is making the change the permissions layer will work.

Claude

On Mon, Oct 30, 2017 at 9:52 AM, anuj kumar <an...@gmail.com> wrote:

> Hey Claude,
>  I am not using Fuseki and thus the solution you propose will not be a
> feasible one for me.
>
> Andy,
>  Thanks for the information on GraphListener, DatasetChanges as well as
> rdf-patch. I think using these tools I will e able to handle my use cases.
> Let me give them a try and see if I stumble upon some rabbit hole.
>
> Thanks,
> Anuj Kumar
>
> On Fri, Oct 27, 2017 at 2:39 PM, Claude Warren <cl...@xenei.com> wrote:
>
> > Since you need to detect who changed what the only way I can see to do
> this
> > is turn on authentication on Fuseki and track changes made through it.
> >
> > You could bastardise the permissions layer[1] to do what you want.  The
> > permissions layer will let you filter down to the actions on the triples,
> > rather than implementing a SecurityEvaluator to perform the restriction
> you
> > could implement it record all changes (including who made them) in any
> > storage and format you wish.
> >
> > 1. https://jena.apache.org/documentation/permissions/index.html
> >
> >
> > On Fri, Oct 27, 2017 at 11:42 AM, anuj kumar <an...@gmail.com>
> > wrote:
> >
> > > Hi Jena Users,
> > >  I have a query regarding the most effective way to capture changes in
> > the
> > > underlying Triple Store.
> > > I have a requirement where:
> > > 1. Every time a property of a Node (represented as a Triple Statement)
> > > changes, I also need to generate certain change statements to capture
> > what
> > > has changed, who changed it, when it was changed etc.
> > > 2. If I delete a Node (represented as a Set of Triples in the RDF
> > Store), I
> > > need to capture the action DELETE on this node, who deleted the node,
> > when
> > > it was deleted etc.
> > >
> > > Basically, I need to have a audit trail developed so that I  can create
> > the
> > > graph as it was at a given moment in time.
> > >
> > > The question is:
> > > 1. What is the best way to implement such functionality? Does Jena
> > support
> > > such a thing either natively or through some standard mechanism?
> > >
> > > Thanks,
> > > --
> > > *Anuj Kumar*
> > >
> >
> >
> >
> > --
> > I like: Like Like - The likeliest place on the web
> > <http://like-like.xenei.com>
> > LinkedIn: http://www.linkedin.com/in/claudewarren
> >
>
>
>
> --
> *Anuj Kumar*
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: How to derive Change Statements

Posted by anuj kumar <an...@gmail.com>.
Thanks for the Clarification Claude and asf. I get what you are suggesting.
As asf said, i believe the approach using DataSetChanges and GraphListener
is a bit closer to what I want to achieve.

Thanks,
Anuj

On Mon, Oct 30, 2017 at 11:15 AM, <aj...@apache.org> wrote:

> Claude's approach isn't Fuseki-specific. You can use the jena-permissions
> module directly, and that might even be easier. But certainly,
> GraphListener and DatasetChanges are probably closer already to what you
> want.
>
>
> ajs6f
>
> anuj kumar wrote on 10/30/17 5:52 AM:
>
> Hey Claude,
>>  I am not using Fuseki and thus the solution you propose will not be a
>> feasible one for me.
>>
>> Andy,
>>  Thanks for the information on GraphListener, DatasetChanges as well as
>> rdf-patch. I think using these tools I will e able to handle my use cases.
>> Let me give them a try and see if I stumble upon some rabbit hole.
>>
>> Thanks,
>> Anuj Kumar
>>
>> On Fri, Oct 27, 2017 at 2:39 PM, Claude Warren <cl...@xenei.com> wrote:
>>
>> Since you need to detect who changed what the only way I can see to do
>>> this
>>> is turn on authentication on Fuseki and track changes made through it.
>>>
>>> You could bastardise the permissions layer[1] to do what you want.  The
>>> permissions layer will let you filter down to the actions on the triples,
>>> rather than implementing a SecurityEvaluator to perform the restriction
>>> you
>>> could implement it record all changes (including who made them) in any
>>> storage and format you wish.
>>>
>>> 1. https://jena.apache.org/documentation/permissions/index.html
>>>
>>>
>>> On Fri, Oct 27, 2017 at 11:42 AM, anuj kumar <an...@gmail.com>
>>> wrote:
>>>
>>> Hi Jena Users,
>>>>  I have a query regarding the most effective way to capture changes in
>>>>
>>> the
>>>
>>>> underlying Triple Store.
>>>> I have a requirement where:
>>>> 1. Every time a property of a Node (represented as a Triple Statement)
>>>> changes, I also need to generate certain change statements to capture
>>>>
>>> what
>>>
>>>> has changed, who changed it, when it was changed etc.
>>>> 2. If I delete a Node (represented as a Set of Triples in the RDF
>>>>
>>> Store), I
>>>
>>>> need to capture the action DELETE on this node, who deleted the node,
>>>>
>>> when
>>>
>>>> it was deleted etc.
>>>>
>>>> Basically, I need to have a audit trail developed so that I  can create
>>>>
>>> the
>>>
>>>> graph as it was at a given moment in time.
>>>>
>>>> The question is:
>>>> 1. What is the best way to implement such functionality? Does Jena
>>>>
>>> support
>>>
>>>> such a thing either natively or through some standard mechanism?
>>>>
>>>> Thanks,
>>>> --
>>>> *Anuj Kumar*
>>>>
>>>>
>>>
>>>
>>> --
>>> I like: Like Like - The likeliest place on the web
>>> <http://like-like.xenei.com>
>>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>>
>>>
>>
>>
>>


-- 
*Anuj Kumar*

Re: How to derive Change Statements

Posted by aj...@apache.org.
Claude's approach isn't Fuseki-specific. You can use the jena-permissions module directly, and that might even be 
easier. But certainly, GraphListener and DatasetChanges are probably closer already to what you want.


ajs6f

anuj kumar wrote on 10/30/17 5:52 AM:
> Hey Claude,
>  I am not using Fuseki and thus the solution you propose will not be a
> feasible one for me.
>
> Andy,
>  Thanks for the information on GraphListener, DatasetChanges as well as
> rdf-patch. I think using these tools I will e able to handle my use cases.
> Let me give them a try and see if I stumble upon some rabbit hole.
>
> Thanks,
> Anuj Kumar
>
> On Fri, Oct 27, 2017 at 2:39 PM, Claude Warren <cl...@xenei.com> wrote:
>
>> Since you need to detect who changed what the only way I can see to do this
>> is turn on authentication on Fuseki and track changes made through it.
>>
>> You could bastardise the permissions layer[1] to do what you want.  The
>> permissions layer will let you filter down to the actions on the triples,
>> rather than implementing a SecurityEvaluator to perform the restriction you
>> could implement it record all changes (including who made them) in any
>> storage and format you wish.
>>
>> 1. https://jena.apache.org/documentation/permissions/index.html
>>
>>
>> On Fri, Oct 27, 2017 at 11:42 AM, anuj kumar <an...@gmail.com>
>> wrote:
>>
>>> Hi Jena Users,
>>>  I have a query regarding the most effective way to capture changes in
>> the
>>> underlying Triple Store.
>>> I have a requirement where:
>>> 1. Every time a property of a Node (represented as a Triple Statement)
>>> changes, I also need to generate certain change statements to capture
>> what
>>> has changed, who changed it, when it was changed etc.
>>> 2. If I delete a Node (represented as a Set of Triples in the RDF
>> Store), I
>>> need to capture the action DELETE on this node, who deleted the node,
>> when
>>> it was deleted etc.
>>>
>>> Basically, I need to have a audit trail developed so that I  can create
>> the
>>> graph as it was at a given moment in time.
>>>
>>> The question is:
>>> 1. What is the best way to implement such functionality? Does Jena
>> support
>>> such a thing either natively or through some standard mechanism?
>>>
>>> Thanks,
>>> --
>>> *Anuj Kumar*
>>>
>>
>>
>>
>> --
>> I like: Like Like - The likeliest place on the web
>> <http://like-like.xenei.com>
>> LinkedIn: http://www.linkedin.com/in/claudewarren
>>
>
>
>

Re: How to derive Change Statements

Posted by anuj kumar <an...@gmail.com>.
Hey Claude,
 I am not using Fuseki and thus the solution you propose will not be a
feasible one for me.

Andy,
 Thanks for the information on GraphListener, DatasetChanges as well as
rdf-patch. I think using these tools I will e able to handle my use cases.
Let me give them a try and see if I stumble upon some rabbit hole.

Thanks,
Anuj Kumar

On Fri, Oct 27, 2017 at 2:39 PM, Claude Warren <cl...@xenei.com> wrote:

> Since you need to detect who changed what the only way I can see to do this
> is turn on authentication on Fuseki and track changes made through it.
>
> You could bastardise the permissions layer[1] to do what you want.  The
> permissions layer will let you filter down to the actions on the triples,
> rather than implementing a SecurityEvaluator to perform the restriction you
> could implement it record all changes (including who made them) in any
> storage and format you wish.
>
> 1. https://jena.apache.org/documentation/permissions/index.html
>
>
> On Fri, Oct 27, 2017 at 11:42 AM, anuj kumar <an...@gmail.com>
> wrote:
>
> > Hi Jena Users,
> >  I have a query regarding the most effective way to capture changes in
> the
> > underlying Triple Store.
> > I have a requirement where:
> > 1. Every time a property of a Node (represented as a Triple Statement)
> > changes, I also need to generate certain change statements to capture
> what
> > has changed, who changed it, when it was changed etc.
> > 2. If I delete a Node (represented as a Set of Triples in the RDF
> Store), I
> > need to capture the action DELETE on this node, who deleted the node,
> when
> > it was deleted etc.
> >
> > Basically, I need to have a audit trail developed so that I  can create
> the
> > graph as it was at a given moment in time.
> >
> > The question is:
> > 1. What is the best way to implement such functionality? Does Jena
> support
> > such a thing either natively or through some standard mechanism?
> >
> > Thanks,
> > --
> > *Anuj Kumar*
> >
>
>
>
> --
> I like: Like Like - The likeliest place on the web
> <http://like-like.xenei.com>
> LinkedIn: http://www.linkedin.com/in/claudewarren
>



-- 
*Anuj Kumar*

Re: How to derive Change Statements

Posted by Claude Warren <cl...@xenei.com>.
Since you need to detect who changed what the only way I can see to do this
is turn on authentication on Fuseki and track changes made through it.

You could bastardise the permissions layer[1] to do what you want.  The
permissions layer will let you filter down to the actions on the triples,
rather than implementing a SecurityEvaluator to perform the restriction you
could implement it record all changes (including who made them) in any
storage and format you wish.

1. https://jena.apache.org/documentation/permissions/index.html


On Fri, Oct 27, 2017 at 11:42 AM, anuj kumar <an...@gmail.com>
wrote:

> Hi Jena Users,
>  I have a query regarding the most effective way to capture changes in the
> underlying Triple Store.
> I have a requirement where:
> 1. Every time a property of a Node (represented as a Triple Statement)
> changes, I also need to generate certain change statements to capture what
> has changed, who changed it, when it was changed etc.
> 2. If I delete a Node (represented as a Set of Triples in the RDF Store), I
> need to capture the action DELETE on this node, who deleted the node, when
> it was deleted etc.
>
> Basically, I need to have a audit trail developed so that I  can create the
> graph as it was at a given moment in time.
>
> The question is:
> 1. What is the best way to implement such functionality? Does Jena support
> such a thing either natively or through some standard mechanism?
>
> Thanks,
> --
> *Anuj Kumar*
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren