{"action":"created","comment":{"url":"https://api.github.com/repos/open-policy-agent/opa/pulls/comments/56048757","id":56048757,"diff_hunk":"@@ -0,0 +1,388 @@\n+# Opalog: OPA's Query Language\n+\n+OPA includes a policy engine which is purpose built for reasoning about information represented in structured documents such as JSON. Data stored in in the policy engine can be queried using OPA's native query language: Opalog.\n+\n+## What is Opalog?\n+\n+Opalog is a modernized version of [Datalog](https://en.wikipedia.org/wiki/Datalog) which is a well understood, decades old query language. Opalog extends Datalog to support structured document models such as JSON. Opalog queries are assertions on data stored in OPA. These queries can be used to define policies which enumerate violations that exist in the data stored in OPA.\n+\n+## Why use Opalog?\n+\n+Use Opalog for defining policy which is easy to read and write. \n+\n+Opalog focuses on providing powerful support for referencing nested documents and ensuring that queries are correct and unambiguous.\n+\n+Opalog is declarative so policy authors can focus on what queries should return rather than how queries should be executed. These queries are simpler and more concise than the equivalent in an imperative language. Like other applications which support declarative query languages, OPA is able to optimize queries to improve performance, e.g, indexing, concurrent evaluation, reordering, etc.\n+\n+## Opalog Grammar\n+\n+Opalog's syntax is defined by the following grammar:\n+\n+```\n+module         ::= package { import } policy\n+package        ::= \"package\" var { \".\" var }\n+import         ::= \"import\" package [ \"as\" var ]\n+policy         ::= { rule }\n+rule           ::= rule-head \":-\" rule-body\n+rule-head      ::= rule-name [ rule-args ]\n+rule-name      ::= var\n+rule-args      ::= \"[\" [ key ] \"]\" [ \"=\" value ]\n+key            ::= var","path":"docs/LANGUAGE.md","position":30,"original_position":30,"commit_id":"400eee16d321a3c618b5bfbf42e15c102577f030","original_commit_id":"400eee16d321a3c618b5bfbf42e15c102577f030","user":{"login":"tim-styra","id":12769017,"avatar_url":"https://avatars.githubusercontent.com/u/12769017?v=3","gravatar_id":"","url":"https://api.github.com/users/tim-styra","html_url":"https://github.com/tim-styra","followers_url":"https://api.github.com/users/tim-styra/followers","following_url":"https://api.github.com/users/tim-styra/following{/other_user}","gists_url":"https://api.github.com/users/tim-styra/gists{/gist_id}","starred_url":"https://api.github.com/users/tim-styra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tim-styra/subscriptions","organizations_url":"https://api.github.com/users/tim-styra/orgs","repos_url":"https://api.github.com/users/tim-styra/repos","events_url":"https://api.github.com/users/tim-styra/events{/privacy}","received_events_url":"https://api.github.com/users/tim-styra/received_events","type":"User","site_admin":false},"body":"I'd imagine we'd want to allow key/value to be scalars in addition to vars.","created_at":"2016-03-14T18:14:15Z","updated_at":"2016-03-14T18:14:15Z","html_url":"https://github.com/open-policy-agent/opa/pull/10#discussion_r56048757","pull_request_url":"https://api.github.com/repos/open-policy-agent/opa/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/open-policy-agent/opa/pulls/comments/56048757"},"html":{"href":"https://github.com/open-policy-agent/opa/pull/10#discussion_r56048757"},"pull_request":{"href":"https://api.github.com/repos/open-policy-agent/opa/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/open-policy-agent/opa/pulls/10","id":62415063,"html_url":"https://github.com/open-policy-agent/opa/pull/10","diff_url":"https://github.com/open-policy-agent/opa/pull/10.diff","patch_url":"https://github.com/open-policy-agent/opa/pull/10.patch","issue_url":"https://api.github.com/repos/open-policy-agent/opa/issues/10","number":10,"state":"open","locked":false,"title":"Add initial version of the language reference","user":{"login":"tsandall","id":238885,"avatar_url":"https://avatars.githubusercontent.com/u/238885?v=3","gravatar_id":"","url":"https://api.github.com/users/tsandall","html_url":"https://github.com/tsandall","followers_url":"https://api.github.com/users/tsandall/followers","following_url":"https://api.github.com/users/tsandall/following{/other_user}","gists_url":"https://api.github.com/users/tsandall/gists{/gist_id}","starred_url":"https://api.github.com/users/tsandall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsandall/subscriptions","organizations_url":"https://api.github.com/users/tsandall/orgs","repos_url":"https://api.github.com/users/tsandall/repos","events_url":"https://api.github.com/users/tsandall/events{/privacy}","received_events_url":"https://api.github.com/users/tsandall/received_events","type":"User","site_admin":false},"body":"This covers introduction, grammar, basics, terms (consts, vars, refs), and\r\nviews (set and object).\r\n\r\nMore material should be added for the first release, e.g:\r\n\r\n- Modules\r\n- Complex terms\r\n- Negation\r\n- Built-ins\r\n- Undefined values\r\n\r\nAlso, the Acme Corp data set has not be created yet.","created_at":"2016-03-10T16:21:35Z","updated_at":"2016-03-14T18:14:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66b12b0a030b44928d9b2d39b72a4ae52d2e0754","assignee":{"login":"timothyhinrichs","id":10049579,"avatar_url":"https://avatars.githubusercontent.com/u/10049579?v=3","gravatar_id":"","url":"https://api.github.com/users/timothyhinrichs","html_url":"https://github.com/timothyhinrichs","followers_url":"https://api.github.com/users/timothyhinrichs/followers","following_url":"https://api.github.com/users/timothyhinrichs/following{/other_user}","gists_url":"https://api.github.com/users/timothyhinrichs/gists{/gist_id}","starred_url":"https://api.github.com/users/timothyhinrichs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timothyhinrichs/subscriptions","organizations_url":"https://api.github.com/users/timothyhinrichs/orgs","repos_url":"https://api.github.com/users/timothyhinrichs/repos","events_url":"https://api.github.com/users/timothyhinrichs/events{/privacy}","received_events_url":"https://api.github.com/users/timothyhinrichs/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/open-policy-agent/opa/pulls/10/commits","review_comments_url":"https://api.github.com/repos/open-policy-agent/opa/pulls/10/comments","review_comment_url":"https://api.github.com/repos/open-policy-agent/opa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/open-policy-agent/opa/issues/10/comments","statuses_url":"https://api.github.com/repos/open-policy-agent/opa/statuses/400eee16d321a3c618b5bfbf42e15c102577f030","head":{"label":"tsandall:language-ref","ref":"language-ref","sha":"400eee16d321a3c618b5bfbf42e15c102577f030","user":{"login":"tsandall","id":238885,"avatar_url":"https://avatars.githubusercontent.com/u/238885?v=3","gravatar_id":"","url":"https://api.github.com/users/tsandall","html_url":"https://github.com/tsandall","followers_url":"https://api.github.com/users/tsandall/followers","following_url":"https://api.github.com/users/tsandall/following{/other_user}","gists_url":"https://api.github.com/users/tsandall/gists{/gist_id}","starred_url":"https://api.github.com/users/tsandall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsandall/subscriptions","organizations_url":"https://api.github.com/users/tsandall/orgs","repos_url":"https://api.github.com/users/tsandall/repos","events_url":"https://api.github.com/users/tsandall/events{/privacy}","received_events_url":"https://api.github.com/users/tsandall/received_events","type":"User","site_admin":false},"repo":{"id":51776679,"name":"opa","full_name":"tsandall/opa","owner":{"login":"tsandall","id":238885,"avatar_url":"https://avatars.githubusercontent.com/u/238885?v=3","gravatar_id":"","url":"https://api.github.com/users/tsandall","html_url":"https://github.com/tsandall","followers_url":"https://api.github.com/users/tsandall/followers","following_url":"https://api.github.com/users/tsandall/following{/other_user}","gists_url":"https://api.github.com/users/tsandall/gists{/gist_id}","starred_url":"https://api.github.com/users/tsandall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsandall/subscriptions","organizations_url":"https://api.github.com/users/tsandall/orgs","repos_url":"https://api.github.com/users/tsandall/repos","events_url":"https://api.github.com/users/tsandall/events{/privacy}","received_events_url":"https://api.github.com/users/tsandall/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tsandall/opa","description":"A library of policy algorithms deployed as an agent to policy-enable any product or service","fork":true,"url":"https://api.github.com/repos/tsandall/opa","forks_url":"https://api.github.com/repos/tsandall/opa/forks","keys_url":"https://api.github.com/repos/tsandall/opa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tsandall/opa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tsandall/opa/teams","hooks_url":"https://api.github.com/repos/tsandall/opa/hooks","issue_events_url":"https://api.github.com/repos/tsandall/opa/issues/events{/number}","events_url":"https://api.github.com/repos/tsandall/opa/events","assignees_url":"https://api.github.com/repos/tsandall/opa/assignees{/user}","branches_url":"https://api.github.com/repos/tsandall/opa/branches{/branch}","tags_url":"https://api.github.com/repos/tsandall/opa/tags","blobs_url":"https://api.github.com/repos/tsandall/opa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tsandall/opa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tsandall/opa/git/refs{/sha}","trees_url":"https://api.github.com/repos/tsandall/opa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tsandall/opa/statuses/{sha}","languages_url":"https://api.github.com/repos/tsandall/opa/languages","stargazers_url":"https://api.github.com/repos/tsandall/opa/stargazers","contributors_url":"https://api.github.com/repos/tsandall/opa/contributors","subscribers_url":"https://api.github.com/repos/tsandall/opa/subscribers","subscription_url":"https://api.github.com/repos/tsandall/opa/subscription","commits_url":"https://api.github.com/repos/tsandall/opa/commits{/sha}","git_commits_url":"https://api.github.com/repos/tsandall/opa/git/commits{/sha}","comments_url":"https://api.github.com/repos/tsandall/opa/comments{/number}","issue_comment_url":"https://api.github.com/repos/tsandall/opa/issues/comments{/number}","contents_url":"https://api.github.com/repos/tsandall/opa/contents/{+path}","compare_url":"https://api.github.com/repos/tsandall/opa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tsandall/opa/merges","archive_url":"https://api.github.com/repos/tsandall/opa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tsandall/opa/downloads","issues_url":"https://api.github.com/repos/tsandall/opa/issues{/number}","pulls_url":"https://api.github.com/repos/tsandall/opa/pulls{/number}","milestones_url":"https://api.github.com/repos/tsandall/opa/milestones{/number}","notifications_url":"https://api.github.com/repos/tsandall/opa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tsandall/opa/labels{/name}","releases_url":"https://api.github.com/repos/tsandall/opa/releases{/id}","deployments_url":"https://api.github.com/repos/tsandall/opa/deployments","created_at":"2016-02-15T18:37:20Z","updated_at":"2016-02-15T18:37:21Z","pushed_at":"2016-03-12T01:32:47Z","git_url":"git://github.com/tsandall/opa.git","ssh_url":"git@github.com:tsandall/opa.git","clone_url":"https://github.com/tsandall/opa.git","svn_url":"https://github.com/tsandall/opa","homepage":null,"size":35,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"open-policy-agent:master","ref":"master","sha":"35dd27e45c2fea05f278825eb2b2d303faef934a","user":{"login":"open-policy-agent","id":16468693,"avatar_url":"https://avatars.githubusercontent.com/u/16468693?v=3","gravatar_id":"","url":"https://api.github.com/users/open-policy-agent","html_url":"https://github.com/open-policy-agent","followers_url":"https://api.github.com/users/open-policy-agent/followers","following_url":"https://api.github.com/users/open-policy-agent/following{/other_user}","gists_url":"https://api.github.com/users/open-policy-agent/gists{/gist_id}","starred_url":"https://api.github.com/users/open-policy-agent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-policy-agent/subscriptions","organizations_url":"https://api.github.com/users/open-policy-agent/orgs","repos_url":"https://api.github.com/users/open-policy-agent/repos","events_url":"https://api.github.com/users/open-policy-agent/events{/privacy}","received_events_url":"https://api.github.com/users/open-policy-agent/received_events","type":"Organization","site_admin":false},"repo":{"id":48714685,"name":"opa","full_name":"open-policy-agent/opa","owner":{"login":"open-policy-agent","id":16468693,"avatar_url":"https://avatars.githubusercontent.com/u/16468693?v=3","gravatar_id":"","url":"https://api.github.com/users/open-policy-agent","html_url":"https://github.com/open-policy-agent","followers_url":"https://api.github.com/users/open-policy-agent/followers","following_url":"https://api.github.com/users/open-policy-agent/following{/other_user}","gists_url":"https://api.github.com/users/open-policy-agent/gists{/gist_id}","starred_url":"https://api.github.com/users/open-policy-agent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-policy-agent/subscriptions","organizations_url":"https://api.github.com/users/open-policy-agent/orgs","repos_url":"https://api.github.com/users/open-policy-agent/repos","events_url":"https://api.github.com/users/open-policy-agent/events{/privacy}","received_events_url":"https://api.github.com/users/open-policy-agent/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-policy-agent/opa","description":"A library of policy algorithms deployed as an agent to policy-enable any product or service","fork":false,"url":"https://api.github.com/repos/open-policy-agent/opa","forks_url":"https://api.github.com/repos/open-policy-agent/opa/forks","keys_url":"https://api.github.com/repos/open-policy-agent/opa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-policy-agent/opa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-policy-agent/opa/teams","hooks_url":"https://api.github.com/repos/open-policy-agent/opa/hooks","issue_events_url":"https://api.github.com/repos/open-policy-agent/opa/issues/events{/number}","events_url":"https://api.github.com/repos/open-policy-agent/opa/events","assignees_url":"https://api.github.com/repos/open-policy-agent/opa/assignees{/user}","branches_url":"https://api.github.com/repos/open-policy-agent/opa/branches{/branch}","tags_url":"https://api.github.com/repos/open-policy-agent/opa/tags","blobs_url":"https://api.github.com/repos/open-policy-agent/opa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-policy-agent/opa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-policy-agent/opa/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-policy-agent/opa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-policy-agent/opa/statuses/{sha}","languages_url":"https://api.github.com/repos/open-policy-agent/opa/languages","stargazers_url":"https://api.github.com/repos/open-policy-agent/opa/stargazers","contributors_url":"https://api.github.com/repos/open-policy-agent/opa/contributors","subscribers_url":"https://api.github.com/repos/open-policy-agent/opa/subscribers","subscription_url":"https://api.github.com/repos/open-policy-agent/opa/subscription","commits_url":"https://api.github.com/repos/open-policy-agent/opa/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-policy-agent/opa/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-policy-agent/opa/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-policy-agent/opa/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-policy-agent/opa/contents/{+path}","compare_url":"https://api.github.com/repos/open-policy-agent/opa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-policy-agent/opa/merges","archive_url":"https://api.github.com/repos/open-policy-agent/opa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-policy-agent/opa/downloads","issues_url":"https://api.github.com/repos/open-policy-agent/opa/issues{/number}","pulls_url":"https://api.github.com/repos/open-policy-agent/opa/pulls{/number}","milestones_url":"https://api.github.com/repos/open-policy-agent/opa/milestones{/number}","notifications_url":"https://api.github.com/repos/open-policy-agent/opa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-policy-agent/opa/labels{/name}","releases_url":"https://api.github.com/repos/open-policy-agent/opa/releases{/id}","deployments_url":"https://api.github.com/repos/open-policy-agent/opa/deployments","created_at":"2015-12-28T22:08:25Z","updated_at":"2016-02-15T21:58:51Z","pushed_at":"2016-03-12T01:32:48Z","git_url":"git://github.com/open-policy-agent/opa.git","ssh_url":"git@github.com:open-policy-agent/opa.git","clone_url":"https://github.com/open-policy-agent/opa.git","svn_url":"https://github.com/open-policy-agent/opa","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/open-policy-agent/opa/pulls/10"},"html":{"href":"https://github.com/open-policy-agent/opa/pull/10"},"issue":{"href":"https://api.github.com/repos/open-policy-agent/opa/issues/10"},"comments":{"href":"https://api.github.com/repos/open-policy-agent/opa/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/open-policy-agent/opa/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/open-policy-agent/opa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/open-policy-agent/opa/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/open-policy-agent/opa/statuses/400eee16d321a3c618b5bfbf42e15c102577f030"}}}}