{"action":"opened","issue":{"url":"https://api.github.com/repos/orientechnologies/orientdb/issues/4783","labels_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/4783/labels{/name}","comments_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/4783/comments","events_url":"https://api.github.com/repos/orientechnologies/orientdb/issues/4783/events","html_url":"https://github.com/orientechnologies/orientdb/issues/4783","id":100621258,"number":4783,"title":"Question: Querying out vertex and current vertex simultaneously","user":{"login":"sungchoiok","id":9122684,"avatar_url":"https://avatars.githubusercontent.com/u/9122684?v=3","gravatar_id":"","url":"https://api.github.com/users/sungchoiok","html_url":"https://github.com/sungchoiok","followers_url":"https://api.github.com/users/sungchoiok/followers","following_url":"https://api.github.com/users/sungchoiok/following{/other_user}","gists_url":"https://api.github.com/users/sungchoiok/gists{/gist_id}","starred_url":"https://api.github.com/users/sungchoiok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sungchoiok/subscriptions","organizations_url":"https://api.github.com/users/sungchoiok/orgs","repos_url":"https://api.github.com/users/sungchoiok/repos","events_url":"https://api.github.com/users/sungchoiok/events{/privacy}","received_events_url":"https://api.github.com/users/sungchoiok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-12T19:51:55Z","updated_at":"2015-08-12T19:51:55Z","closed_at":null,"body":"Suppose we have two vertices V1 and V2 and one edge E1 connecting them.\r\n\r\n    V1 --[E1] --> V2\r\n\r\nand that there are two such instances of them like so:\r\n\r\n    #12:0 --[E1] --> #13:0\r\n    #12:1 --[E1] --> #13:1\r\n\r\n\r\nI found that I can get all the vertices V1 and V2 that are connected with E1 using this query:\r\n\r\n    SELECT $current AS v1, FIRST(OUT('E1')) AS v2 FROM V1\r\n\r\nThe above returns, in a table:\r\n<pre>\r\n     +--------+--------+\r\n     | v1     | v2     |\r\n     +--------+--------+\r\n     | #12:0  | #13:0  |\r\n     +--------+--------+\r\n     | #12:1  | #13:1  |\r\n     +-----------------+\r\n</pre>\r\n\r\nand in JSON:\r\n<pre>\r\n{\r\n    \"result\": [\r\n        {\r\n            \"@type\": \"d\",\r\n            \"@rid\": \"#-2:0\",\r\n            \"@version\": 0,\r\n            <b>\"v1\": \"#12:0\",\r\n            \"v2\": \"#13:0\",</b>\r\n            \"@fieldTypes\": \"v1=x,v2=x\"\r\n        },\r\n        {\r\n            \"@type\": \"d\",\r\n            \"@rid\": \"#-2:1\",\r\n            \"@version\": 0,\r\n            <b>\"v1\": \"#12:1\",\r\n            \"v2\": \"#13:1\"</b>,\r\n            \"@fieldTypes\": \"v1=x,v2=x\"\r\n        }\r\n    ],\r\n    \"notification\": \"Query executed in 0.233 sec. Returned 2 record(s)\"\r\n}\r\n</pre>\r\n\r\n\r\nIn the above result, I only get the @rid back.\r\n\r\nBut how can I “expand” the @rid so that the query returns the entire “object” of the vertex for each cell in the table? That is, not just the @rid but all the fields in it? E.g.\r\n\r\n<pre>\r\n{\r\n    \"result\": [\r\n        {\r\n            \"@type\": \"d\",\r\n            \"@rid\": \"#-2:0\",\r\n            \"@version\": 0,\r\n            <b>\"v1\": {\r\n                “field_a”: “data”\r\n                “field_b”: “data”\r\n            },\r\n            \"v2\": {\r\n                “field_c”: “data”\r\n                “field_d”: “data”\r\n            }</b>,\r\n            \"@fieldTypes\": \"v1=x,v2=x\"\r\n        },\r\n        {\r\n            \"@type\": \"d\",\r\n            \"@rid\": \"#-2:1\",\r\n            \"@version\": 0,\r\n            <b>\"v1\": {\r\n                “field_a”: “data”\r\n                “field_b”: “data”\r\n            },\r\n            \"v2\": {\r\n                “field_c”: “data”\r\n                “field_d”: “data”\r\n            }</b>,\r\n            \"@fieldTypes\": \"v1=x,v2=x\"\r\n        }\r\n    ],\r\n    \"notification\": \"Query executed in 0.233 sec. Returned 2 record(s)\"\r\n}\r\n</pre>\r\n\r\nI tried many things using UNWIND(), EXPAND(), UNIONALL() and the like but could not figure it out."}}