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

ASF GitHub Bot commented on JENA-1391:
--------------------------------------

GitHub user ajs6f opened a pull request:

    https://github.com/apache/jena/pull/337

    JENA-1391: Dataset dyadic views, Model and Dataset Stream collectors

    This is a bit preliminary-- probably needs some more tests. But I wanted to 
get it out there for early comments so I can take them into account and respond 
to criticism.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ajs6f/jena JENA-1391

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/337.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #337
    
----
commit 9fd1f41870b730fcf5ea528b9fd27cd7a4ceb438
Author: ajs6f <ajs6f@...>
Date:   2017-10-01T14:02:28Z

    First draft of Collector utilities

commit 197abd4e0addd131714a541b5a900cea719b2c37
Author: ajs6f <ajs6f@...>
Date:   2017-10-12T14:07:12Z

    Refactoring to assume fresh Context for any Dataset view

commit 4d6d36969c502ad2d5df83c6324b3813993691ca
Author: ajs6f <ajs6f@...>
Date:   2017-11-03T18:06:22Z

    Better use of preexisting Pair type, refactoring, introducing 
DifferenceDatasetGraph

commit 8416e028a8a77e44f351609f4056f0a032cfedd3
Author: ajs6f <ajs6f@...>
Date:   2017-11-03T19:25:04Z

    Adding method impls to DatasetLib

commit ccf011aca6d5aef9186a510a53f3b32bb28d2982
Author: ajs6f <ajs6f@...>
Date:   2017-11-04T17:59:16Z

    Adding IntersectionDatasetGraph

commit 53861bb36212da86f7e88815bf7a29ffbd47bc7e
Author: ajs6f <ajs6f@...>
Date:   2017-11-04T18:02:07Z

    Cleaner threading of Context through constructors and statics

commit e5cc28ba852153057b37b6881c4ec1f48013de2d
Author: ajs6f <ajs6f@...>
Date:   2017-11-04T18:11:46Z

    Cleanup between DatasetLib and DatasetCollector

commit de74807555a2efce4081eee2028cdc4e7f92504e
Author: ajs6f <ajs6f@...>
Date:   2017-11-05T14:13:32Z

    Correcting whitespace

commit 272b3c10687b9e643f869d62055edec68d202e53
Author: ajs6f <ajs6f@...>
Date:   2017-11-05T14:15:04Z

    Correcting type param names

commit d4a22357ec714ac2dde218d242a36bf7f1df7d2d
Author: ajs6f <ajs6f@...>
Date:   2017-11-17T17:05:18Z

    Further simplifying new Collector API

commit 5aa0e26ca4d3dd46f77a9c993006b5cba1a6b178
Author: ajs6f <ajs6f@...>
Date:   2017-11-19T21:37:54Z

    Minor refactoring

commit 9fd57ea0593d755ceaa9ae2a78283a4940cd8d48
Author: ajs6f <ajs6f@...>
Date:   2017-12-15T20:55:05Z

    More tests

commit bbf0fc6c6ac78111ffd8827ac03a80d6ff687a7e
Author: ajs6f <ajs6f@...>
Date:   2017-12-18T14:43:10Z

    Removing extra file

commit b90c14364e3355f66ab063c797e8c476515b0ef3
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T14:03:02Z

    Further test coverage

commit d1e6b90d9cedfe063ae088d3ec595f1b629827e8
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T14:29:40Z

    Further test coverage

commit ca28e9f77bc8bd4f1e6de34bd6cb7cd8d793f324
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T15:04:36Z

    Fixing license headers, more tests

commit dcd5cd6337f063e832bb9f569eb27da4d167814a
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T15:08:26Z

    Adding license header

commit 973c6dec5111bcc8a617e0ba8a27bbafba0c759c
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T15:13:04Z

    Adding license headers

commit 5e62aff38ea56a76af047451b546153c3b3fc76a
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T15:37:28Z

    Adding more public API

commit 6162bc0928d453bc193a1b28e8d5626610927376
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T15:53:27Z

    Cleanup in TIM

commit 8e9881f52e1d8c9b0ce62883d6485e367689fd7e
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T16:33:55Z

    Linking tests into build suite

commit 01ed060f71e577d41edf2c8501e155eafbd1bb56
Author: ajs6f <ajs6f@...>
Date:   2017-12-29T17:54:56Z

    Beginning tests of dataset collectors

