#compdef oxigraph

autoload -U is-at-least

_oxigraph() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_oxigraph_commands" \
"*::: :->oxigraph" \
&& ret=0
    case $state in
    (oxigraph)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:oxigraph-command-$line[1]:"
        case $line[1] in
            (serve)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which the data should be persisted]:LOCATION:_files -/' \
'--location=[Directory in which the data should be persisted]:LOCATION:_files -/' \
'-b+[Host and port to listen to]:BIND:_hosts' \
'--bind=[Host and port to listen to]:BIND:_hosts' \
'--timeout-s=[Timeout for request processing in seconds]:TIMEOUT_S:_default' \
'--cors[Allows cross-origin requests]' \
'--union-default-graph[If the SPARQL queries should look for triples in all the dataset graphs by default (i.e., without \`GRAPH\` operations)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(serve-read-only)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'-b+[Host and port to listen to]:BIND:_default' \
'--bind=[Host and port to listen to]:BIND:_default' \
'--timeout-s=[Timeout for request processing in seconds]:TIMEOUT_S:_default' \
'--cors[Allow cross-origin requests]' \
'--union-default-graph[If the SPARQL queries should look for triples in all the dataset graphs by default (i.e. without \`GRAPH\` operations)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(backup)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'-d+[Directory in which the backup will be written]:DESTINATION:_files -/' \
'--destination=[Directory in which the backup will be written]:DESTINATION:_files -/' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(load)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'*-f+[File(s) to load]' \
'*--file=[File(s) to load]' \
'--format=[The format of the file(s) to load]:FORMAT:_default' \
'--base=[Base IRI of the file(s) to load]:BASE:_urls' \
'--graph=[Name of the graph to load the data to]:GRAPH:_urls' \
'--non-atomic[Saves data to the database during loading, instead of only doing it at the end]' \
'--lenient[Attempt to keep loading even if the data file is invalid]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(dump)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'-f+[File to dump to]:FILE:_files' \
'--file=[File to dump to]:FILE:_files' \
'--format=[The format of the file(s) to dump]:FORMAT:_default' \
'--graph=[Name of the graph to dump]:GRAPH:_urls' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'(--query-file)-q+[The SPARQL query to execute]:QUERY:_default' \
'(--query-file)--query=[The SPARQL query to execute]:QUERY:_default' \
'(-q --query)--query-file=[File in which the query is stored]:QUERY_FILE:_files' \
'--query-base=[Base IRI of the query]:QUERY_BASE:_urls' \
'-r+[File in which the query results will be stored]:RESULTS_FILE:_files' \
'--results-file=[File in which the query results will be stored]:RESULTS_FILE:_files' \
'--results-format=[The results format]:RESULTS_FORMAT:_default' \
'(--explain)--explain-file=[Write to the given file an explanation of the query evaluation]:EXPLAIN_FILE:_files' \
'(--explain-file)--explain[Print to stderr a human-readable explanation of the query evaluation]' \
'--stats[Compute some evaluation statistics to print as part of the query explanations]' \
'--union-default-graph[If the SPARQL queries should look for triples in all the dataset graphs by default (ie. without \`GRAPH\` operations)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'(--update-file)-u+[The SPARQL update to execute]:UPDATE:_default' \
'(--update-file)--update=[The SPARQL update to execute]:UPDATE:_default' \
'(-u --update)--update-file=[File in which the update is stored]:UPDATE_FILE:_files' \
'--update-base=[Base IRI of the update]:UPDATE_BASE:_urls' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(optimize)
_arguments "${_arguments_options[@]}" : \
'-l+[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'--location=[Directory in which Oxigraph data are persisted]:LOCATION:_files -/' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(convert)
_arguments "${_arguments_options[@]}" : \
'-f+[File to convert from]:FROM_FILE:_files' \
'--from-file=[File to convert from]:FROM_FILE:_files' \
'--from-format=[The format of the file(s) to convert from]:FROM_FORMAT:_default' \
'--from-base=[Base IRI of the file to read]:FROM_BASE:_urls' \
'-t+[File to convert to]:TO_FILE:_files' \
'--to-file=[File to convert to]:TO_FILE:_files' \
'--to-format=[The format of the file(s) to convert to]:TO_FORMAT:_default' \
'--to-base=[Base IRI of the file to write]:TO_BASE:_urls' \
'(--from-default-graph)--from-graph=[Only load the given named graph from the input file]:FROM_GRAPH:_urls' \
'--to-graph=[Name of the graph to map the default graph to]:TO_GRAPH:_urls' \
'--lenient[Attempt to keep converting even if the data file is invalid]' \
'(--from-graph)--from-default-graph[Only load the default graph from the input file]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_oxigraph__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:oxigraph-help-command-$line[1]:"
        case $line[1] in
            (serve)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(serve-read-only)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(backup)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(load)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(dump)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(optimize)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(convert)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_oxigraph_commands] )) ||
_oxigraph_commands() {
    local commands; commands=(
'serve:Start Oxigraph HTTP server in read-write mode' \
'serve-read-only:Start Oxigraph HTTP server in read-only mode' \
'backup:Create a database backup into a target directory' \
'load:Load file(s) into the store' \
'dump:Dump the store content into a file' \
'query:Execute a SPARQL query against the store' \
'update:Execute a SPARQL update against the store' \
'optimize:Optimize the database storage' \
'convert:Convert an RDF file from one format to another' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'oxigraph commands' commands "$@"
}
(( $+functions[_oxigraph__backup_commands] )) ||
_oxigraph__backup_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph backup commands' commands "$@"
}
(( $+functions[_oxigraph__convert_commands] )) ||
_oxigraph__convert_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph convert commands' commands "$@"
}
(( $+functions[_oxigraph__dump_commands] )) ||
_oxigraph__dump_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph dump commands' commands "$@"
}
(( $+functions[_oxigraph__help_commands] )) ||
_oxigraph__help_commands() {
    local commands; commands=(
'serve:Start Oxigraph HTTP server in read-write mode' \
'serve-read-only:Start Oxigraph HTTP server in read-only mode' \
'backup:Create a database backup into a target directory' \
'load:Load file(s) into the store' \
'dump:Dump the store content into a file' \
'query:Execute a SPARQL query against the store' \
'update:Execute a SPARQL update against the store' \
'optimize:Optimize the database storage' \
'convert:Convert an RDF file from one format to another' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'oxigraph help commands' commands "$@"
}
(( $+functions[_oxigraph__help__backup_commands] )) ||
_oxigraph__help__backup_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help backup commands' commands "$@"
}
(( $+functions[_oxigraph__help__convert_commands] )) ||
_oxigraph__help__convert_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help convert commands' commands "$@"
}
(( $+functions[_oxigraph__help__dump_commands] )) ||
_oxigraph__help__dump_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help dump commands' commands "$@"
}
(( $+functions[_oxigraph__help__help_commands] )) ||
_oxigraph__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help help commands' commands "$@"
}
(( $+functions[_oxigraph__help__load_commands] )) ||
_oxigraph__help__load_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help load commands' commands "$@"
}
(( $+functions[_oxigraph__help__optimize_commands] )) ||
_oxigraph__help__optimize_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help optimize commands' commands "$@"
}
(( $+functions[_oxigraph__help__query_commands] )) ||
_oxigraph__help__query_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help query commands' commands "$@"
}
(( $+functions[_oxigraph__help__serve_commands] )) ||
_oxigraph__help__serve_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help serve commands' commands "$@"
}
(( $+functions[_oxigraph__help__serve-read-only_commands] )) ||
_oxigraph__help__serve-read-only_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help serve-read-only commands' commands "$@"
}
(( $+functions[_oxigraph__help__update_commands] )) ||
_oxigraph__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph help update commands' commands "$@"
}
(( $+functions[_oxigraph__load_commands] )) ||
_oxigraph__load_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph load commands' commands "$@"
}
(( $+functions[_oxigraph__optimize_commands] )) ||
_oxigraph__optimize_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph optimize commands' commands "$@"
}
(( $+functions[_oxigraph__query_commands] )) ||
_oxigraph__query_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph query commands' commands "$@"
}
(( $+functions[_oxigraph__serve_commands] )) ||
_oxigraph__serve_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph serve commands' commands "$@"
}
(( $+functions[_oxigraph__serve-read-only_commands] )) ||
_oxigraph__serve-read-only_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph serve-read-only commands' commands "$@"
}
(( $+functions[_oxigraph__update_commands] )) ||
_oxigraph__update_commands() {
    local commands; commands=()
    _describe -t commands 'oxigraph update commands' commands "$@"
}

if [ "$funcstack[1]" = "_oxigraph" ]; then
    _oxigraph "$@"
else
    compdef _oxigraph oxigraph
fi
