You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Raphael W. Majeed" <rw...@gmail.com> on 2016/07/26 20:05:31 UTC
CloseableIterator and AutoCloseable interface
Hello there,
I was working with Jena dependencies in my projects for some time and was
always wondering why the org.apache.jena.util.iterator.ClosableIterator
didn't extend the java.lang.AutoCloseable interface.
It appears to me like a simple change that would allow other developers
(and me) to use these iterators in try-with-resource statements. This would
simplify working with Jena significantly.
Is there a specific reason why the ClosableIterator doesn't extend the
AutoClosable interface?
Regards,
Raphael
Re: CloseableIterator and AutoCloseable interface
Posted by "A. Soroka" <aj...@virginia.edu>.
You can see and participate in discussion on this very topic here:
https://github.com/apache/jena/pull/133
---
A. Soroka
The University of Virginia Library
> On Jul 26, 2016, at 4:05 PM, Raphael W. Majeed <rw...@gmail.com> wrote:
>
> Hello there,
>
> I was working with Jena dependencies in my projects for some time and was
> always wondering why the org.apache.jena.util.iterator.ClosableIterator
> didn't extend the java.lang.AutoCloseable interface.
>
> It appears to me like a simple change that would allow other developers
> (and me) to use these iterators in try-with-resource statements. This would
> simplify working with Jena significantly.
>
> Is there a specific reason why the ClosableIterator doesn't extend the
> AutoClosable interface?
>
> Regards,
> Raphael
Re: CloseableIterator and AutoCloseable interface
Posted by "A. Soroka" <aj...@virginia.edu>.
For Jena and Commons RDF, see:
https://issues.apache.org/jira/browse/COMMONSRDF-33
---
A. Soroka
The University of Virginia Library
> On Jul 29, 2016, at 6:49 AM, Andy Seaborne <an...@apache.org> wrote:
>
> On 26/07/16 21:05, Raphael W. Majeed wrote:
>> Hello there,
>>
>> I was working with Jena dependencies in my projects for some time and was
>> always wondering why the org.apache.jena.util.iterator.ClosableIterator
>> didn't extend the java.lang.AutoCloseable interface.
>
> The API predates AutoCloseable.
>
> That means there is applciation and user code that already exists and works perfectly well.
>
> Making changes
>
>> It appears to me like a simple change that would allow other developers
>> (and me) to use these iterators in try-with-resource statements. This would
>> simplify working with Jena significantly.
>>
>> Is there a specific reason why the ClosableIterator doesn't extend the
>> AutoClosable interface?
>
> A way forward to consider is to develop a new API under a new package - whether that's incremental change to the existing one, or a new oen with a different focus (maybe designed for bulk processing from the ground up; maybe a mor functional style, maybe ....).
>
> Jena can support multiple APIs over the same core (SPI) of Graph/Triple/Node.
>
> See also CommonsRDF although that is half way between the Graph/Triple/Node level (which is what RDF 1.1 calls "generalised RDF")
> and the Jena Model/Statement/Resource (which has an entity aspect Resource.getProperty etc)
>
> CommonsRDF is typed (subjects can't be literal) but does not have the entity aspect.
>
> Andy
>
>
>>
>> Regards,
>> Raphael
>>
>
Re: CloseableIterator and AutoCloseable interface
Posted by Andy Seaborne <an...@apache.org>.
On 26/07/16 21:05, Raphael W. Majeed wrote:
> Hello there,
>
> I was working with Jena dependencies in my projects for some time and was
> always wondering why the org.apache.jena.util.iterator.ClosableIterator
> didn't extend the java.lang.AutoCloseable interface.
The API predates AutoCloseable.
That means there is applciation and user code that already exists and
works perfectly well.
Making changes
> It appears to me like a simple change that would allow other developers
> (and me) to use these iterators in try-with-resource statements. This would
> simplify working with Jena significantly.
>
> Is there a specific reason why the ClosableIterator doesn't extend the
> AutoClosable interface?
A way forward to consider is to develop a new API under a new package -
whether that's incremental change to the existing one, or a new oen with
a different focus (maybe designed for bulk processing from the ground
up; maybe a mor functional style, maybe ....).
Jena can support multiple APIs over the same core (SPI) of
Graph/Triple/Node.
See also CommonsRDF although that is half way between the
Graph/Triple/Node level (which is what RDF 1.1 calls "generalised RDF")
and the Jena Model/Statement/Resource (which has an entity aspect
Resource.getProperty etc)
CommonsRDF is typed (subjects can't be literal) but does not have the
entity aspect.
Andy
>
> Regards,
> Raphael
>