diff --git a/query/pb/graphresponse.pb.go b/query/pb/graphresponse.pb.go
index 55014d70b55686d2340fbe30697e096461799fbf..75212c7fb9da34453e5d1ca815a2ae6c4339479e 100644
--- a/query/pb/graphresponse.pb.go
+++ b/query/pb/graphresponse.pb.go
@@ -72,7 +72,8 @@ func (*GraphRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []in
 type GraphResponse struct {
 	Attribute string           `protobuf:"bytes,1,opt,name=attribute" json:"attribute,omitempty"`
 	Result    *Result          `protobuf:"bytes,2,opt,name=result" json:"result,omitempty"`
-	Children  []*GraphResponse `protobuf:"bytes,3,rep,name=children" json:"children,omitempty"`
+	Query     *UidList         `protobuf:"bytes,3,opt,name=query" json:"query,omitempty"`
+	Children  []*GraphResponse `protobuf:"bytes,4,rep,name=children" json:"children,omitempty"`
 }
 
 func (m *GraphResponse) Reset()                    { *m = GraphResponse{} }
@@ -87,6 +88,13 @@ func (m *GraphResponse) GetResult() *Result {
 	return nil
 }
 
+func (m *GraphResponse) GetQuery() *UidList {
+	if m != nil {
+		return m.Query
+	}
+	return nil
+}
+
 func (m *GraphResponse) GetChildren() []*GraphResponse {
 	if m != nil {
 		return m.Children
@@ -173,21 +181,22 @@ var _DGraph_serviceDesc = grpc.ServiceDesc{
 }
 
 var fileDescriptor0 = []byte{
-	// 255 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x90, 0x4f, 0x4b, 0xc4, 0x30,
-	0x10, 0xc5, 0xed, 0xfe, 0x89, 0x76, 0x76, 0x05, 0x1d, 0x45, 0x8a, 0x28, 0x48, 0xf0, 0xb0, 0x1e,
-	0xec, 0x61, 0xbd, 0xf8, 0x01, 0x04, 0x0f, 0x7a, 0x71, 0xc0, 0x0f, 0xd0, 0xda, 0xe0, 0x06, 0xea,
-	0x36, 0x26, 0xa9, 0xe8, 0xcd, 0x8f, 0xee, 0x34, 0x09, 0xae, 0xb2,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 0xb8, 0xec,
-	0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x42, 0x7b, 0x6e, 0x70, 0x01, 0x00, 0x00,
+	// 265 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x90, 0x4d, 0x4e, 0xc3, 0x30,
+	0x10, 0x85, 0x49, 0x9b, 0x1a, 0x32, 0x2d, 0x12, 0x0c, 0x08, 0x45, 0x08, 0x24, 0xb0, 0x58, 0x94,
+	0x05, 0x59, 0x94, 0x0d, 0x07, 0x40, 0x62, 0x01, 0x1b, 0x2c, 0x71, 0x80, 0x84, 0x58, 0xd4, 0x52,
+	0x68, 0x8c, 0x7f, 0x10, 0x9c, 0x87, 0x8b, 0xe2, 0x8c, 0x0d, 0xa5, 0x62, 0x37, 0x93, 0xf7, 0xe5,
+	0xbd, 0x37, 0x86, 0x83, 0x17, 0x53, 0xeb, 0xa5, 0x91, 0x56, 0xf7, 0x2b, 0x2b, 0x2b, 0x6d, 0x7a,
+	0xd7, 0xe3, 0x48, 0x37, 0xfc, 0x14, 0xb6, 0x9f, 0x54, 0xfb, 0xa0, 0xac, 0x43, 0x84, 0xdc, 0xab,
+	0xd6, 0x96, 0xd9, 0xd9, 0x78, 0x9e, 0x0b, 0x9a, 0xf9, 0x3d, 0x30, 0x21, 0xad, 0xef, 0x1c, 0x1e,
+	0x01, 0x7b, 0xaf, 0x3b, 0x2f, 0xa3, 0x3e, 0x13, 0x69, 0xc3, 0x4b, 0x28, 0x02, 0xf9, 0x5a, 0x3b,
+	0xa3, 0x3e, 0xca, 0x51, 0x90, 0xa6, 0x8b, 0x69, 0xa5, 0x9b, 0x2a, 0xb9, 0x8a, 0xb5, 0xca, 0x2f,
+	0x60, 0x76, 0x37, 0xd4, 0x10, 0xf2, 0x2d, 0xfc, 0xe9, 0xf0, 0x10, 0x26, 0x61, 0x30, 0x9f, 0xc1,
+	0x31, 0x9b, 0x17, 0x22, 0x2e, 0xfc, 0x2b, 0x83, 0xdd, 0x84, 0xc5, 0xb6, 0x78, 0x02, 0x45, 0xed,
+	0x82, 0x43, 0xe3, 0x9d, 0x4c, 0xec, 0xfa, 0x03, 0x72, 0x60, 0x86, 0x2a, 0x86, 0xf4, 0x2c, 0xa4,
+	0xc3, 0x90, 0x1e, 0x4b, 0x8b, 0xa4, 0xe0, 0xf9, 0x4f, 0xd2, 0x98, 0x90, 0x8d, 0x82, 0x51, 0xc1,
+	0x2b, 0xd8, 0x79, 0x5e, 0xaa, 0xae, 0x35, 0x72, 0x55, 0xe6, 0x74, 0xc6, 0xfe, 0x40, 0x6d, 0x34,
+	0x11, 0xbf, 0xc8, 0xe2, 0x06, 0xd8, 0x2d, 0x69, 0x58, 0xc1, 0xe4, 0x91, 0x1c, 0xf6, 0xfe, 0xf0,
+	0x74, 0xe0, 0xf1, 0x7f, 0x07, 0xbe, 0xd5, 0x30, 0x7a, 0xfc, 0xeb, 0xef, 0x00, 0x00, 0x00, 0xff,
+	0xff, 0x18, 0x87, 0x57, 0xd8, 0x93, 0x01, 0x00, 0x00,
 }
diff --git a/query/pb/graphresponse.proto b/query/pb/graphresponse.proto
index f13499b9724f2330a951d10f7f10ceff5a137921..c87873acd8da87e319ea4771079b0a82df90a8bf 100644
--- a/query/pb/graphresponse.proto
+++ b/query/pb/graphresponse.proto
@@ -1,3 +1,6 @@
+// To compile this file run the command below from inside the pb directory
+// protoc --go_out=plugins=grpc:. *.proto
+
 syntax="proto3";
 package pb;
 
@@ -21,5 +24,6 @@ message GraphRequest {
 message GraphResponse {
   string attribute = 1;
   Result result = 2;
-  repeated GraphResponse children = 3; // Each node can have multiple children
+  UidList query = 3;
+  repeated GraphResponse children = 4; // Each node can have multiple children
 }
diff --git a/query/query.go b/query/query.go
index e61a4e11811e7c2ced477eca62e25dacf5e65f1a..70771b4bb334ced23ecf04c2c5e48b38735b05c3 100644
--- a/query/query.go
+++ b/query/query.go
@@ -254,12 +254,19 @@ func (g *SubGraph) ToJson(l *Latency) (js []byte, rerr error) {
 
 // This method take in a flatbuffer result, extracts values and uids from it
 // and converts it to a protocol buffer result
-func extract(r *task.Result) (*pb.Result, error) {
-	var result = &pb.Result{}
+func extract(q *task.Query, r *task.Result) (*pb.UidList, *pb.Result, error) {
+	result := &pb.Result{}
+	query := &pb.UidList{}
 	var ul task.UidList
+
+	for i := 0; i < q.UidsLength(); i++ {
+		uid := q.Uids(i)
+		query.Uids = append(query.Uids, uid)
+	}
+
 	for i := 0; i < r.UidmatrixLength(); i++ {
 		if ok := r.Uidmatrix(&ul, i); !ok {
-			return result, fmt.Errorf("While parsing UidList")
+			return query, result, fmt.Errorf("While parsing UidList")
 		}
 
 		uidList := &pb.UidList{}
@@ -273,12 +280,12 @@ func extract(r *task.Result) (*pb.Result, error) {
 	var tv task.Value
 	for i := 0; i < r.ValuesLength(); i++ {
 		if ok := r.Values(&tv, i); !ok {
-			return result, fmt.Errorf("While parsing value")
+			return query, result, fmt.Errorf("While parsing value")
 		}
 
 		var ival interface{}
 		if err := posting.ParseValue(&ival, tv.ValBytes()); err != nil {
-			return result, err
+			return query, result, err
 		}
 
 		if ival == nil {
@@ -286,7 +293,7 @@ func extract(r *task.Result) (*pb.Result, error) {
 		}
 		result.Values = append(result.Values, []byte(ival.(string)))
 	}
-	return result, nil
+	return query, result, nil
 }
 
 // This method performs a pre traversal on a subgraph and converts it to a
@@ -302,11 +309,16 @@ func (g *SubGraph) PreTraverse() (gr *pb.GraphResponse, rerr error) {
 	r := new(task.Result)
 	r.Init(g.result, ro)
 
-	result, err := extract(r)
+	uo := flatbuffers.GetUOffsetT(g.query)
+	q := new(task.Query)
+	q.Init(g.query, uo)
+
+	query, result, err := extract(q, r)
 	if err != nil {
 		return gr, err
 	}
 
+	gr.Query = query
 	gr.Result = result
 
 	for _, child := range g.Children {
diff --git a/query/query_test.go b/query/query_test.go
index 56dc9dfb369ccabc1e34ed6278cabdfbaa98371d..792741f14ebcd68ad4e355ffc5de8fdde18a7fdb 100644
--- a/query/query_test.go
+++ b/query/query_test.go
@@ -383,6 +383,9 @@ func TestPreTraverse(t *testing.T) {
 	if child.Attribute != "name" {
 		t.Errorf("Expected attr friend. Got: %v", child.Attribute)
 	}
+	if len(child.Query.Uids) != 5 {
+		t.Errorf("Expected 5 uids in query. Got: %v", len(child.Query.Uids))
+	}
 
 	names := child.Result.Values