commit 5fa9101f383b7f86103024a3aa218754dc00ab8f
Author: ajs6f <ajs6f@...>
Date:   2017-12-31T18:45:09Z

    Tests for UnionDatasetCollector

commit 9562e71fb05d5c9910e43457a51f21eeeb188721
Author: ajs6f <ajs6f@...>
Date:   2017-12-31T18:45:47Z

    Add license headers

commit 446a6093885920b0a516187cc53aa7e4158ad70c
Author: ajs6f <ajs6f@...>
Date:   2017-12-31T19:19:06Z

    Test for TestIntersectionDatasetCollector now passes

commit 8f725b6064820930a7299cd16f06a0bb40029ed8
Author: ajs6f <ajs6f@...>
Date:   2017-12-31T19:26:34Z

    Stronger test for TestIntersectionDatasetCollector

commit 51df4d8c9b386e82edf8a6de98f13cfc917e1f9e
Author: ajs6f <ajs6f@...>
Date:   2017-12-31T19:29:11Z

    License header

commit 086f9aa4a8486587699faf99f144da54718f2cfa
Author: ajs6f <ajs6f@...>
Date:   2017-12-31T19:32:17Z

    Locking down Collector API

commit 1f794c7f6e1d05ed3cddcd3760cee3f601677bb9
Author: ajs6f <ajs6f@...>
Date:   2018-01-01T01:28:26Z

    Correct behavior on Transational::abort

commit e1c09188f720a7308f3b7b0b0c8c313eefcd9657
Author: ajs6f <ajs6f@...>
Date:   2018-01-01T01:34:29Z

    Better importing of throwNoMutationAllowed()

----


> Add Convenience Methods to Dataset
> ----------------------------------
>
>                 Key: JENA-1391
>                 URL: https://issues.apache.org/jira/browse/JENA-1391
>             Project: Apache Jena
>          Issue Type: Improvement
>          Components: ARQ
>    Affects Versions: Jena 3.4.0
>            Reporter: Adam Jacobs
>            Assignee: A. Soroka
>            Priority: Trivial
>
> The Dataset interface could provide several convenience methods similar to 
> the Model interface, allowing usability of RDF quads on par with RDF triples. 
> Specific examples include,
> # add(Dataset)
> # remove(Dataset)
> # union(Dataset)
> # intersection(Dataset)
> # difference(Dataset)
> # isEmpty()
> Following is a possible implementation of these methods.
> {code:java}
>     default Dataset add(Dataset d) {
>         this.getDefaultModel().add(d.getDefaultModel());
>         d.listNames().forEachRemaining(name -> 
> this.getNamedModel(name).add(d.getNamedModel(name)));
>         return this;
>     }
>     default Dataset remove(Dataset d) {
>         this.getDefaultModel().remove(d.getDefaultModel());
>         d.listNames().forEachRemaining(name -> 
> this.getNamedModel(name).remove(d.getNamedModel(name)));
>         return this;
>     }
>     default Dataset union(Dataset d) {
>         return DatasetFactory.create().add(this).add(d);
>     }
>     default Dataset difference(Dataset d) {
>         Dataset output = DatasetFactory.create();
>         
> output.setDefaultModel(this.getDefaultModel().difference(d.getDefaultModel()));
>         this.listNames().forEachRemaining(name -> {
>             Model difference = 
> this.getNamedModel(name).difference(d.getNamedModel(name));
>             if (!difference.isEmpty()) output.addNamedModel(name, difference);
>         });
>         return output;
>     }
>     default Dataset intersection(Dataset d) {
>         Dataset output = DatasetFactory.create();
>         
> output.setDefaultModel(this.getDefaultModel().intersection(d.getDefaultModel()));
>         Set<String> names = this.names();
>         names.retainAll(d.names());
>         names.forEach(name -> {
>             Model intersection = 
> this.getNamedModel(name).intersection(d.getNamedModel(name));
>             if (!intersection.isEmpty()) output.addNamedModel(name, 
> intersection);
>         });
>         return output;
>     }
>     default Set<String> names() {
>         Set<String> names = new HashSet<>();
>         this.listNames().forEachRemaining(names::add);
>         return names;
>     }
>     default boolean isEmpty() {
>         return this.asDatasetGraph().isEmpty();
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to