DataFormat returns a file's data format (RDF, JSON, or unknown) based on the filename or the user-provided format option. The file extension has precedence.
(filename string, format string)
| 400 | // DataFormat returns a file's data format (RDF, JSON, or unknown) based on the filename |
| 401 | // or the user-provided format option. The file extension has precedence. |
| 402 | func DataFormat(filename string, format string) InputFormat { |
| 403 | format = strings.ToLower(format) |
| 404 | filename = strings.TrimSuffix(strings.ToLower(filename), ".gz") |
| 405 | switch { |
| 406 | case strings.HasSuffix(filename, ".rdf") || format == "rdf": |
| 407 | return RdfFormat |
| 408 | case strings.HasSuffix(filename, ".json") || format == "json": |
| 409 | return JsonFormat |
| 410 | default: |
| 411 | return UnknownFormat |
| 412 | } |
| 413 | } |
no outgoing calls
searching dependent graphs…