github.com/dgraph-io/dgraph@v1.2.8/graphql/resolve/query_test.yaml (about)

     1  -
     2    name: "ID query"
     3    gqlquery: |
     4      query {
     5        getAuthor(id: "0x1") {
     6          name
     7        }
     8      }
     9    dgquery: |-
    10      query {
    11        getAuthor(func: uid(0x1)) @filter(type(Author)) {
    12          name : Author.name
    13          dgraph.uid : uid
    14        }
    15      }
    16  
    17  -
    18    name: "UID alias"
    19    gqlquery: |
    20      query {
    21        getAuthor(id: "0x1") {
    22          id
    23          uid: name
    24        }
    25      }
    26    dgquery: |-
    27      query {
    28        getAuthor(func: uid(0x1)) @filter(type(Author)) {
    29          id : uid
    30          uid : Author.name
    31          dgraph.uid : uid
    32        }
    33      }
    34  
    35  -
    36    name: "UID alias without id"
    37    gqlquery: |
    38      query {
    39        getAuthor(id: "0x1") {
    40          uid: name
    41        }
    42      }
    43    dgquery: |-
    44      query {
    45        getAuthor(func: uid(0x1)) @filter(type(Author)) {
    46          uid : Author.name
    47          dgraph.uid : uid
    48        }
    49      }
    50  
    51  
    52  -
    53    name: "ID query with query alias"
    54    gqlquery: |
    55      query {
    56        author : getAuthor(id: "0x1") {
    57          name
    58        }
    59      }
    60    dgquery: |-
    61      query {
    62        author(func: uid(0x1)) @filter(type(Author)) {
    63          name : Author.name
    64          dgraph.uid : uid
    65        }
    66      }
    67  
    68  -
    69    name: "ID query with field alias"
    70    gqlquery: |
    71      query {
    72        getAuthor(id: "0x1") {
    73          authName : name
    74        }
    75      }
    76    dgquery: |-
    77      query {
    78        getAuthor(func: uid(0x1)) @filter(type(Author)) {
    79          authName : Author.name
    80          dgraph.uid : uid
    81        }
    82      }
    83  
    84  -
    85    name: "ID field gets transformed to uid"
    86    gqlquery: |
    87      query {
    88        getAuthor(id: "0x1") {
    89          id
    90          name
    91        }
    92      }
    93    dgquery: |-
    94      query {
    95        getAuthor(func: uid(0x1)) @filter(type(Author)) {
    96          id : uid
    97          name : Author.name
    98          dgraph.uid : uid
    99        }
   100      }
   101  
   102  -
   103    name: "ID query with depth"
   104    gqlquery: |
   105      query {
   106        getAuthor(id: "0x1") {
   107          name
   108          posts {
   109            title
   110            text
   111          }
   112        }
   113      }
   114    dgquery: |-
   115      query {
   116        getAuthor(func: uid(0x1)) @filter(type(Author)) {
   117          name : Author.name
   118          posts : Author.posts {
   119            title : Post.title
   120            text : Post.text
   121            dgraph.uid : uid
   122          }
   123          dgraph.uid : uid
   124        }
   125      }
   126  
   127  -
   128    name: "ID query with depth and alias"
   129    gqlquery: |
   130      query {
   131        getAuthor(id: "0x1") {
   132          name
   133          allPosts : posts {
   134            postTitle : title
   135            postText : text
   136          }
   137        }
   138      }
   139    dgquery: |-
   140      query {
   141        getAuthor(func: uid(0x1)) @filter(type(Author)) {
   142          name : Author.name
   143          allPosts : Author.posts {
   144            postTitle : Post.title
   145            postText : Post.text
   146            dgraph.uid : uid
   147          }
   148          dgraph.uid : uid
   149        }
   150      }
   151  
   152  -
   153    name: "ID query deep"
   154    gqlquery: |
   155      query {
   156        getAuthor(id: "0x1") {
   157          name
   158          allPosts : posts {
   159            title
   160            text
   161            author {
   162              authorID : id
   163              name
   164            }
   165          }
   166        }
   167      }
   168    dgquery: |-
   169      query {
   170        getAuthor(func: uid(0x1)) @filter(type(Author)) {
   171          name : Author.name
   172          allPosts : Author.posts {
   173            title : Post.title
   174            text : Post.text
   175            author : Post.author {
   176              authorID : uid
   177              name : Author.name
   178              dgraph.uid : uid
   179            }
   180            dgraph.uid : uid
   181          }
   182          dgraph.uid : uid
   183        }
   184      }
   185  
   186  -
   187    name: "Query with no args is query for everything of that type"
   188    gqlquery: |
   189      query {
   190        queryAuthor {
   191          name
   192        }
   193      }
   194    dgquery: |-
   195      query {
   196        queryAuthor(func: type(Author)) {
   197          name : Author.name
   198          dgraph.uid : uid
   199        }
   200      }
   201  
   202  -
   203    name: "Filter gets rewritten as @filter"
   204    gqlquery: |
   205      query {
   206        queryAuthor(filter: { name: { eq: "A. N. Author" } }) {
   207          name
   208        }
   209      }
   210    dgquery: |-
   211      query {
   212        queryAuthor(func: type(Author)) @filter(eq(Author.name, "A. N. Author")) {
   213          name : Author.name
   214          dgraph.uid : uid
   215        }
   216      }
   217  
   218  -
   219    name: "Filters in same input object implies AND"
   220    gqlquery: |
   221      query {
   222        queryAuthor(filter: { name: { eq: "A. N. Author" }, dob: { le: "2001-01-01" }, reputation: { gt: 2.5 } } ) {
   223          name
   224        }
   225      }
   226    dgquery: |-
   227      query {
   228        queryAuthor(func: type(Author)) @filter((le(Author.dob, "2001-01-01") AND eq(Author.name, "A. N. Author") AND gt(Author.reputation, 2.5))) {
   229          name : Author.name
   230          dgraph.uid : uid
   231        }
   232      }
   233  
   234  -
   235    name: "Filter with nested 'and'"
   236    gqlquery: |
   237      query {
   238        queryAuthor(filter: { name: { eq: "A. N. Author" }, and: { dob: { le: "2001-01-01" }, and: { reputation: { gt: 2.5 } } } } ) {
   239          name
   240        }
   241      }
   242    dgquery: |-
   243      query {
   244        queryAuthor(func: type(Author)) @filter(((gt(Author.reputation, 2.5) AND le(Author.dob, "2001-01-01")) AND eq(Author.name, "A. N. Author"))) {
   245          name : Author.name
   246          dgraph.uid : uid
   247        }
   248      }
   249  
   250  -
   251    name: "Filter with 'or'"
   252    gqlquery: |
   253      query {
   254        queryAuthor(filter: { name: { eq: "A. N. Author" }, or: { dob: { le: "2001-01-01" } } } ) {
   255          name
   256        }
   257      }
   258    dgquery: |-
   259      query {
   260        queryAuthor(func: type(Author)) @filter((eq(Author.name, "A. N. Author") OR le(Author.dob, "2001-01-01"))) {
   261          name : Author.name
   262          dgraph.uid : uid
   263        }
   264      }
   265  
   266  
   267  -
   268    name: "Filter with implied and as well as 'or'"
   269    gqlquery: |
   270      query {
   271        queryAuthor(filter: { name: { eq: "A. N. Author" }, reputation: { gt: 2.5 }, or: { dob: { le: "2001-01-01" } } } ) {
   272          name
   273        }
   274      }
   275    dgquery: |-
   276      query {
   277        queryAuthor(func: type(Author)) @filter(((eq(Author.name, "A. N. Author") AND gt(Author.reputation, 2.5)) OR le(Author.dob, "2001-01-01"))) {
   278          name : Author.name
   279          dgraph.uid : uid
   280        }
   281      }
   282  
   283  -
   284    name: "Filter with implied and nested in 'or'"
   285    gqlquery: |
   286      query {
   287        queryAuthor(filter: { name: { eq: "A. N. Author" }, or: { reputation: { gt: 2.5 }, dob: { le: "2001-01-01" } } } ) {
   288          name
   289        }
   290      }
   291    dgquery: |-
   292      query {
   293        queryAuthor(func: type(Author)) @filter((eq(Author.name, "A. N. Author") OR (le(Author.dob, "2001-01-01") AND gt(Author.reputation, 2.5)))) {
   294          name : Author.name
   295          dgraph.uid : uid
   296        }
   297      }
   298  
   299  -
   300    name: "Filter nested 'or'"
   301    gqlquery: |
   302      query {
   303        queryAuthor(filter: { name: { eq: "A. N. Author" }, or: { reputation: { gt: 2.5 }, or: { dob: { le: "2001-01-01" } } } } ) {
   304          name
   305        }
   306      }
   307    dgquery: |-
   308      query {
   309        queryAuthor(func: type(Author)) @filter((eq(Author.name, "A. N. Author") OR (gt(Author.reputation, 2.5) OR le(Author.dob, "2001-01-01")))) {
   310          name : Author.name
   311          dgraph.uid : uid
   312        }
   313      }
   314  
   315  -
   316    name: "Filter with 'not"
   317    gqlquery: |
   318      query {
   319        queryAuthor(filter: { not: { reputation: { gt: 2.5 } } } ) {
   320          name
   321        }
   322      }
   323    dgquery: |-
   324      query {
   325        queryAuthor(func: type(Author)) @filter(NOT (gt(Author.reputation, 2.5))) {
   326          name : Author.name
   327          dgraph.uid : uid
   328        }
   329      }
   330  
   331  -
   332    name: "Filter with first"
   333    gqlquery: |
   334      query {
   335        queryAuthor(filter: { name: { eq: "A. N. Author" } }, first: 10) {
   336          name
   337        }
   338      }
   339    dgquery: |-
   340      query {
   341        queryAuthor(func: type(Author), first: 10) @filter(eq(Author.name, "A. N. Author")) {
   342          name : Author.name
   343          dgraph.uid : uid
   344        }
   345      }
   346  
   347  -
   348    name: "Filter with first and offset"
   349    gqlquery: |
   350      query {
   351        queryAuthor(filter: { name: { eq: "A. N. Author" } }, first: 10, offset: 10) {
   352          name
   353        }
   354      }
   355    dgquery: |-
   356      query {
   357        queryAuthor(func: type(Author), first: 10, offset: 10) @filter(eq(Author.name, "A. N. Author")) {
   358          name : Author.name
   359          dgraph.uid : uid
   360        }
   361      }
   362  
   363  -
   364    name: "Filter with order asc"
   365    gqlquery: |
   366      query {
   367        queryAuthor(filter: { name: { eq: "A. N. Author" } }, order: { asc: reputation }) {
   368          name
   369        }
   370      }
   371    dgquery: |-
   372      query {
   373        queryAuthor(func: type(Author), orderasc: Author.reputation) @filter(eq(Author.name, "A. N. Author")) {
   374          name : Author.name
   375          dgraph.uid : uid
   376        }
   377      }
   378  
   379  -
   380    name: "Filter with order desc"
   381    gqlquery: |
   382      query {
   383        queryAuthor(filter: { name: { eq: "A. N. Author" } }, order: { desc: reputation }) {
   384          name
   385        }
   386      }
   387    dgquery: |-
   388      query {
   389        queryAuthor(func: type(Author), orderdesc: Author.reputation) @filter(eq(Author.name, "A. N. Author")) {
   390          name : Author.name
   391          dgraph.uid : uid
   392        }
   393      }
   394  
   395  
   396  -
   397    name: "Filter with nested order"
   398    gqlquery: |
   399      query {
   400        queryAuthor(filter: { name: { eq: "A. N. Author" } }, order: { desc: reputation, then: { asc: dob } }) {
   401          name
   402        }
   403      }
   404    dgquery: |-
   405      query {
   406        queryAuthor(func: type(Author), orderdesc: Author.reputation, orderasc: Author.dob) @filter(eq(Author.name, "A. N. Author")) {
   407          name : Author.name
   408          dgraph.uid : uid
   409        }
   410      }
   411  
   412  -
   413    name: "Filter with order, first and offset"
   414    gqlquery: |
   415      query {
   416        queryAuthor(filter: { name: { eq: "A. N. Author" } }, order: { desc: reputation }, first: 10, offset: 10) {
   417          name
   418        }
   419      }
   420    dgquery: |-
   421      query {
   422        queryAuthor(func: type(Author), orderdesc: Author.reputation, first: 10, offset: 10) @filter(eq(Author.name, "A. N. Author")) {
   423          name : Author.name
   424          dgraph.uid : uid
   425        }
   426      }
   427  
   428  -
   429    name: "Deep filter"
   430    gqlquery: |
   431      query {
   432        queryAuthor {
   433          name
   434          posts(filter: { title: { anyofterms: "GraphQL" } }) {
   435            title
   436          }
   437        }
   438      }
   439    dgquery: |-
   440      query {
   441        queryAuthor(func: type(Author)) {
   442          name : Author.name
   443          posts : Author.posts @filter(anyofterms(Post.title, "GraphQL")) {
   444            title : Post.title
   445            dgraph.uid : uid
   446          }
   447          dgraph.uid : uid
   448        }
   449      }
   450  
   451  
   452  -
   453    name: "Deep filter with first"
   454    gqlquery: |
   455      query {
   456        queryAuthor {
   457          name
   458          posts(filter: { title: { anyofterms: "GraphQL" } }, first: 10) {
   459            title
   460          }
   461        }
   462      }
   463    dgquery: |-
   464      query {
   465        queryAuthor(func: type(Author)) {
   466          name : Author.name
   467          posts : Author.posts @filter(anyofterms(Post.title, "GraphQL")) (first: 10) {
   468            title : Post.title
   469            dgraph.uid : uid
   470          }
   471          dgraph.uid : uid
   472        }
   473      }
   474  
   475  -
   476    name: "Deep filter with order, first and offset"
   477    gqlquery: |
   478      query {
   479        queryAuthor {
   480          name
   481          posts(filter: { title: { anyofterms: "GraphQL" } }, order: { asc: numLikes }, first: 10, offset: 10) {
   482            title
   483          }
   484        }
   485      }
   486    dgquery: |-
   487      query {
   488        queryAuthor(func: type(Author)) {
   489          name : Author.name
   490          posts : Author.posts @filter(anyofterms(Post.title, "GraphQL")) (orderasc: Post.numLikes, first: 10, offset: 10) {
   491            title : Post.title
   492            dgraph.uid : uid
   493          }
   494          dgraph.uid : uid
   495        }
   496      }
   497  
   498  
   499  -
   500    name: "All Float filters work"
   501    gqlquery: |
   502      query {
   503        queryAuthor(filter: { reputation: { gt: 1.1 }, or: { reputation: { ge: 1.1 }, or: { reputation: { lt: 1.1 }, or: { reputation: { le: 1.1 }, or: { reputation: { eq: 1.1 } } } } } } ) {
   504          name
   505        }
   506      }
   507    dgquery: |-
   508      query {
   509        queryAuthor(func: type(Author)) @filter((gt(Author.reputation, 1.1) OR (ge(Author.reputation, 1.1) OR (lt(Author.reputation, 1.1) OR (le(Author.reputation, 1.1) OR eq(Author.reputation, 1.1)))))) {
   510          name : Author.name
   511          dgraph.uid : uid
   512        }
   513      }
   514  
   515  -
   516    name: "All DateTime filters work"
   517    gqlquery: |
   518      query {
   519        queryAuthor(filter: { dob: { gt: "2000-01-01" }, or: { dob: { ge: "2000-01-01" }, or: { dob: { lt: "2000-01-01" }, or: { dob: { le: "2000-01-01" }, or: { dob: { eq: "2000-01-01" } } } } } } ) {
   520          name
   521        }
   522      }
   523    dgquery: |-
   524      query {
   525        queryAuthor(func: type(Author)) @filter((gt(Author.dob, "2000-01-01") OR (ge(Author.dob, "2000-01-01") OR (lt(Author.dob, "2000-01-01") OR (le(Author.dob, "2000-01-01") OR eq(Author.dob, "2000-01-01")))))) {
   526          name : Author.name
   527          dgraph.uid : uid
   528        }
   529      }
   530  
   531  -
   532    name: "All Int filters work"
   533    gqlquery: |
   534      query {
   535        queryPost(filter: { numLikes: { gt: 10 }, or: { numLikes: { ge: 10 }, or: { numLikes: { lt: 10 }, or: { numLikes: { le: 10 }, or: { numLikes: { eq: 10 } } } } } } ) {
   536          title
   537        }
   538      }
   539    dgquery: |-
   540      query {
   541        queryPost(func: type(Post)) @filter((gt(Post.numLikes, 10) OR (ge(Post.numLikes, 10) OR (lt(Post.numLikes, 10) OR (le(Post.numLikes, 10) OR eq(Post.numLikes, 10)))))) {
   542          title : Post.title
   543          dgraph.uid : uid
   544        }
   545      }
   546  
   547  -
   548    name: "All String hash filters work"
   549    gqlquery: |
   550      query {
   551        queryAuthor(filter: { name: { eq: "A. N. Author" } } ) {
   552          name
   553        }
   554      }
   555    dgquery: |-
   556      query {
   557        queryAuthor(func: type(Author)) @filter(eq(Author.name, "A. N. Author")) {
   558          name : Author.name
   559          dgraph.uid : uid
   560        }
   561      }
   562  
   563  -
   564    name: "All String exact filters work"
   565    gqlquery: |
   566      query {
   567        queryCountry(filter: { name: { gt: "AAA" }, or: { name: { ge: "AAA" }, or: { name: { lt: "AAA" }, or: { name: { le: "AAA" }, or: { name: { eq: "AAA" } } } } } } ) {
   568          name
   569        }
   570      }
   571    dgquery: |-
   572      query {
   573        queryCountry(func: type(Country)) @filter((gt(Country.name, "AAA") OR (ge(Country.name, "AAA") OR (lt(Country.name, "AAA") OR (le(Country.name, "AAA") OR eq(Country.name, "AAA")))))) {
   574          name : Country.name
   575          dgraph.uid : uid
   576        }
   577      }
   578  
   579  -
   580    name: "All String term filters work"
   581    gqlquery: |
   582      query {
   583        queryPost(filter: { title: { anyofterms: "GraphQL"}, or: { title: { allofterms: "GraphQL" } } } ) {
   584          title
   585        }
   586      }
   587    dgquery: |-
   588      query {
   589        queryPost(func: type(Post)) @filter((anyofterms(Post.title, "GraphQL") OR allofterms(Post.title, "GraphQL"))) {
   590          title : Post.title
   591          dgraph.uid : uid
   592        }
   593      }
   594  
   595  
   596  -
   597    name: "All String fulltext filters work"
   598    gqlquery: |
   599      query {
   600        queryPost(filter: { text: { anyoftext: "GraphQL"}, or: { text: { alloftext: "GraphQL" } } } ) {
   601          title
   602        }
   603      }
   604    dgquery: |-
   605      query {
   606        queryPost(func: type(Post)) @filter((anyoftext(Post.text, "GraphQL") OR alloftext(Post.text, "GraphQL"))) {
   607          title : Post.title
   608          dgraph.uid : uid
   609        }
   610      }
   611  
   612  -
   613    name: "All String regexp filters work"
   614    gqlquery: |
   615      query {
   616        queryCountry(filter: { name: { regexp: "/.*ust.*/" }}) {
   617          name
   618        }
   619      }
   620    dgquery: |-
   621      query {
   622        queryCountry(func: type(Country)) @filter(regexp(Country.name, /.*ust.*/)) {
   623          name : Country.name
   624          dgraph.uid : uid
   625        }
   626      }
   627  
   628  -
   629    name: "Skip directive"
   630    variables:
   631      skipTrue: true
   632      skipFalse: false
   633    gqlquery: |
   634      query ($skipTrue: Boolean!, $skipFalse: Boolean!) {
   635        getAuthor(id: "0x1") {
   636          name @skip(if: $skipFalse)
   637          posts @skip(if: $skipTrue) {
   638            title
   639            text
   640          }
   641        }
   642      }
   643    dgquery: |-
   644      query {
   645        getAuthor(func: uid(0x1)) @filter(type(Author)) {
   646          name : Author.name
   647          dgraph.uid : uid
   648        }
   649      }
   650  
   651  -
   652    name: "Include directive"
   653    variables:
   654      includeTrue: true
   655      includeFalse: false
   656    gqlquery: |
   657      query ($includeTrue: Boolean!, $includeFalse: Boolean!) {
   658        queryAuthor {
   659          name @include(if: $includeTrue)
   660          posts(filter: { title: { anyofterms: "GraphQL" } }) @include(if: $includeFalse) {
   661            title
   662          }
   663        }
   664      }
   665    dgquery: |-
   666      query {
   667        queryAuthor(func: type(Author)) {
   668          name : Author.name
   669          dgraph.uid : uid
   670        }
   671      }
   672  
   673  -
   674    name: "Include only fields for which skip is !false or include is true"
   675    variables:
   676      includeFalse: false
   677      includeTrue: true
   678      skipFalse: false
   679      skipTrue: true
   680    gqlquery: |
   681      query ($includeFalse: Boolean!, $skipTrue: Boolean!, $includeTrue: Boolean!,
   682        $skipFalse: Boolean!) {
   683        queryAuthor {
   684          dob @include(if: $includeFalse) @skip(if: $skipFalse)
   685          reputation @include(if: $includeFalse) @skip(if: $skipTrue)
   686          name @include(if: $includeTrue) @skip(if: $skipFalse)
   687          posts(filter: { title: { anyofterms: "GraphQL" } }, first: 10) @include(if: $includeTrue)
   688            @skip(if: $skipTrue) {
   689            title
   690            tags
   691          }
   692        }
   693      }
   694    dgquery: |-
   695      query {
   696        queryAuthor(func: type(Author)) {
   697          name : Author.name
   698          dgraph.uid : uid
   699        }
   700      }
   701  
   702  -
   703    name: "getHuman which implements an interface"
   704    gqlquery: |
   705      query {
   706        getHuman(id: "0x1") {
   707          id
   708          name
   709          ename
   710          dob
   711          female
   712        }
   713      }
   714    dgquery: |-
   715      query {
   716        getHuman(func: uid(0x1)) @filter(type(Human)) {
   717          id : uid
   718          name : Character.name
   719          ename : Employee.ename
   720          dob : Human.dob
   721          female : Human.female
   722          dgraph.uid : uid
   723        }
   724      }
   725  
   726  -
   727    name: "queryHuman which implements an interface"
   728    gqlquery: |
   729      query {
   730        queryHuman {
   731          id
   732          name
   733          ename
   734          dob
   735          female
   736        }
   737      }
   738    dgquery: |-
   739      query {
   740        queryHuman(func: type(Human)) {
   741          id : uid
   742          name : Character.name
   743          ename : Employee.ename
   744          dob : Human.dob
   745          female : Human.female
   746          dgraph.uid : uid
   747        }
   748      }
   749  
   750  -
   751    name: "filter with order for type which implements an interface"
   752    gqlquery: |
   753      query {
   754        queryHuman (filter: { name: { anyofterms: "GraphQL" } }, order: { asc: ename }) {
   755          id
   756          name
   757          ename
   758          dob
   759        }
   760      }
   761    dgquery: |-
   762      query {
   763        queryHuman(func: type(Human), orderasc: Employee.ename) @filter(anyofterms(Character.name, "GraphQL")) {
   764          id : uid
   765          name : Character.name
   766          ename : Employee.ename
   767          dob : Human.dob
   768          dgraph.uid : uid
   769        }
   770      }
   771  
   772  -
   773    name: "queryCharacter with fragment for human"
   774    gqlquery: |
   775      query {
   776        queryCharacter {
   777          id
   778          name
   779          ... on Human {
   780            female
   781            ename
   782          }
   783        }
   784      }
   785    dgquery: |-
   786      query {
   787        queryCharacter(func: type(Character)) {
   788          dgraph.type
   789          id : uid
   790          name : Character.name
   791          female : Human.female
   792          ename : Employee.ename
   793          dgraph.uid : uid
   794        }
   795      }
   796  
   797  -
   798    name: "queryCharacter with fragment on multiple types"
   799    gqlquery: |
   800      query {
   801        queryCharacter {
   802          id
   803          name
   804          ... on Human {
   805            female
   806            ename
   807          }
   808          ... on Director {
   809            movies
   810          }
   811        }
   812      }
   813    dgquery: |-
   814      query {
   815        queryCharacter(func: type(Character)) {
   816          dgraph.type
   817          id : uid
   818          name : Character.name
   819          female : Human.female
   820          ename : Employee.ename
   821          movies : Director.movies
   822          dgraph.uid : uid
   823        }
   824      }
   825  
   826  -
   827    name: "Filter with id uses uid func at root."
   828    gqlquery: |
   829      query {
   830        queryAuthor(filter: { id: ["0x1", "0x2"], and: { name: { eq: "A. N. Author" } }}) {
   831          name
   832        }
   833      }
   834    dgquery: |-
   835      query {
   836        queryAuthor(func: uid(0x1, 0x2)) @filter((eq(Author.name, "A. N. Author") AND type(Author))) {
   837          name : Author.name
   838          dgraph.uid : uid
   839        }
   840      }
   841  
   842  -
   843    name: "Filter with id inside and argument doesn't use uid func at root."
   844    gqlquery: |
   845      query {
   846        queryAuthor(filter: { name: { eq: "A. N. Author" }, and: { id: ["0x1", "0x2"] }}) {
   847          name
   848        }
   849      }
   850    dgquery: |-
   851      query {
   852        queryAuthor(func: type(Author)) @filter((uid(0x1, 0x2) AND eq(Author.name, "A. N. Author"))) {
   853          name : Author.name
   854          dgraph.uid : uid
   855        }
   856      }
   857  
   858  -
   859    name: "Filter with id and not translates correctly.."
   860    gqlquery: |
   861      query {
   862        queryAuthor(filter: { not: { id: ["0x1", "0x2"] }}) {
   863          name
   864        }
   865      }
   866    dgquery: |-
   867      query {
   868        queryAuthor(func: type(Author)) @filter(NOT (uid(0x1, 0x2))) {
   869          name : Author.name
   870          dgraph.uid : uid
   871        }
   872      }
   873  
   874  -
   875    name: "Deep filter with id"
   876    gqlquery: |
   877      query {
   878        queryAuthor {
   879          name
   880          posts(filter: { postID: ["0x1", "0x2"], and: { title: { anyofterms: "GraphQL" } }}) {
   881            title
   882          }
   883        }
   884      }
   885    dgquery: |-
   886      query {
   887        queryAuthor(func: type(Author)) {
   888          name : Author.name
   889          posts : Author.posts @filter((anyofterms(Post.title, "GraphQL") AND uid(0x1, 0x2))) {
   890            title : Post.title
   891            dgraph.uid : uid
   892          }
   893          dgraph.uid : uid
   894        }
   895      }
   896  
   897  -
   898    name: "Deep filter with id in not key"
   899    gqlquery: |
   900      query {
   901        queryAuthor {
   902          name
   903          posts(filter: { title: { anyofterms: "GraphQL" }, not: { postID: ["0x1", "0x2"] } }) {
   904            title
   905          }
   906        }
   907      }
   908    dgquery: |-
   909      query {
   910        queryAuthor(func: type(Author)) {
   911          name : Author.name
   912          posts : Author.posts @filter((NOT (uid(0x1, 0x2)) AND anyofterms(Post.title, "GraphQL"))) {
   913            title : Post.title
   914            dgraph.uid : uid
   915          }
   916          dgraph.uid : uid
   917        }
   918      }
   919  
   920  -
   921    name: "Pagination and Order at root node with UID."
   922    gqlquery: |
   923      query {
   924        queryAuthor(filter: { id: ["0x1", "0x2"] }, order: {asc: name}, first: 0, offset: 1 ) {
   925          name
   926        }
   927      }
   928    dgquery: |-
   929      query {
   930        queryAuthor(func: uid(0x1, 0x2), orderasc: Author.name, first: 0, offset: 1) @filter(type(Author)) {
   931          name : Author.name
   932          dgraph.uid : uid
   933        }
   934      }
   935  
   936  -
   937    name: "Order at root node with UID."
   938    gqlquery: |
   939      query {
   940        queryAuthor(filter: { id: ["0x1", "0x2"] }, order: {asc: name}) {
   941          name
   942        }
   943      }
   944    dgquery: |-
   945      query {
   946        queryAuthor(func: uid(0x1, 0x2), orderasc: Author.name) @filter(type(Author)) {
   947          name : Author.name
   948          dgraph.uid : uid
   949        }
   950      }
   951  
   952  -
   953    name: "Order at root node without UID."
   954    gqlquery: |
   955      query {
   956        queryAuthor(order: {asc: name}) {
   957          name
   958        }
   959      }
   960    dgquery: |-
   961      query {
   962        queryAuthor(func: type(Author), orderasc: Author.name) {
   963          name : Author.name
   964          dgraph.uid : uid
   965        }
   966      }
   967  
   968  -
   969    name: "Order and Pagination at root node without UID."
   970    gqlquery: |
   971      query {
   972        queryAuthor(order: {asc: name}, first: 2, offset: 3) {
   973          name
   974        }
   975      }
   976    dgquery: |-
   977      query {
   978        queryAuthor(func: type(Author), orderasc: Author.name, first: 2, offset: 3) {
   979          name : Author.name
   980          dgraph.uid : uid
   981        }
   982      }
   983  
   984  
   985  -
   986    name: "Filter with no valid id construct the right query with type func at root."
   987    gqlquery: |
   988      query {
   989        queryAuthor(filter: { id: ["alice", "bob"], and: { name: { eq: "A. N. Author" } }}) {
   990          name
   991        }
   992      }
   993    dgquery: |-
   994      query {
   995        queryAuthor(func: uid()) @filter((eq(Author.name, "A. N. Author") AND type(Author))) {
   996          name : Author.name
   997          dgraph.uid : uid
   998        }
   999      }
  1000  
  1001  -
  1002    name: "Filter with id only includes valid id in dgquery."
  1003    gqlquery: |
  1004      query {
  1005        queryAuthor(filter: { id: ["0x1", "bob"], and: { name: { eq: "A. N. Author" } }}) {
  1006          name
  1007        }
  1008      }
  1009    dgquery: |-
  1010      query {
  1011        queryAuthor(func: uid(0x1)) @filter((eq(Author.name, "A. N. Author") AND type(Author))) {
  1012          name : Author.name
  1013          dgraph.uid : uid
  1014        }
  1015      }
  1016  
  1017  -
  1018    name: "Get editor without supplying anything"
  1019    gqlquery: |
  1020      query {
  1021        getEditor {
  1022          name
  1023        }
  1024      }
  1025    dgquery: |-
  1026      query {
  1027        getEditor(func: uid(0x0)) @filter(type(Editor)) {
  1028          name : Editor.name
  1029          dgraph.uid : uid
  1030        }
  1031      }
  1032  
  1033  -
  1034    name: "Get editor using code"
  1035    gqlquery: |
  1036      query {
  1037        getEditor(code: "tolstoy") {
  1038          name
  1039        }
  1040      }
  1041    dgquery: |-
  1042      query {
  1043        getEditor(func: eq(Editor.code, "tolstoy")) @filter(type(Editor)) {
  1044          name : Editor.name
  1045          dgraph.uid : uid
  1046        }
  1047      }
  1048  
  1049  -
  1050    name: "Get editor using both code and id"
  1051    gqlquery: |
  1052      query {
  1053        getEditor(code: "tolstoy", id: "0x1") {
  1054          name
  1055        }
  1056      }
  1057    dgquery: |-
  1058      query {
  1059        getEditor(func: uid(0x1)) @filter((eq(Editor.code, "tolstoy") AND type(Editor))) {
  1060          name : Editor.name
  1061          dgraph.uid : uid
  1062        }
  1063      }
  1064  
  1065  -
  1066    name: "Query editor using code"
  1067    gqlquery: |
  1068      query {
  1069        queryEditor(filter: { code: { eq: "editor" }, and: { name: { eq: "A. N. Editor" }}}) {
  1070          name
  1071        }
  1072      }
  1073    dgquery: |-
  1074      query {
  1075        queryEditor(func: type(Editor)) @filter((eq(Editor.name, "A. N. Editor") AND eq(Editor.code, "editor"))) {
  1076          name : Editor.name
  1077          dgraph.uid : uid
  1078        }
  1079      }
  1080  
  1081  -
  1082    name: "Query editor using code and uid"
  1083    gqlquery: |
  1084      query {
  1085        queryEditor(filter: { id: ["0x1"], and: { code: { eq: "editor"}}}) {
  1086          name
  1087        }
  1088      }
  1089    dgquery: |-
  1090      query {
  1091        queryEditor(func: uid(0x1)) @filter((eq(Editor.code, "editor") AND type(Editor))) {
  1092          name : Editor.name
  1093          dgraph.uid : uid
  1094        }
  1095      }
  1096