{"action":"created","comment":{"url":"https://api.github.com/repos/apache/jena/pulls/comments/49002105","id":49002105,"diff_hunk":"@@ -327,6 +359,35 @@ void AskQuery() : {}\n   SolutionModifier()\n }\n \n+void JsonQuery() : {}\n+{\n+  JsonClause()\n+  ( DatasetClause() )*\n+  WhereClause()\n+  SolutionModifier()\n+}\n+\n+void JsonClause() : { Object o ; String s ; }\n+{\n+  <JSON> { getQuery().setQueryJsonType() ; }\n+  <LBRACE>\n+  s = String() < PNAME_NS >\n+  (","path":"jena-arq/Grammar/master.jj","position":65,"original_position":65,"commit_id":"0049f2abcb757c9a190e0017d9369583f4eebf93","original_commit_id":"0049f2abcb757c9a190e0017d9369583f4eebf93","user":{"login":"afs","id":101362,"avatar_url":"https://avatars.githubusercontent.com/u/101362?v=3","gravatar_id":"","url":"https://api.github.com/users/afs","html_url":"https://github.com/afs","followers_url":"https://api.github.com/users/afs/followers","following_url":"https://api.github.com/users/afs/following{/other_user}","gists_url":"https://api.github.com/users/afs/gists{/gist_id}","starred_url":"https://api.github.com/users/afs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afs/subscriptions","organizations_url":"https://api.github.com/users/afs/orgs","repos_url":"https://api.github.com/users/afs/repos","events_url":"https://api.github.com/users/afs/events{/privacy}","received_events_url":"https://api.github.com/users/afs/received_events","type":"User","site_admin":false},"body":"Yes - javacc will tokenize to PNAME_NS.  These is no COLON and if there were, theer would be other problems.\r\n\r\nI have a devious idea!\r\n\r\nUse the  PNAME_NS and follow with a java fragment that does additional checking:\r\n```\r\n   t = <PNAME_NS>\r\n   { \r\n       if ( t.image is not exactly a \":\" )\r\n          throwParseException(\"message\",  t.beginLine, t.beginColumn)\r\n   }\r\n```\r\nThis then restricts the legal token and means you won't to have to play complicated games with javacc to switch to a different token set (if that is even possible due to lookahead of characters).\r\n","created_at":"2016-01-06T19:58:50Z","updated_at":"2016-01-06T19:58:50Z","html_url":"https://github.com/apache/jena/pull/114#discussion_r49002105","pull_request_url":"https://api.github.com/repos/apache/jena/pulls/114","_links":{"self":{"href":"https://api.github.com/repos/apache/jena/pulls/comments/49002105"},"html":{"href":"https://github.com/apache/jena/pull/114#discussion_r49002105"},"pull_request":{"href":"https://api.github.com/repos/apache/jena/pulls/114"}}},"pull_request":{"url":"https://api.github.com/repos/apache/jena/pulls/114","id":54615641,"html_url":"https://github.com/apache/jena/pull/114","diff_url":"https://github.com/apache/jena/pull/114.diff","patch_url":"https://github.com/apache/jena/pull/114.patch","issue_url":"https://api.github.com/repos/apache/jena/issues/114","number":114,"state":"open","locked":false,"title":"JENA-632: Generate JSON from SPARQL directly","user":{"login":"kinow","id":304786,"avatar_url":"https://avatars.githubusercontent.com/u/304786?v=3","gravatar_id":"","url":"https://api.github.com/users/kinow","html_url":"https://github.com/kinow","followers_url":"https://api.github.com/users/kinow/followers","following_url":"https://api.github.com/users/kinow/following{/other_user}","gists_url":"https://api.github.com/users/kinow/gists{/gist_id}","starred_url":"https://api.github.com/users/kinow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinow/subscriptions","organizations_url":"https://api.github.com/users/kinow/orgs","repos_url":"https://api.github.com/users/kinow/repos","events_url":"https://api.github.com/users/kinow/events{/privacy}","received_events_url":"https://api.github.com/users/kinow/received_events","type":"User","site_admin":false},"body":"This pull request contains code for [JENA-632](https://issues.apache.org/jira/browse/JENA-632). The original work is still in a branch in [my fork of Jena](https://github.com/apache/jena/compare/master...kinow:JENA-632). It has been updated after the work on Jena 3 (mainly package renaming). And the web layer has been implemented in fuseki 2, but not backported to fuseki 1.\r\n\r\nBesides reviewing the code, the follow steps can be used to quickly test the code.\r\n\r\n* Start Fuseki (debug in Eclipse after checking out this branch, for example)\r\n* Load the books.ttl from fuseki1/Data directory\r\n* Query with something as\r\n\r\n```\r\nPREFIX purl: <http://purl.org/dc/elements/1.1/>\r\nPREFIX w3: <http://www.w3.org/2001/vcard-rdf/3.0#> \r\nPREFIX : <http://example.org/book/> \r\n\r\nJSON {\r\n\"author\": ?author, \r\n\"title\": ?title \r\n}\r\nWHERE \r\n{\r\n?book purl:creator ?author .\r\n?book purl:title ?title . \r\nFILTER (?author = 'J.K. Rowling')\r\n}\r\n```\r\n\r\nWhich follows the syntax proposed in the issue in JIRA.\r\n\r\nI am still reviewing the code after porting to the new code base, but an extra pair of eyes reviewing it is always welcome! :grin: \r\n\r\nps: the SPARQL editor may need some tweaking to support the new syntax\r\n\r\nps2: tried to change the key name in the JSON query but it didn't work. Will try to update the PR if that's really a bug in the code in the next days","created_at":"2015-12-27T11:01:13Z","updated_at":"2016-01-06T19:58:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8d513cd0dd7a7f18a84ed5d9f4e3006ab862222","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/jena/pulls/114/commits","review_comments_url":"https://api.github.com/repos/apache/jena/pulls/114/comments","review_comment_url":"https://api.github.com/repos/apache/jena/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/jena/issues/114/comments","statuses_url":"https://api.github.com/repos/apache/jena/statuses/0049f2abcb757c9a190e0017d9369583f4eebf93","head":{"label":"kinow:JENA-632-2","ref":"JENA-632-2","sha":"0049f2abcb757c9a190e0017d9369583f4eebf93","user":{"login":"kinow","id":304786,"avatar_url":"https://avatars.githubusercontent.com/u/304786?v=3","gravatar_id":"","url":"https://api.github.com/users/kinow","html_url":"https://github.com/kinow","followers_url":"https://api.github.com/users/kinow/followers","following_url":"https://api.github.com/users/kinow/following{/other_user}","gists_url":"https://api.github.com/users/kinow/gists{/gist_id}","starred_url":"https://api.github.com/users/kinow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinow/subscriptions","organizations_url":"https://api.github.com/users/kinow/orgs","repos_url":"https://api.github.com/users/kinow/repos","events_url":"https://api.github.com/users/kinow/events{/privacy}","received_events_url":"https://api.github.com/users/kinow/received_events","type":"User","site_admin":false},"repo":{"id":28456602,"name":"jena","full_name":"kinow/jena","owner":{"login":"kinow","id":304786,"avatar_url":"https://avatars.githubusercontent.com/u/304786?v=3","gravatar_id":"","url":"https://api.github.com/users/kinow","html_url":"https://github.com/kinow","followers_url":"https://api.github.com/users/kinow/followers","following_url":"https://api.github.com/users/kinow/following{/other_user}","gists_url":"https://api.github.com/users/kinow/gists{/gist_id}","starred_url":"https://api.github.com/users/kinow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinow/subscriptions","organizations_url":"https://api.github.com/users/kinow/orgs","repos_url":"https://api.github.com/users/kinow/repos","events_url":"https://api.github.com/users/kinow/events{/privacy}","received_events_url":"https://api.github.com/users/kinow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kinow/jena","description":"Mirror of Apache Jena","fork":true,"url":"https://api.github.com/repos/kinow/jena","forks_url":"https://api.github.com/repos/kinow/jena/forks","keys_url":"https://api.github.com/repos/kinow/jena/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinow/jena/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinow/jena/teams","hooks_url":"https://api.github.com/repos/kinow/jena/hooks","issue_events_url":"https://api.github.com/repos/kinow/jena/issues/events{/number}","events_url":"https://api.github.com/repos/kinow/jena/events","assignees_url":"https://api.github.com/repos/kinow/jena/assignees{/user}","branches_url":"https://api.github.com/repos/kinow/jena/branches{/branch}","tags_url":"https://api.github.com/repos/kinow/jena/tags","blobs_url":"https://api.github.com/repos/kinow/jena/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinow/jena/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinow/jena/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinow/jena/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinow/jena/statuses/{sha}","languages_url":"https://api.github.com/repos/kinow/jena/languages","stargazers_url":"https://api.github.com/repos/kinow/jena/stargazers","contributors_url":"https://api.github.com/repos/kinow/jena/contributors","subscribers_url":"https://api.github.com/repos/kinow/jena/subscribers","subscription_url":"https://api.github.com/repos/kinow/jena/subscription","commits_url":"https://api.github.com/repos/kinow/jena/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinow/jena/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinow/jena/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinow/jena/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinow/jena/contents/{+path}","compare_url":"https://api.github.com/repos/kinow/jena/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinow/jena/merges","archive_url":"https://api.github.com/repos/kinow/jena/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinow/jena/downloads","issues_url":"https://api.github.com/repos/kinow/jena/issues{/number}","pulls_url":"https://api.github.com/repos/kinow/jena/pulls{/number}","milestones_url":"https://api.github.com/repos/kinow/jena/milestones{/number}","notifications_url":"https://api.github.com/repos/kinow/jena/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinow/jena/labels{/name}","releases_url":"https://api.github.com/repos/kinow/jena/releases{/id}","created_at":"2014-12-24T17:00:12Z","updated_at":"2015-01-29T00:53:11Z","pushed_at":"2015-12-27T10:52:10Z","git_url":"git://github.com/kinow/jena.git","ssh_url":"git@github.com:kinow/jena.git","clone_url":"https://github.com/kinow/jena.git","svn_url":"https://github.com/kinow/jena","homepage":null,"size":400023,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"ddbb43a742c617da38e0b3be5c7f1cd6ecfc7f9f","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":7437073,"name":"jena","full_name":"apache/jena","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/jena","description":"Mirror of Apache Jena","fork":false,"url":"https://api.github.com/repos/apache/jena","forks_url":"https://api.github.com/repos/apache/jena/forks","keys_url":"https://api.github.com/repos/apache/jena/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/jena/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/jena/teams","hooks_url":"https://api.github.com/repos/apache/jena/hooks","issue_events_url":"https://api.github.com/repos/apache/jena/issues/events{/number}","events_url":"https://api.github.com/repos/apache/jena/events","assignees_url":"https://api.github.com/repos/apache/jena/assignees{/user}","branches_url":"https://api.github.com/repos/apache/jena/branches{/branch}","tags_url":"https://api.github.com/repos/apache/jena/tags","blobs_url":"https://api.github.com/repos/apache/jena/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/jena/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/jena/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/jena/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/jena/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/jena/languages","stargazers_url":"https://api.github.com/repos/apache/jena/stargazers","contributors_url":"https://api.github.com/repos/apache/jena/contributors","subscribers_url":"https://api.github.com/repos/apache/jena/subscribers","subscription_url":"https://api.github.com/repos/apache/jena/subscription","commits_url":"https://api.github.com/repos/apache/jena/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/jena/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/jena/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/jena/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/jena/contents/{+path}","compare_url":"https://api.github.com/repos/apache/jena/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/jena/merges","archive_url":"https://api.github.com/repos/apache/jena/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/jena/downloads","issues_url":"https://api.github.com/repos/apache/jena/issues{/number}","pulls_url":"https://api.github.com/repos/apache/jena/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/jena/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/jena/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/jena/labels{/name}","releases_url":"https://api.github.com/repos/apache/jena/releases{/id}","created_at":"2013-01-04T08:00:32Z","updated_at":"2015-12-21T09:11:42Z","pushed_at":"2016-01-06T17:18:03Z","git_url":"git://github.com/apache/jena.git","ssh_url":"git@github.com:apache/jena.git","clone_url":"https://github.com/apache/jena.git","svn_url":"https://github.com/apache/jena","homepage":null,"size":418550,"stargazers_count":188,"watchers_count":188,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":152,"mirror_url":"git://git.apache.org/jena.git","open_issues_count":8,"forks":152,"open_issues":8,"watchers":188,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/jena/pulls/114"},"html":{"href":"https://github.com/apache/jena/pull/114"},"issue":{"href":"https://api.github.com/repos/apache/jena/issues/114"},"comments":{"href":"https://api.github.com/repos/apache/jena/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/jena/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/jena/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/jena/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/apache/jena/statuses/0049f2abcb757c9a190e0017d9369583f4eebf93"}}}}