But that would still require the functional subclasses of Query?
On Wed, Dec 14, 2016 at 11:37 AM, Andy Seaborne <a...@apache.org> wrote: > > > On 12/12/16 21:45, Martynas Jusevičius wrote: >> >> Well, this probably requires some generic method(s) in Dataset/Model >> as well, something like: >> >> T apply(Function<Dataset, T> f); >> >> This would allow nice chaining of multiple queries, e.g DESCRIBE and >> SELECT: >> >> ResultSet results = dataset.apply(describe).apply(select); > > > No need to extend dataset and model and the rest to get experimenting: > > static <T,X> T apply(X object, Function<X, T> f) { > return f.apply(object); > } > // BiFunction<X, Function<X, T>, T> > > > then > > ResultSet results = apply( > apply(dataset, describe), > select); > > > The function f does have any access to the internals of a specific dataset > so it does not need to be a method of Dataset. > > There is a style thing about how it looks if you are not used to reading > functional application (i.e. backwards!). > > Andy > > >> >> Seems more elegant to me than all the QueryExecution boilerplate. >> >> On Mon, Dec 12, 2016 at 9:00 PM, A. Soroka <aj...@virginia.edu> wrote: >>> >>> What are the kinds of usages to which you are imagining these kind of >>> types being put? >>> >>> --- >>> A. Soroka >>> The University of Virginia Library >>> >>>> On Dec 12, 2016, at 2:03 PM, Martynas Jusevičius <marty...@graphity.org> >>>> wrote: >>>> >>>> Hey, >>>> >>>> has Jena considered taking advantage of the functional features in Java >>>> 8? >>>> >>>> What I have in mind is interfaces like: >>>> >>>> Construct extends Query implements Function<Dataset, Model> >>>> >>>> Describe extends Query implements Function<Dataset, Model> >>>> >>>> Select extends Query implements Function<Dataset, ResultSet> >>>> >>>> Ask extends Query implements Function<Dataset, ResultSet> >>>> >>>> >>>> Martynas >>>> atomgraph.com >>> >>> >