{"action":"created","issue":{"url":"https://api.github.com/repos/togostanza/ts/issues/39","labels_url":"https://api.github.com/repos/togostanza/ts/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/togostanza/ts/issues/39/comments","events_url":"https://api.github.com/repos/togostanza/ts/issues/39/events","html_url":"https://github.com/togostanza/ts/pull/39","id":60697595,"number":39,"title":"Implement `grouping`, `groupBy` and `unwrapValueFromBinding`","user":{"login":"ursm","id":7548,"avatar_url":"https://avatars.githubusercontent.com/u/7548?v=3","gravatar_id":"","url":"https://api.github.com/users/ursm","html_url":"https://github.com/ursm","followers_url":"https://api.github.com/users/ursm/followers","following_url":"https://api.github.com/users/ursm/following{/other_user}","gists_url":"https://api.github.com/users/ursm/gists{/gist_id}","starred_url":"https://api.github.com/users/ursm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ursm/subscriptions","organizations_url":"https://api.github.com/users/ursm/orgs","repos_url":"https://api.github.com/users/ursm/repos","events_url":"https://api.github.com/users/ursm/events{/privacy}","received_events_url":"https://api.github.com/users/ursm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-11T17:39:21Z","updated_at":"2015-03-11T17:53:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/togostanza/ts/pulls/39","html_url":"https://github.com/togostanza/ts/pull/39","diff_url":"https://github.com/togostanza/ts/pull/39.diff","patch_url":"https://github.com/togostanza/ts/pull/39.patch"},"body":"Close #38 "},"comment":{"url":"https://api.github.com/repos/togostanza/ts/issues/comments/78318396","html_url":"https://github.com/togostanza/ts/pull/39#issuecomment-78318396","issue_url":"https://api.github.com/repos/togostanza/ts/issues/39","id":78318396,"user":{"login":"ursm","id":7548,"avatar_url":"https://avatars.githubusercontent.com/u/7548?v=3","gravatar_id":"","url":"https://api.github.com/users/ursm","html_url":"https://github.com/ursm","followers_url":"https://api.github.com/users/ursm/followers","following_url":"https://api.github.com/users/ursm/following{/other_user}","gists_url":"https://api.github.com/users/ursm/gists{/gist_id}","starred_url":"https://api.github.com/users/ursm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ursm/subscriptions","organizations_url":"https://api.github.com/users/ursm/orgs","repos_url":"https://api.github.com/users/ursm/repos","events_url":"https://api.github.com/users/ursm/events{/privacy}","received_events_url":"https://api.github.com/users/ursm/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T17:53:35Z","updated_at":"2015-03-11T17:53:35Z","body":"Example usage: ([protein_references_timeline_nano_stanza](https://github.com/togostanza/togostanza/blob/master/protein_references_timeline_nano_stanza/stanza.rb))\r\n\r\n``` js\r\nStanza(function(stanza, params) {\r\n  stanza.query({\r\n    endpoint: 'http://togogenome.org/sparql-test',\r\n    template: 'stanza.rq',\r\n    parameters: params\r\n  }).then(function(result) {\r\n    var references = [];\r\n\r\n    for (var year = 1941; year <= new Date().getFullYear(); year++) {\r\n      references.push({year: year, citiation: []});\r\n    }\r\n\r\n    references.push.apply(references, stanza.unwrapValueFromBinding(result));\r\n\r\n    stanza.render({\r\n      template: 'stanza.html',\r\n      parameters: {\r\n        references: stanza.grouping(references, 'year', 'citiation').map(function(group) {\r\n          return {\r\n            year:   group.year,\r\n            counts: group.citiation.length - 1\r\n          };\r\n        })\r\n      }\r\n    });\r\n  });\r\n});\r\n```"}}