[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2018-03-07 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user asfgit closed the pull request at:

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


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/373#discussion_r172680400
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
 ---
@@ -131,26 +130,30 @@ public static void doResponseResultSet(HttpAction 
action, ResultSet resultSet, P
 contentType = contentTypeTextPlain ;
 
 // Some kind of general dispatch is neater but there are quite a 
few special cases.
+// text/plain is special because there is no ResultSetWriter for 
it (yet). 
+// Text plain is special because of the formatting by prologue.
+// text/plain is not a registered result set language. 
 //
 // JSON is special because of ?callback
-// 
+//
 // XML is special because of
 // (1) charset is a feature of XML, not the response 
 // (2) ?stylesheet=
 //
 // Thrift is special because
 // (1) charset is meaningless
 // (2) there is no boolean result form.
-//
-// Text plain is special because of the formatting by prologue.
-
+
+if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
--- End diff --

Style, no more :  `Objects.equals` copes with null in the same way the 
back-to-front `constant.equals(variable)` is also a null-defending idiom. Not 
that there will be nulls.  It could be a switch on strings. It should be `lang` 
driven but there is no text result set writer ATM and text is odd because it 
uses prefixes and no other result set format does.

This is a quick fix to restore what become broken in the JENA-1454 redesign.


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/373#discussion_r172649522
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
 ---
@@ -131,26 +130,30 @@ public static void doResponseResultSet(HttpAction 
action, ResultSet resultSet, P
 contentType = contentTypeTextPlain ;
 
 // Some kind of general dispatch is neater but there are quite a 
few special cases.
+// text/plain is special because there is no ResultSetWriter for 
it (yet). 
+// Text plain is special because of the formatting by prologue.
+// text/plain is not a registered result set language. 
 //
 // JSON is special because of ?callback
-// 
+//
 // XML is special because of
 // (1) charset is a feature of XML, not the response 
 // (2) ?stylesheet=
 //
 // Thrift is special because
 // (1) charset is meaningless
 // (2) there is no boolean result form.
-//
-// Text plain is special because of the formatting by prologue.
-
+
+if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
--- End diff --

Just out of curiosity-- why `Objects.equals` here instead of 
`contentTypeTextPlain.equals` or `serializationType.equals`?


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/373#discussion_r172649617
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ResponseResultSet.java
 ---
@@ -131,26 +130,30 @@ public static void doResponseResultSet(HttpAction 
action, ResultSet resultSet, P
 contentType = contentTypeTextPlain ;
 
 // Some kind of general dispatch is neater but there are quite a 
few special cases.
+// text/plain is special because there is no ResultSetWriter for 
it (yet). 
+// Text plain is special because of the formatting by prologue.
+// text/plain is not a registered result set language. 
 //
 // JSON is special because of ?callback
-// 
+//
 // XML is special because of
 // (1) charset is a feature of XML, not the response 
 // (2) ?stylesheet=
 //
 // Thrift is special because
 // (1) charset is meaningless
 // (2) there is no boolean result form.
-//
-// Text plain is special because of the formatting by prologue.
-
+
+if ( Objects.equals(serializationType, contentTypeTextPlain) ) {
--- End diff --

Oh, I see-- this was cut from down below. NM.


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2018-03-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

GitHub user afs opened a pull request:

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

JENA-1454: Fix to handle text output format.

Bug fix to JENA-1454.

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

$ git pull https://github.com/afs/jena fuseki-text

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

https://github.com/apache/jena/pull/373.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 #373


commit b5b4b13ad6bafb08c15a8588cd2ad43ec0f515e2
Author: Andy Seaborne 
Date:   2018-03-06T19:50:19Z

JENA-1454: Fix to handle text output format.




> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-31 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-1454:
---

Commit 716b86cfa300e8829dbc9238b7c67b711cdef1e2 in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=716b86c ]

JENA-1454: Introduce builder pattern for result set reading and writing.


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-31 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-1454:
---

Commit 0366da2c37b64978893897eba068fdb6b47ea782 in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=0366da2 ]

JENA-1454: Merge commit 'refs/pull/334/head' of github.com:apache/jena

This closes #334.


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-31 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-1454:
---

Commit 1ea47368f593c17092645e120f6949f63c178e8c in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=1ea4736 ]

JENA-1454: Tests for bnode handling


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-31 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user asfgit closed the pull request at:

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


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-31 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-1454:
---

Commit b022dc1ed532386b03bf5bb2669ee469f367411b in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=b022dc1 ]

JENA-1454: Checks of arguments


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-31 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-1454:
---

Commit 1e1da9570e2d07a1500d85c2b2b1e495624ece00 in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=1e1da95 ]

