[ 
https://issues.apache.org/jira/browse/JENA-1786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16984485#comment-16984485
 ] 

Andy Seaborne edited comment on JENA-1786 at 11/28/19 3:14 PM:
---------------------------------------------------------------

Re:  DatasetGraphWrapper – good point.

It is a bit mixed - sometimes  DatasetGraphWrapper is just used to intercept 
one or two methods for passive reasons (e.g. logging, or add a extra field) 
where disturbing the graph returned isn't right. In other words, while it is a 
common case to have view graphs of the wrapped dataset, sometimes it isn't.

It might have been better to make it abstract in DatasetGraphWrapper to remind 
the implementer to think about the issue.

DatasetGraphWrapper is a mechanically pattern for a wrapper class.

We are discussing longer term issues for jena on the dev@ list - there do seem 
to be quite a few wrapper/extension classes and maybe either (1) build it into 
the hierarchy or (2) there are some better building blocks.


was (Author: andy.seaborne):
Re:  DatasetGraphWrapper – good point.

It is a bit mixed - sometimes  DatasetGraphWrapper is just used to intercept 
one or two methods for passive reasons (e.g. logging, or add a extra field) 
where disturbing the graph returned isn't right. In other words, while it is a 
common case to have view graphs of the wrapped dataset, sometimes it isn't.

It might have been better to make it abstract in DatasetGraphWrapper to remind 
the implementer to think about the issue.

DatasetGraphWrapper is a mechanically pattern for a wrapper class.

 

> DatasetGraphMonitor exposes unwrapped graphs
> --------------------------------------------
>
>                 Key: JENA-1786
>                 URL: https://issues.apache.org/jira/browse/JENA-1786
>             Project: Apache Jena
>          Issue Type: Bug
>            Reporter: Pavel Mikhailovskii
>            Assignee: Andy Seaborne
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Both DatasetGraphMonitor.getDefaultGraph and DatasetGraphMonitor.getGraph  
> expose unwrapped graphs from the underlying DatasetGraph. Any changes made to 
> those graphs skip DatasetGraphMonitor's change monitoring. 
> To reproduce:
> {code:java}
>    public class TestDatasetMonitor extends BaseTest {
>     ...
>     @Test public void countChanges_05() {
>         DatasetGraph dsgBase = DatasetGraphFactory.create() ;
>         DatasetChangesCounter dsgChanges = new DatasetChangesCounter() ;
>         DatasetGraph dsg = new DatasetGraphMonitor(dsgBase, dsgChanges) ;
>         check(dsgChanges, 0, 0, 0, 0) ;
>         Graph g = dsg.getDefaultGraph();
>         g.add(quad1.asTriple()) ;
>         g.delete(quad1.asTriple()) ;
>         g.add(quad1.asTriple()) ;
>         g.delete(quad1.asTriple()) ;
>         check(dsgChanges, 2, 2, 0, 0) ; 
>     }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to