{"action":"created","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb-labs/issues/5","repository_url":"https://api.github.com/repos/orientechnologies/orientdb-labs","labels_url":"https://api.github.com/repos/orientechnologies/orientdb-labs/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb-labs/issues/5/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb-labs/issues/5/events","html_url":"https://github.com/orientechnologies/orientdb-labs/issues/5","id":161470957,"number":5,"title":"[OEP 5] Query and ResultSet API ","user":{"login":"tglman","id":424369,"avatar_url":"https://avatars.githubusercontent.com/u/424369?v=3","gravatar_id":"","url":"https://api.github.com/users/tglman","html_url":"https://github.com/tglman","followers_url":"https://api.github.com/users/tglman/followers","following_url":"https://api.github.com/users/tglman/following{/other_user}","gists_url":"https://api.github.com/users/tglman/gists{/gist_id}","starred_url":"https://api.github.com/users/tglman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tglman/subscriptions","organizations_url":"https://api.github.com/users/tglman/orgs","repos_url":"https://api.github.com/users/tglman/repos","events_url":"https://api.github.com/users/tglman/events{/privacy}","received_events_url":"https://api.github.com/users/tglman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-06-21T15:41:01Z","updated_at":"2016-06-22T16:33:53Z","closed_at":null,"body":"**Summary:**\r\nSimple query API that support streaming results and complex results like graph portions, as well as simple record fetching.\r\n\r\n**Goals:**\r\n- Streaming like, that allow iteration and interruption of query result iteration.\r\n- Not bound to records like ODocument, a result can not be a record\r\n- Uniform and that allow to support any result set from query command and scripts\r\n- Simplified for the core query language support (sql)\r\n\r\n**Non-Goals:**\r\n- Be compatible with third party query engine (TinkerPop stack)\r\n- Prefetching and Network will discussed in future\r\n\r\n**Motivation:**\r\n- Current API is not streaming\r\n- ODocument based result set create doesn't cover well projection like results and add not needed overhead on result access iteration\r\n\r\n**Description:**\r\nnew database api for direct query without wrapping objects:\r\n- `ResultSet query(String query, Map<String,Object> args) ` // for select query\r\n- `ResultSet command(String command, Map<String,Object> args) `// for data manipulation\r\n- `ResultSet script(String lang,String script, Map<String,Object> args) `// script execution\r\n\r\nnew database api for prepare : \r\n- `Prepared prepareQuery(String query)` // for select query\r\n- `Prepared prepareCommand(String query) `// for data manipulation\r\n- `Prepared prepareScript(String lang,String script)` // script execution\r\n\r\nPrepered execution:\r\n- `ResultSet execute(Map<String,Object> args)`\r\n\r\nResultSet access:\r\n\r\n- `boolean hasNext()` // iterator like hasNext\r\n- `OResult next()` ` // iterator like next\r\n- `boolean hasPrevious()` // backward iteration\r\n- `OResult previous()`  // backward iteration\r\n- `void close()` //Important to stop streaming api\r\n- `int count()` // count of the record in the result set\r\n- `boolean fixedKeys()` check if a result set has fixed number of keys, like in case of specified projections\r\n- `Set<String> keys()` set of keys in case of fixed keys result set.\r\n\r\nFor OResult value access will follow, ODocument/OVertex/OEdge api, OResult can not be a record, so it will have api for check this and access to the relative record in case\r\n\r\n- `boolean isProjection()`\r\n- `ODocument getRecord()`\r\n\r\nAs well the OResult have to allow traversal of projected relations, following the base api.\r\n\r\nearly stage examples:\r\nhttps://gist.github.com/tglman/c3a3ceb6a9891ceae3eb4701a69ba0e3\r\n\r\n\r\n**Alternatives:**\r\n\r\nNone known yet\r\n\r\n**Risks and assumptions:**\r\n\r\nBraking api, we need to include a compatibility layer with the past for early versions.\r\n\r\n**Impact matrix**\r\n\r\n- [ ] Storage engine\r\n- [x] SQL\r\n- [ ] Protocols\r\n- [ ] Indexes\r\n- [ ] Console\r\n- [x] Java API\r\n- [ ] Geospatial\r\n- [ ] Lucene\r\n- [ ] Security\r\n- [ ] Hooks\r\n- [ ] EE\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/orientechnologies/orientdb-labs/issues/comments/227801325","html_url":"https://github.com/orientechnologies/orientdb-labs/issues/5#issuecomment-227801325","issue_url":"https://api.github.com/repos/orientechnologies/orientdb-labs/issues/5","id":227801325,"user":{"login":"tglman","id":424369,"avatar_url":"https://avatars.githubusercontent.com/u/424369?v=3","gravatar_id":"","url":"https://api.github.com/users/tglman","html_url":"https://github.com/tglman","followers_url":"https://api.github.com/users/tglman/followers","following_url":"https://api.github.com/users/tglman/following{/other_user}","gists_url":"https://api.github.com/users/tglman/gists{/gist_id}","starred_url":"https://api.github.com/users/tglman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tglman/subscriptions","organizations_url":"https://api.github.com/users/tglman/orgs","repos_url":"https://api.github.com/users/tglman/repos","events_url":"https://api.github.com/users/tglman/events{/privacy}","received_events_url":"https://api.github.com/users/tglman/received_events","type":"User","site_admin":false},"created_at":"2016-06-22T16:33:52Z","updated_at":"2016-06-22T16:33:52Z","body":"by the way `OResult` should not have any public 'set' methods, speaking about hierarchies `OResult` would actually fit well on top of OElement for the method that it provide. "}}
{"actor":{"display_login":"tglman"}}