{"action":"created","issue":{"url":"https://api.github.com/repos/graknlabs/grakn/issues/3280","repository_url":"https://api.github.com/repos/graknlabs/grakn","labels_url":"https://api.github.com/repos/graknlabs/grakn/issues/3280/labels{/name}","comments_url":"https://api.github.com/repos/graknlabs/grakn/issues/3280/comments","events_url":"https://api.github.com/repos/graknlabs/grakn/issues/3280/events","html_url":"https://github.com/graknlabs/grakn/issues/3280","id":362747990,"node_id":"MDU6SXNzdWUzNjI3NDc5OTA=","number":3280,"title":"Graql: remove transaction object","user":{"login":"grakn-bot","id":42977137,"node_id":"MDQ6VXNlcjQyOTc3MTM3","avatar_url":"https://avatars2.githubusercontent.com/u/42977137?v=4","gravatar_id":"","url":"https://api.github.com/users/grakn-bot","html_url":"https://github.com/grakn-bot","followers_url":"https://api.github.com/users/grakn-bot/followers","following_url":"https://api.github.com/users/grakn-bot/following{/other_user}","gists_url":"https://api.github.com/users/grakn-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/grakn-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grakn-bot/subscriptions","organizations_url":"https://api.github.com/users/grakn-bot/orgs","repos_url":"https://api.github.com/users/grakn-bot/repos","events_url":"https://api.github.com/users/grakn-bot/events{/privacy}","received_events_url":"https://api.github.com/users/grakn-bot/received_events","type":"User","site_admin":false},"labels":[{"id":406573491,"node_id":"MDU6TGFiZWw0MDY1NzM0OTE=","url":"https://api.github.com/repos/graknlabs/grakn/labels/feature","name":"feature","color":"41DFFF","default":false},{"id":1064949303,"node_id":"MDU6TGFiZWwxMDY0OTQ5MzAz","url":"https://api.github.com/repos/graknlabs/grakn/labels/grakn%20core","name":"grakn core","color":"ededed","default":false},{"id":1064991863,"node_id":"MDU6TGFiZWwxMDY0OTkxODYz","url":"https://api.github.com/repos/graknlabs/grakn/labels/planned","name":"planned","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"haikalpribadi","id":567679,"node_id":"MDQ6VXNlcjU2NzY3OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/567679?v=4","gravatar_id":"","url":"https://api.github.com/users/haikalpribadi","html_url":"https://github.com/haikalpribadi","followers_url":"https://api.github.com/users/haikalpribadi/followers","following_url":"https://api.github.com/users/haikalpribadi/following{/other_user}","gists_url":"https://api.github.com/users/haikalpribadi/gists{/gist_id}","starred_url":"https://api.github.com/users/haikalpribadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haikalpribadi/subscriptions","organizations_url":"https://api.github.com/users/haikalpribadi/orgs","repos_url":"https://api.github.com/users/haikalpribadi/repos","events_url":"https://api.github.com/users/haikalpribadi/events{/privacy}","received_events_url":"https://api.github.com/users/haikalpribadi/received_events","type":"User","site_admin":false},"assignees":[{"login":"haikalpribadi","id":567679,"node_id":"MDQ6VXNlcjU2NzY3OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/567679?v=4","gravatar_id":"","url":"https://api.github.com/users/haikalpribadi","html_url":"https://github.com/haikalpribadi","followers_url":"https://api.github.com/users/haikalpribadi/followers","following_url":"https://api.github.com/users/haikalpribadi/following{/other_user}","gists_url":"https://api.github.com/users/haikalpribadi/gists{/gist_id}","starred_url":"https://api.github.com/users/haikalpribadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haikalpribadi/subscriptions","organizations_url":"https://api.github.com/users/haikalpribadi/orgs","repos_url":"https://api.github.com/users/haikalpribadi/repos","events_url":"https://api.github.com/users/haikalpribadi/events{/privacy}","received_events_url":"https://api.github.com/users/haikalpribadi/received_events","type":"User","site_admin":false}],"milestone":null,"comments":10,"created_at":"2018-09-21T19:35:13Z","updated_at":"2018-09-21T19:35:33Z","closed_at":null,"author_association":"COLLABORATOR","body":"_This issue was originally posted by @haikalpribadi  on 2018-02-07 15:49_.\n\nIssue\nOne thing that has come up a lot is the relationship between queries and transactions (txs). Currently, a query may or may not contain a tx:\n\nqueryWithATx = tx.graql().parse(\"match $x isa person; get;\");\nqueryWithoutATx = Graql.parse(\"match $x isa person; get;\");\n​\nqueryWithATx.execute();               // all good\nqueryWithoutATx.execute();            // ERROR!\nqueryWithoutATx.withTx(tx).execute(); // all good\n​\n// even this is possible:\nqueryWithATx.withTx(someOtherTx).execute();This approach is very flexible (allowing a user to use a query any way they desire), but has downsides:\nLots of maintenance involved (e.g. to implement withTx, to handle maybe-present transactions)\nPlenty of room for bugs (I am confident there are some bugs when transactions are not provided)\nThe user can call Query#execute() even when such a call is invalid\nProposal\nA query never has a transaction: we remove Query#withTx(GraknTx) , the QueryBuilder and Query#execute() in favour of these methods:\n\nquery = Graql.parse(\"match $x isa person; get;\");\n​\nresults = tx.execute(query, shouldInfer);\ntx.stream(query).forEach(answer -> { ... });Benefits:\nRepresentation: Queries are value objects - they are defined entirely by what they contain and not what transaction they come from.\nFlexibility: Queries can be parsed/constructred and then stored. They can be shared between transactions and between threads without issue.\nTo do\nThis requirement is complete when queries never contain a Tx and must be executed using GraknTx#execute(Query) and GraknTx#stream(Query)\nAlternative Proposal (Rejected)\nTx always\nA query must have a transaction: we remove Query#withTx(GraknTx) and remove methods such as Graql#parse for creating queries without transactions.\nBenefits:\nEasiest change: most queries are created from a GraknTx currently, not using Graql.\nErgonomics:\n\ntx.graql().match(x.isa(person)).get().execute();\n// vs\ntx.execute(match(x.isa(person)).get());"},"comment":{"url":"https://api.github.com/repos/graknlabs/grakn/issues/comments/423648548","html_url":"https://github.com/graknlabs/grakn/issues/3280#issuecomment-423648548","issue_url":"https://api.github.com/repos/graknlabs/grakn/issues/3280","id":423648548,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzY0ODU0OA==","user":{"login":"grakn-bot","id":42977137,"node_id":"MDQ6VXNlcjQyOTc3MTM3","avatar_url":"https://avatars2.githubusercontent.com/u/42977137?v=4","gravatar_id":"","url":"https://api.github.com/users/grakn-bot","html_url":"https://github.com/grakn-bot","followers_url":"https://api.github.com/users/grakn-bot/followers","following_url":"https://api.github.com/users/grakn-bot/following{/other_user}","gists_url":"https://api.github.com/users/grakn-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/grakn-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grakn-bot/subscriptions","organizations_url":"https://api.github.com/users/grakn-bot/orgs","repos_url":"https://api.github.com/users/grakn-bot/repos","events_url":"https://api.github.com/users/grakn-bot/events{/privacy}","received_events_url":"https://api.github.com/users/grakn-bot/received_events","type":"User","site_admin":false},"created_at":"2018-09-21T19:35:33Z","updated_at":"2018-09-21T19:35:33Z","author_association":"COLLABORATOR","body":"_This comment was originally posted by @lolski on 2018-09-04 20:17:02+02:00_.\n\nIs this ticket still \"In Progress\", dude? @haikalpribadi "}}
{"actor":{"display_login":"grakn-bot"}}