Report Issue Edit Page


The fragment keyword lets you define new fragments that can be referenced in a query, per the GraphQL specification. Fragments allow for the reuse of common repeated selections of fields, reducing duplicated text in the DQL documents. Fragments can be nested inside fragments, but no cycles are allowed in such cases. For example:

curl -H "Content-Type: application/dql" localhost:8080/query -XPOST -d $'
query {
  debug(func: uid(1)) {
fragment TestFrag {
fragment TestFragB {
}' | python -m json.tool | less
Note GraphQL+- has been renamed to Dgraph Query Language (DQL). While application/dql is the preferred value for the Content-Type header, we will continue to support Content-Type: application/graphql+- to avoid making breaking changes.
Continue the conversation on Discuss.