Provide a way to replace an object with a single value

campoy commented :

I do not think we should do this automatically, as @manishrjain mentions the behavior would change when used with url, thumbnail.

My proposal would be to use a special alias that would replace the current object with the value given.

So for instance, your query would be:

{
  product(func: uid(0x70980)) {
    name : "http://schema.org/name"
    description : "http://schema.org/description"
    image {
      .: url
    }
  }
}

By using the alias name . in .: url, you’d basically saying you want to replace the current object with the value on the right side.

So if image pointed to a single UID (not a list) you’d get:

{
  "product": [
    {
      "name": "Bissell Multi-oppervlaktereiniger",
      "description": "De veelzijdige CrossWave stofzuigt, dweilt en helpt bij het drogen van vloeren. \n- zowel natte als droge reiniging \n- geen stofzak",
      "image": "https://www.alternate.nl/p/450x450/n/ntzrza9k_30.jpg"
    }
  ]
}

And in the case where you have a list, you’d get:

{
  "product": [
    {
      "name": "Bissell Multi-oppervlaktereiniger",
      "description": "De veelzijdige CrossWave stofzuigt, dweilt en helpt bij het drogen van vloeren. \n- zowel natte als droge reiniging \n- geen stofzak",
      "image": [
        "https://www.alternate.nl/p/450x450/n/ntzrza9k_30.jpg",
        "https://www.alternate.nl/p/450x450/1/1ss9a04z_30.jpg",
        "https://www.alternate.nl/p/450x450/9/9gsheq09_30.jpg"
      ]
    }
  ]
}

as you wished.

What do you think of this proposal?