{"record":{"id":"4f705d1842c00d9e","repo":"dgraph-io/dgraph","slug":"ignorereflex-directive-is-not-supported-in-the-rdf","errorCode":null,"errorMessage":"ignorereflex directive is not supported in the rdf output format","messagePattern":"ignorereflex directive is not supported in the rdf output format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"query/outputrdf.go","lineNumber":226,"sourceCode":"\tbuf = append(buf, '<')\n\tbuf = append(buf, val...)\n\tbuf = append(buf, '>')\n\treturn buf\n}\n\nfunc validateSubGraphForRDF(sg *SubGraph) error {\n\tif sg.IsGroupBy() {\n\t\treturn errors.New(\"groupby is not supported in rdf output format\")\n\t}\n\tuidCount := sg.Attr == \"uid\" && sg.Params.DoCount && sg.IsInternal()\n\tif uidCount {\n\t\treturn errors.New(\"uid count is not supported in the rdf output format\")\n\t}\n\tif sg.Params.Normalize {\n\t\treturn errors.New(\"normalize directive is not supported in the rdf output format\")\n\t}\n\tif sg.Params.IgnoreReflex {\n\t\treturn errors.New(\"ignorereflex directive is not supported in the rdf output format\")\n\t}\n\tif sg.SrcFunc != nil && sg.SrcFunc.Name == \"checkpwd\" {\n\t\treturn errors.New(\"chkpwd function is not supported in the rdf output format\")\n\t}\n\tif sg.Params.Facet != nil && !sg.Params.ExpandAll {\n\t\treturn errors.New(\"facets are not supported in the rdf output format\")\n\t}\n\treturn nil\n}\n\nfunc quotedNumber(val []byte) []byte {\n\tconst overhead = 2 // opening and closing quotes\n\tif len(val) > math.MaxInt-overhead {\n\t\t// Extremely unlikely, but handle overflow case\n\t\ttmpVal := make([]byte, 0)\n\t\ttmpVal = append(tmpVal, '\"')\n\t\ttmpVal = append(tmpVal, val...)\n\t\ttmpVal = append(tmpVal, '\"')","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/query/outputrdf.go#L208-L244","documentation":"The ignorereflex directive suppresses reflexive (self-referencing) edges, but RDF output has no mechanism to honor it. validateSubGraphForRDF rejects sub-graphs with sg.Params.IgnoreReflex set during RDF serialization.","triggerScenarios":"A query with `@ignorereflex` on a recursion or edge traversal (e.g. `recurse(follow) @ignorereflex`) executed with RDF output format.","commonSituations":"Graph traversal exports of cyclic graphs (follows/likes edges) requested in RDF; combined directives copied from JSON queries.","solutions":["Remove @ignorereflex and filter reflexive edges client-side","Use JSON output format where ignorereflex is supported","Post-process the RDF to drop triples where subject == object"],"exampleFix":"// before\n{ me(func: uid(0x1)) @recurse(follow, ignorereflex) { follow } }\n// after (rdf): { me(func: uid(0x1)) @recurse(depth: 3) { follow } } // filter self-loops after export","handlingStrategy":"validation","validationCode":"// Go: reject @ignorereflex for RDF output\nif strings.Contains(query, \"@ignorereflex\") {\n    return errors.New(\"ignorereflex requires JSON output\")\n}","typeGuard":"func usesIgnoreReflex(dql string) bool {\n    return strings.Contains(dql, \"@ignorereflex\")\n}","tryCatchPattern":"res, err := txn.QueryRDF(ctx, dql)\nif err != nil && strings.Contains(err.Error(), \"ignorereflex directive is not supported\") {\n    return txn.Query(ctx, strings.ReplaceAll(dql, \"@ignorereflex\", \"\"))\n}","preventionTips":["Post-filter reflexive triples (subject == object) after RDF export instead","Use ignorereflex only with JSON output","Document the directive's JSON-only status in query templates"],"tags":["dgraph","rdf","ignorereflex","query-validation"],"backgroundTag":"feature-not-supported-in-rdf-output","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}