{"record":{"id":"5660ebee91272081","repo":"dgraph-io/dgraph","slug":"geo-id-is-not-supported-in-rdf-output","errorCode":null,"errorMessage":"Geo id is not supported in rdf output","messagePattern":"Geo id is not supported in rdf output","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"query/outputrdf.go","lineNumber":189,"sourceCode":"\t\t}\n\t\tb.writeRDF(subject, []byte(attr), outputval)\n\t}\n}\n\nfunc getObjectVal(v types.Val) ([]byte, error) {\n\toutputval, err := valToBytes(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch v.Tid {\n\tcase types.UidID:\n\t\treturn buildTriple(outputval), nil\n\tcase types.IntID:\n\t\treturn quotedNumber(outputval), nil\n\tcase types.FloatID:\n\t\treturn quotedNumber(outputval), nil\n\tcase types.GeoID:\n\t\treturn nil, errors.New(\"Geo id is not supported in rdf output\")\n\tdefault:\n\t\treturn outputval, nil\n\t}\n}\n\nfunc buildTriple(val []byte) []byte {\n\t// Check for potential overflow in capacity calculation\n\tconst overhead = 2 // '<' and '>'\n\tif len(val) > math.MaxInt-overhead {\n\t\t// Extremely unlikely, but handle overflow case\n\t\t// Fall back to append without pre-allocation\n\t\tbuf := make([]byte, 0)\n\t\tbuf = append(buf, '<')\n\t\tbuf = append(buf, val...)\n\t\tbuf = append(buf, '>')\n\t\treturn buf\n\t}\n\tbuf := make([]byte, 0, overhead+len(val))","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/query/outputrdf.go#L171-L207","documentation":"Dgraph's RDF output serializer can render most scalar values as triples, but geolocation values (types.GeoID) have no valid RDF literal representation in this path. getObjectVal returns this error rather than emitting a malformed triple when a geo value is encountered during rdfForSubgraph/rdfForValueList.","triggerScenarios":"Exporting or reading (e.g. /mutate?commitNow with query, export to RDF, or rdf-format read) a node whose predicate holds a geo value (geo-type predicate), hitting the types.GeoID case in the RDF output path.","commonSituations":"Bulk export (/export) or all-nodes queries including geo predicates; move/export tooling over mixed-type graphs containing geo locations; admin export with RDF format.","solutions":["Exclude geo predicates from the RDF export/read (filter predicates in the query or export configuration)","Use JSON output instead of RDF for data containing geo values (drop rdf format option)","Convert geo values to string JSON before export if RDF is mandatory, then re-import as geo after","Upgrade Dgraph if newer versions add geo support to the RDF path"],"exampleFix":"# before: export all including geo\ndgraph graph export\n# after: exclude geo predicates via query-only export\n# export with query filtering out geo predicates, or read results as JSON\ncurl 'localhost:8080/query' -d '{ q(func: type(Place)) { uid name } }'","handlingStrategy":"validation","validationCode":"const schema = await dgraph.schema();\nconst geoPreds = schema.filter(p => p.type === 'geo').map(p => p.predicate);\nif (geoPreds.some(p => requestedPredicates.includes(p))) throw new Error('geo predicates unsupported in RDF output; use JSON');","typeGuard":null,"tryCatchPattern":"try {\n  return await exportRdf();\n} catch (e) {\n  if (String(e).includes('Geo id is not supported in rdf output')) {\n    return await exportJson(); // fall back to JSON output\n  }\n  throw e;\n}","preventionTips":["Use JSON (not RDF) output for graphs containing geo predicates","Exclude geo predicates from RDF export filters","Store exportable string/float copies of geo data if RDF export is required","Check the schema for geo-typed predicates before choosing export format"],"tags":["dgraph","rdf","geojson","export"],"backgroundTag":"geo-unsupported-in-rdf","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}