[GitHub] jena pull request #114: JENA-632: Generate JSON from SPARQL directly
Github user kinow commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184510334 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/serializer/QuerySerializer.java --- @@ -142,7 +144,19 @@ public void visitAskResultForm(Query query) out.print("ASK") ; out.newline() ; } - + +@Override +public void visitJsonResultForm(Query query) { +out.print("JSON {"); +List terms = new ArrayList<>(); +for (Map.Entryentry : query.getJsonMapping().entrySet()) { --- End diff -- Patch applied! Thanks Andy! TIL learned about that Prologue object. Regarding the indentation, in `QuerySerializer.java`, there are other 2 occurrences of `incIndent`/`decIndent`, but instead of using `4`, they use the class constant `static final int BLOCK_INDENT = 2 ;` Should we use that for JSON as well? Thanks!!! ---
[jira] [Commented] (JENA-632) Generate JSON from SPARQL directly.
[ https://issues.apache.org/jira/browse/JENA-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16454763#comment-16454763 ] ASF GitHub Bot commented on JENA-632: - Github user kinow commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184510334 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/serializer/QuerySerializer.java --- @@ -142,7 +144,19 @@ public void visitAskResultForm(Query query) out.print("ASK") ; out.newline() ; } - + +@Override +public void visitJsonResultForm(Query query) { +out.print("JSON {"); +List terms = new ArrayList<>(); +for (Map.Entryentry : query.getJsonMapping().entrySet()) { --- End diff -- Patch applied! Thanks Andy! TIL learned about that Prologue object. Regarding the indentation, in `QuerySerializer.java`, there are other 2 occurrences of `incIndent`/`decIndent`, but instead of using `4`, they use the class constant `static final int BLOCK_INDENT = 2 ;` Should we use that for JSON as well? Thanks!!! > Generate JSON from SPARQL directly. > --- > > Key: JENA-632 > URL: https://issues.apache.org/jira/browse/JENA-632 > Project: Apache Jena > Issue Type: Improvement > Components: ARQ, Fuseki >Reporter: Andy Seaborne >Assignee: Bruno P. Kinoshita >Priority: Minor > Labels: java, javacc > Time Spent: 0.5h > Remaining Estimate: 0h > > The capability to generate JSON directly from a SPARQL (or extended SPARQL) > query would enable the creation of JSON data API over published linked data. > This project would cover: > # Design and publication of a design. > # Refinement of design based on community feed > # Implementation, including testing. > # Refinement of implementation based on community feed > Skills required: Java, some parser work, design and discussion with the user > community, basic understanding of HTTP and content negotiation. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-632) Generate JSON from SPARQL directly.
[ https://issues.apache.org/jira/browse/JENA-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16454762#comment-16454762 ] ASF GitHub Bot commented on JENA-632: - Github user kinow commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184509707 --- Diff: jena-arq/src/main/java/org/apache/jena/query/Query.java --- @@ -515,6 +519,18 @@ public void addHavingCondition(Expr expr) havingExprs.add(expr) ; } +// SELECT JSON + +private MapjsonMapping = new LinkedHashMap<>(); --- End diff -- Done! > Generate JSON from SPARQL directly. > --- > > Key: JENA-632 > URL: https://issues.apache.org/jira/browse/JENA-632 > Project: Apache Jena > Issue Type: Improvement > Components: ARQ, Fuseki >Reporter: Andy Seaborne >Assignee: Bruno P. Kinoshita >Priority: Minor > Labels: java, javacc > Time Spent: 0.5h > Remaining Estimate: 0h > > The capability to generate JSON directly from a SPARQL (or extended SPARQL) > query would enable the creation of JSON data API over published linked data. > This project would cover: > # Design and publication of a design. > # Refinement of design based on community feed > # Implementation, including testing. > # Refinement of implementation based on community feed > Skills required: Java, some parser work, design and discussion with the user > community, basic understanding of HTTP and content negotiation. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] jena pull request #114: JENA-632: Generate JSON from SPARQL directly
Github user kinow commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184509707 --- Diff: jena-arq/src/main/java/org/apache/jena/query/Query.java --- @@ -515,6 +519,18 @@ public void addHavingCondition(Expr expr) havingExprs.add(expr) ; } +// SELECT JSON + +private MapjsonMapping = new LinkedHashMap<>(); --- End diff -- Done! ---
new branch for JPMS?
In reference to a recent PR (https://github.com/apache/jena/pull/401), I am seeking input on a process to move forward towards JDK9+ (and JPMS) support in Jena. As consumers of jena apis, the applications that I am developing will require JPMS support going forward, so this is an important issue for my use case. What I have noticed is that there will be breaking changes required to structure the code in a way that meets the JPMS "non-interference" specification.[1] A specific problem occurs when a module does not contain a single root package (which is a typical condition in several jena modules). This results in an "ambiguous module reference" error. To resolve this ambiguity may require considerable refactoring (e.g. moving org.apache.jena.riot to org.apache.jena.arq.riot). I surmise that it is not possible to make these changes and maintain compatibility for existing consumers What I would like to propose is a new branch that just contains modules compliant with the JPMS and that is tested for JDK9+. Artifacts produced from this branch could be distinguished from master artifacts with an appropriate appendix. Thank you for your consideration, Christopher Johnson Scientific Associate Universitätsbibliothek Leipzig [1] http://openjdk.java.net/projects/jigsaw/spec/reqs/#non-interference
[jira] [Commented] (JENA-632) Generate JSON from SPARQL directly.
[ https://issues.apache.org/jira/browse/JENA-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16454693#comment-16454693 ] ASF GitHub Bot commented on JENA-632: - Github user afs commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184495709 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/serializer/QuerySerializer.java --- @@ -142,7 +144,19 @@ public void visitAskResultForm(Query query) out.print("ASK") ; out.newline() ; } - + +@Override +public void visitJsonResultForm(Query query) { +out.print("JSON {"); +List terms = new ArrayList<>(); +for (Map.Entryentry : query.getJsonMapping().entrySet()) { --- End diff -- Some suggestions for formatting output: - Use format utils to get pretty forms - Print JSON vertically so that long templates go down not off the right-hand side. I had to catch the prologue for formatting as it is formatted. Adding a "JSON formatter" seems like a very heavy way to do it. Patch from your JENA-632-2 branch: [jena-632-2-afs.txt](https://github.com/apache/jena/files/1952543/jena-632-2-afs.txt) > Generate JSON from SPARQL directly. > --- > > Key: JENA-632 > URL: https://issues.apache.org/jira/browse/JENA-632 > Project: Apache Jena > Issue Type: Improvement > Components: ARQ, Fuseki >Reporter: Andy Seaborne >Assignee: Bruno P. Kinoshita >Priority: Minor > Labels: java, javacc > Time Spent: 0.5h > Remaining Estimate: 0h > > The capability to generate JSON directly from a SPARQL (or extended SPARQL) > query would enable the creation of JSON data API over published linked data. > This project would cover: > # Design and publication of a design. > # Refinement of design based on community feed > # Implementation, including testing. > # Refinement of implementation based on community feed > Skills required: Java, some parser work, design and discussion with the user > community, basic understanding of HTTP and content negotiation. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-632) Generate JSON from SPARQL directly.
[ https://issues.apache.org/jira/browse/JENA-632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16454692#comment-16454692 ] ASF GitHub Bot commented on JENA-632: - Github user afs commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184478479 --- Diff: jena-arq/src/main/java/org/apache/jena/query/Query.java --- @@ -515,6 +519,18 @@ public void addHavingCondition(Expr expr) havingExprs.add(expr) ; } +// SELECT JSON + +private MapjsonMapping = new LinkedHashMap<>(); --- End diff -- This can be types as ` ` (variables are Nodes) private Map jsonMapping = new LinkedHashMap<>(); public void addJsonMapping(String key, Node value) { jsonMapping.put(key, value); } public Map getJsonMapping() { return Collections.unmodifiableMap(jsonMapping); } > Generate JSON from SPARQL directly. > --- > > Key: JENA-632 > URL: https://issues.apache.org/jira/browse/JENA-632 > Project: Apache Jena > Issue Type: Improvement > Components: ARQ, Fuseki >Reporter: Andy Seaborne >Assignee: Bruno P. Kinoshita >Priority: Minor > Labels: java, javacc > Time Spent: 0.5h > Remaining Estimate: 0h > > The capability to generate JSON directly from a SPARQL (or extended SPARQL) > query would enable the creation of JSON data API over published linked data. > This project would cover: > # Design and publication of a design. > # Refinement of design based on community feed > # Implementation, including testing. > # Refinement of implementation based on community feed > Skills required: Java, some parser work, design and discussion with the user > community, basic understanding of HTTP and content negotiation. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] jena pull request #114: JENA-632: Generate JSON from SPARQL directly
Github user afs commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184478479 --- Diff: jena-arq/src/main/java/org/apache/jena/query/Query.java --- @@ -515,6 +519,18 @@ public void addHavingCondition(Expr expr) havingExprs.add(expr) ; } +// SELECT JSON + +private MapjsonMapping = new LinkedHashMap<>(); --- End diff -- This can be types as ` ` (variables are Nodes) private Map jsonMapping = new LinkedHashMap<>(); public void addJsonMapping(String key, Node value) { jsonMapping.put(key, value); } public Map getJsonMapping() { return Collections.unmodifiableMap(jsonMapping); } ---
[GitHub] jena pull request #114: JENA-632: Generate JSON from SPARQL directly
Github user afs commented on a diff in the pull request: https://github.com/apache/jena/pull/114#discussion_r184495709 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/serializer/QuerySerializer.java --- @@ -142,7 +144,19 @@ public void visitAskResultForm(Query query) out.print("ASK") ; out.newline() ; } - + +@Override +public void visitJsonResultForm(Query query) { +out.print("JSON {"); +List terms = new ArrayList<>(); +for (Map.Entryentry : query.getJsonMapping().entrySet()) { --- End diff -- Some suggestions for formatting output: - Use format utils to get pretty forms - Print JSON vertically so that long templates go down not off the right-hand side. I had to catch the prologue for formatting as it is formatted. Adding a "JSON formatter" seems like a very heavy way to do it. Patch from your JENA-632-2 branch: [jena-632-2-afs.txt](https://github.com/apache/jena/files/1952543/jena-632-2-afs.txt) ---
[jira] [Commented] (JENA-1524) org.apache.jena.system is split by org.apache.jena.arq and org.apache.jena.core
[ https://issues.apache.org/jira/browse/JENA-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16454408#comment-16454408 ] ASF GitHub Bot commented on JENA-1524: -- Github user ajs6f commented on the issue: https://github.com/apache/jena/pull/401 This, to my mind, is now well into the realm of 4.0-sized changes. > org.apache.jena.system is split by org.apache.jena.arq and > org.apache.jena.core > --- > > Key: JENA-1524 > URL: https://issues.apache.org/jira/browse/JENA-1524 > Project: Apache Jena > Issue Type: Bug > Components: Jena >Affects Versions: Jena 3.7.0 >Reporter: Christopher Johnson >Assignee: Andy Seaborne >Priority: Major > Fix For: Jena 3.8.0 > > > a JPMS module cannot require both org.apache.jena.arq and > org.apache.jena.core since org.apache.jena.system can be read from both. > This cannot be resolved with --patch-module since arq and core provide > different implementations. Suggestion is to make a distinction by renaming > system to sys in either one. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] jena issue #401: [JENA-1524] org.apache.jena.system is split by org.apache.j...
Github user ajs6f commented on the issue: https://github.com/apache/jena/pull/401 This, to my mind, is now well into the realm of 4.0-sized changes. ---
[jira] [Commented] (JENA-1525) Add to for each jar module.
[ https://issues.apache.org/jira/browse/JENA-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16453662#comment-16453662 ] Andy Seaborne commented on JENA-1525: - The [commit e5cbf13|https://git-wip-us.apache.org/repos/asf?p=jena.git;h=e5cbf13] adds an automatic module name to all of Fuseki2. This ensures we have automatic module names for all parts of Jena. > Add to for each jar module. > - > > Key: JENA-1525 > URL: https://issues.apache.org/jira/browse/JENA-1525 > Project: Apache Jena > Issue Type: Improvement >Reporter: Andy Seaborne >Priority: Major > Fix For: Jena 3.8.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (JENA-1525) Add to for each jar module.
[ https://issues.apache.org/jira/browse/JENA-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne resolved JENA-1525. - Resolution: Fixed Assignee: Andy Seaborne Fix Version/s: Jena 3.8.0 > Add to for each jar module. > - > > Key: JENA-1525 > URL: https://issues.apache.org/jira/browse/JENA-1525 > Project: Apache Jena > Issue Type: Improvement >Reporter: Andy Seaborne >Assignee: Andy Seaborne >Priority: Major > Fix For: Jena 3.8.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (JENA-1525) Add to for each jar module.
[ https://issues.apache.org/jira/browse/JENA-1525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16453658#comment-16453658 ] ASF subversion and git services commented on JENA-1525: --- Commit e5cbf13e3d470c89c8b40e01768968446c0ae765 in jena's branch refs/heads/master from [~andy.seaborne] [ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=e5cbf13 ] JENA-1525: Automatic module name for Fuseki2 > Add to for each jar module. > - > > Key: JENA-1525 > URL: https://issues.apache.org/jira/browse/JENA-1525 > Project: Apache Jena > Issue Type: Improvement >Reporter: Andy Seaborne >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)