JENA-1454: Use of new result set machinery for HTTP responses


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user kinow commented on the issue:

https://github.com/apache/jena/pull/334
  
+1


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/334#discussion_r158602513
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/riot/resultset/rw/ResultsWriter.java ---
@@ -77,19 +79,33 @@ private ResultsWriter(Lang lang, Context context) {
 this.context = context;
 }
 
-public void write(String url, ResultSet resultSet) {
-throw new NotImplemented();
+/** Write a result set, using the configurartion of the {@code 
ResultWriter}, to a file */ 
+public void write(String filename, ResultSet resultSet) {
+Objects.requireNonNull(filename);
+Objects.requireNonNull(resultSet);
+try ( OutputStream out = openURL(filename) ) {
+write(out, resultSet);
+} catch (IOException ex) { IO.exception(ex); }
 }
 
+/** Write a result set, using the configurartion of the {@code 
ResultWriter}, to an {@code OutputStream}. */ 
 public void write(OutputStream output, ResultSet resultSet) {
+Objects.requireNonNull(output);
+Objects.requireNonNull(resultSet);
 write(output, resultSet, null, lang);
 }
 
-public void write(String url, boolean booleanResult) {
-throw new NotImplemented();
+/** Write a boolean result, using the configurartion of the {@code 
ResultWriter}, to a file */ 
+public void write(String filename, boolean booleanResult) {
+Objects.requireNonNull(booleanResult);
--- End diff --

Thanks - fixed. Testing the wrong argument; 
`Objects.requireNonNull(booleanResult)` is never null!


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-23 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user kinow commented on a diff in the pull request:

https://github.com/apache/jena/pull/334#discussion_r158590480
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/riot/resultset/rw/ResultsWriter.java ---
@@ -77,19 +79,33 @@ private ResultsWriter(Lang lang, Context context) {
 this.context = context;
 }
 
-public void write(String url, ResultSet resultSet) {
-throw new NotImplemented();
+/** Write a result set, using the configurartion of the {@code 
ResultWriter}, to a file */ 
+public void write(String filename, ResultSet resultSet) {
+Objects.requireNonNull(filename);
+Objects.requireNonNull(resultSet);
+try ( OutputStream out = openURL(filename) ) {
+write(out, resultSet);
+} catch (IOException ex) { IO.exception(ex); }
 }
 
+/** Write a result set, using the configurartion of the {@code 
ResultWriter}, to an {@code OutputStream}. */ 
 public void write(OutputStream output, ResultSet resultSet) {
+Objects.requireNonNull(output);
+Objects.requireNonNull(resultSet);
 write(output, resultSet, null, lang);
 }
 
-public void write(String url, boolean booleanResult) {
-throw new NotImplemented();
+/** Write a boolean result, using the configurartion of the {@code 
ResultWriter}, to a file */ 
+public void write(String filename, boolean booleanResult) {
+Objects.requireNonNull(booleanResult);
--- End diff --

Only minor nit-pick I found reviewing the commits added after my previous 
comment was here.

`write(String filename, ResultSet resultSet)` has 
`requireNonNull(filename)`, and `requireNonNull(resultSet)`. And in this method 
the `filename` is not checked for null. Not sure if it is intentional or not.


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-23 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user afs commented on the issue:

https://github.com/apache/jena/pull/334
  
Cleaning up and switching to new reader/writer code now done.

This PR is now complete.



> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/334#discussion_r158571855
  
--- Diff: jena-arq/src/main/java/org/apache/jena/riot/ResultSetMgr.java ---
@@ -36,123 +41,216 @@
  * @see ResultSetFormatter 
  */
 public class ResultSetMgr {
-
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename) {
+ResultSet rs = readAny(urlOrFilename).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet};
+ * the stream is expect to use syntax {@code lang}.  Note that returned
+ * result set may stream and so the input stream be read while the 
ResultSet is used.
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename, Lang lang) {
+ResultSet rs = readAny(urlOrFilename, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param input
+ * @return ResultSet
+ */
+public static ResultSet read(InputStream input) {
+ResultSet rs = readAny(input).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
 /**
  * Read from an {@code InputStream} and produce a {@link ResultSet};
  * the stream is expect to use syntax {@code lang}.  Note that returned
  * result set may stream and so the input stream be read while the 
ResultSet is used.
  * See {@link ResultSetFactory#copyResults(ResultSet)}
  * for a ResultSet that is detached from the {@code InputStream}.
  * 
- * @param in
+ * @param input
  * @param lang
  * @return ResultSet
  */
-public static ResultSet read(InputStream in, Lang lang) {
-return process(TypedInputStream.wrap(in), null, lang, null) ;
+public static ResultSet read(InputStream input, Lang lang) {
+ResultSet rs = readAny(input, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+private static void checkLang(Lang lang) {
+Objects.requireNonNull(lang);
+if ( ! ResultSetReaderRegistry.isRegistered(lang) ) {
+throw new ResultSetException("Not a result set syntax: "+lang);
+}
 }
 
-/** Read a result set from the URI */
-public static ResultSet read(String uri) {
-return read(uri, null) ;
+/** Read a boolean result from the URI
+ * 
+ * @param urlOrFilename
+ * @return boolean
+ */
+public static boolean readBoolean(String urlOrFilename) {
+Boolean b = readAny(urlOrFilename).getBooleanResult();
+return b;
 }
 
-/** Read a result set from the URI, in the specified syntax */ 
-public static ResultSet read(String uri, Lang lang) {
-return parse(uri, lang, null) ;
+/** Read a boolean result from the URI;
+ * the input is expect to use syntax {@code lang}
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return boolean
+ */
+public static boolean readBoolean(String urlOrF

[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user kinow commented on a diff in the pull request:

https://github.com/apache/jena/pull/334#discussion_r158571105
  
--- Diff: jena-arq/src/main/java/org/apache/jena/riot/ResultSetMgr.java ---
@@ -36,123 +41,216 @@
  * @see ResultSetFormatter 
  */
 public class ResultSetMgr {
-
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename) {
+ResultSet rs = readAny(urlOrFilename).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet};
+ * the stream is expect to use syntax {@code lang}.  Note that returned
+ * result set may stream and so the input stream be read while the 
ResultSet is used.
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename, Lang lang) {
+ResultSet rs = readAny(urlOrFilename, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param input
+ * @return ResultSet
+ */
+public static ResultSet read(InputStream input) {
+ResultSet rs = readAny(input).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
 /**
  * Read from an {@code InputStream} and produce a {@link ResultSet};
  * the stream is expect to use syntax {@code lang}.  Note that returned
  * result set may stream and so the input stream be read while the 
ResultSet is used.
  * See {@link ResultSetFactory#copyResults(ResultSet)}
  * for a ResultSet that is detached from the {@code InputStream}.
  * 
- * @param in
+ * @param input
  * @param lang
  * @return ResultSet
  */
-public static ResultSet read(InputStream in, Lang lang) {
-return process(TypedInputStream.wrap(in), null, lang, null) ;
+public static ResultSet read(InputStream input, Lang lang) {
+ResultSet rs = readAny(input, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+private static void checkLang(Lang lang) {
+Objects.requireNonNull(lang);
+if ( ! ResultSetReaderRegistry.isRegistered(lang) ) {
+throw new ResultSetException("Not a result set syntax: "+lang);
+}
 }
 
-/** Read a result set from the URI */
-public static ResultSet read(String uri) {
-return read(uri, null) ;
+/** Read a boolean result from the URI
+ * 
+ * @param urlOrFilename
+ * @return boolean
+ */
+public static boolean readBoolean(String urlOrFilename) {
+Boolean b = readAny(urlOrFilename).getBooleanResult();
+return b;
 }
 
-/** Read a result set from the URI, in the specified syntax */ 
-public static ResultSet read(String uri, Lang lang) {
-return parse(uri, lang, null) ;
+/** Read a boolean result from the URI;
+ * the input is expect to use syntax {@code lang}
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return boolean
+ */
+public static boolean readBoolean(String urlO

[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/334#discussion_r158571022
  
--- Diff: jena-arq/src/main/java/org/apache/jena/riot/ResultSetMgr.java ---
@@ -36,123 +41,216 @@
  * @see ResultSetFormatter 
  */
 public class ResultSetMgr {
-
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename) {
+ResultSet rs = readAny(urlOrFilename).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet};
+ * the stream is expect to use syntax {@code lang}.  Note that returned
+ * result set may stream and so the input stream be read while the 
ResultSet is used.
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename, Lang lang) {
+ResultSet rs = readAny(urlOrFilename, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param input
+ * @return ResultSet
+ */
+public static ResultSet read(InputStream input) {
+ResultSet rs = readAny(input).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
 /**
  * Read from an {@code InputStream} and produce a {@link ResultSet};
  * the stream is expect to use syntax {@code lang}.  Note that returned
  * result set may stream and so the input stream be read while the 
ResultSet is used.
  * See {@link ResultSetFactory#copyResults(ResultSet)}
  * for a ResultSet that is detached from the {@code InputStream}.
  * 
- * @param in
+ * @param input
  * @param lang
  * @return ResultSet
  */
-public static ResultSet read(InputStream in, Lang lang) {
-return process(TypedInputStream.wrap(in), null, lang, null) ;
+public static ResultSet read(InputStream input, Lang lang) {
+ResultSet rs = readAny(input, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+private static void checkLang(Lang lang) {
+Objects.requireNonNull(lang);
+if ( ! ResultSetReaderRegistry.isRegistered(lang) ) {
+throw new ResultSetException("Not a result set syntax: "+lang);
+}
 }
 
-/** Read a result set from the URI */
-public static ResultSet read(String uri) {
-return read(uri, null) ;
+/** Read a boolean result from the URI
+ * 
+ * @param urlOrFilename
+ * @return boolean
+ */
+public static boolean readBoolean(String urlOrFilename) {
+Boolean b = readAny(urlOrFilename).getBooleanResult();
+return b;
 }
 
-/** Read a result set from the URI, in the specified syntax */ 
-public static ResultSet read(String uri, Lang lang) {
-return parse(uri, lang, null) ;
+/** Read a boolean result from the URI;
+ * the input is expect to use syntax {@code lang}
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return boolean
+ */
+public static boolean readBoolean(String urlOrF

[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user kinow commented on a diff in the pull request:

https://github.com/apache/jena/pull/334#discussion_r158567055
  
--- Diff: jena-arq/src/main/java/org/apache/jena/riot/ResultSetMgr.java ---
@@ -36,123 +41,216 @@
  * @see ResultSetFormatter 
  */
 public class ResultSetMgr {
-
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename) {
+ResultSet rs = readAny(urlOrFilename).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet};
+ * the stream is expect to use syntax {@code lang}.  Note that returned
+ * result set may stream and so the input stream be read while the 
ResultSet is used.
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return ResultSet
+ */
+public static ResultSet read(String urlOrFilename, Lang lang) {
+ResultSet rs = readAny(urlOrFilename, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+/**
+ * Read from a {@code URL} (including filenames) and produce a {@link 
ResultSet}.
+ * Note that returned result set may stream and so the input stream be 
read
+ * while the ResultSet is used.
+ * 
+ * See {@link ResultSetFactory#copyResults(ResultSet)}
+ * for a ResultSet that is detached from the {@code InputStream}.
+ * 
+ * @param input
+ * @return ResultSet
+ */
+public static ResultSet read(InputStream input) {
+ResultSet rs = readAny(input).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
 /**
  * Read from an {@code InputStream} and produce a {@link ResultSet};
  * the stream is expect to use syntax {@code lang}.  Note that returned
  * result set may stream and so the input stream be read while the 
ResultSet is used.
  * See {@link ResultSetFactory#copyResults(ResultSet)}
  * for a ResultSet that is detached from the {@code InputStream}.
  * 
- * @param in
+ * @param input
  * @param lang
  * @return ResultSet
  */
-public static ResultSet read(InputStream in, Lang lang) {
-return process(TypedInputStream.wrap(in), null, lang, null) ;
+public static ResultSet read(InputStream input, Lang lang) {
+ResultSet rs = readAny(input, lang).getResultSet();
+if ( rs == null )
+throw new ResultSetException("Not a result set"); 
+return rs;
+}
+
+private static void checkLang(Lang lang) {
+Objects.requireNonNull(lang);
+if ( ! ResultSetReaderRegistry.isRegistered(lang) ) {
+throw new ResultSetException("Not a result set syntax: "+lang);
+}
 }
 
-/** Read a result set from the URI */
-public static ResultSet read(String uri) {
-return read(uri, null) ;
+/** Read a boolean result from the URI
+ * 
+ * @param urlOrFilename
+ * @return boolean
+ */
+public static boolean readBoolean(String urlOrFilename) {
+Boolean b = readAny(urlOrFilename).getBooleanResult();
+return b;
 }
 
-/** Read a result set from the URI, in the specified syntax */ 
-public static ResultSet read(String uri, Lang lang) {
-return parse(uri, lang, null) ;
+/** Read a boolean result from the URI;
+ * the input is expect to use syntax {@code lang}
+ * 
+ * @param urlOrFilename
+ * @param lang
+ * @return boolean
+ */
+public static boolean readBoolean(String urlO

[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

Github user afs commented on the issue:

https://github.com/apache/jena/pull/334
  
Needs some further cleanup before its ready to merge.

The main syntax forms, XML, JSON support read/write with a `Context` for 
passing in configuration. Thrift does anyway.

TSV, CSV, Text work in this framework but have not been deeply integrated.

All old mechanisms to access features specific to a syntax should still 
work.


> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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


[jira] [Commented] (JENA-1454) Configurable ResultSet reading and writing

2017-12-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-1454:
--

GitHub user afs opened a pull request:

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

JENA-1454: Introduce builder pattern for result set reading and writing.

Rework the machinery for ResultSet reading and writing to use a builder 
pattern (in ResultsReader and ResultsWriter).  This is styled after 
RDFParse/RDFParserBuilder and RDFWriter/RDFWriterBuilder.

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

$ git pull https://github.com/afs/jena resultset-bnode

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

https://github.com/apache/jena/pull/334.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 #334


commit 716b86cfa300e8829dbc9238b7c67b711cdef1e2
Author: Andy Seaborne 
Date:   2017-12-18T14:49:40Z

JENA-1454: Introduce builder pattern for result set reading and writing.




> Configurable ResultSet reading and writing
> --
>
> Key: JENA-1454
> URL: https://issues.apache.org/jira/browse/JENA-1454
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
>Priority: Minor
>
> Same patterns as {{RDFParser}}, {{RDFWriter}}.



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