rudof validate

The validate command is a wrapper on top of shex-validate and shacl-validate (and, for property graphs, pgschema-validate). It takes the same parameters as those commands, plus --mode to pick which one to run.

--schema is optional: if you already loaded a schema in the same session (for example inside rudof shell), a bare rudof validate reuses it. See the RDF backend (--backend) reference for --backend/--endpoint, and recursive shapes for --recursion-semantics.

Tip: Changing the shapemap in the input

A typical scenario validating RDF with ShEx is to use the same ShEx schema and the same RDF data but trying different shapemaps. Providing those different shapemap attempts in a file can be boring. One possibility is to use the ‘-’ for the shapemap and rudof will expect that the shapemap comes from the stdin.

For example:

rudof validate -s examples/simple.shex examples/simple.ttl -m -

will expect that the shapemap comes from stdin. Once it is typed followed by CTRL-D, the system will ouput the result of the validation.

Options

$ rudof validate --help
Validate RDF data using ShEx or SHACL

Usage: rudof validate [OPTIONS] [DATA]...

Arguments:
  [DATA]...


Options:
  -M, --mode <MODE>
          Validation mode (ShEx or SHACL)

          [default: shex]
          [possible values: shex, shacl, pgschema]

  -s, --schema <INPUT>
          Schema used for validatio, FILE, URI or - for stdin

  -f, --schema-format <FORMAT>
          Schema format

          [default: shexc]
          [possible values: internal, simple, shexc, shexj, json, jsonld, turtle, ntriples, rdfxml, trig, n3, nquads, plantuml, svg, png, binary]

  -m, --shapemap <INPUT>
          ShapeMap used for validation, FILE, URI or - for stdin

      --shapemap-format <FORMAT>
          ShapeMap format

          [default: compact]
          [possible values: compact, internal, json, details, csv]

      --base-data <IRI>
          Base IRI for data

      --base-schema <IRI>
          Base IRI for Schema

      --sort_by <SORT_MODE>
          Sort result by (default = node)

          [default: node]
          [possible values: node, details]

  -n, --node <NODE>
          Node to validate

  -l, --shape-label <LABEL>
          shape label (default = START)

  -t, --data-format <FORMAT>
          RDF Data format (default = turtle)

          [default: turtle]
          [possible values: turtle, ntriples, rdfxml, trig, n3, nquads, jsonld, pg, html]

      --max-steps <NUMBER>
          max steps to run during validation

          [default: 1000]

  -S, --shacl-mode <MODE>
          SHACL validation mode (default = native)

          [default: native]
          [possible values: native, sparql]

      --reader-mode <MODE>
          RDF Reader mode

          [default: strict]
          [possible values: lax, strict]

  -r, --result-format <FORMAT>
          Output result format, default = compact

          [default: compact]
          [possible values: turtle, ntriples, rdfxml, trig, n3, nquads, compact, details, json, csv]

      --details-layout <LAYOUT>
          In ShEx mode, where the details result format writes the details of each result: 'below' (default) writes a summary in each row and the details below the table, 'table' writes all the details in the table

          [default: below]
          [possible values: below, table]

      --map-state <FILE>
          MapState file name

      --show-intermediate-results
          Print each (node, shape) result as soon as it's computed, instead of only the final report

      --statistics
          Show the number of triples that the validation reads and the number of distinct triples. and the number of valid and invalid triples

      --visited <FILE>
          Write all the triples that the validation reads to FILE

      --visited-format <FORMAT>
          RDF format of the --visited file

          [default: turtle]
          [possible values: turtle, ntriples, rdfxml, trig, n3, nquads, jsonld, pg, html]

      --valid <FILE>
          Write the valid subgraph to FILE: the triples that the conformant node/shape pairs match

      --valid-format <FORMAT>
          RDF format of the --valid file

          [default: turtle]
          [possible values: turtle, ntriples, rdfxml, trig, n3, nquads, jsonld, pg, html]

      --invalid <FILE>
          Write the invalid subgraph to FILE: the triples that the validation reads and that are not valid

      --invalid-format <FORMAT>
          RDF format of the --invalid file

          [default: turtle]
          [possible values: turtle, ntriples, rdfxml, trig, n3, nquads, jsonld, pg, html]

      --no-errors
          SHACL only: don't retain violations in the validation report (default: violations are kept)

      --with-evidences
          SHACL only: also retain evidence for why (node, shape) pairs conform (default: not kept)

      --evidences-shapes-only
          SHACL only, with --with-evidences: keep only the per-shape summary evidence, dropping the finer per-constraint-component evidence (default: keep everything)

      --recursion-semantics <MODE>
          SHACL only: whether to accept a shapes graph with a recursive (cyclic) shape reference, and how to resolve it: `lfp` (least fixed point, default) accepts it and assumes a node caught in the cycle does NOT conform unless proven otherwise; `gfp` (greatest fixed point) accepts it and assumes such a node DOES conform as long as that's self-consistent; `none` rejects it outright

          [possible values: none, lfp, gfp]

  -c, --config-file <FILE>
          Config file name

  -o, --output-file <FILE>
          Output file name, default = terminal

      --force-overwrite
          Force overwrite to output file if it already exists

      --backend <BACKEND>
          Choose which backend to load the input into.

          - `memory` (default): parse into an in-process oxrdf::Graph. - `qlever`: launch a local QLever Docker container and index the input on disk. Requires the binary to be built with the `qlever` feature. - `lbug`: the connected LadybugDB property graph database (see `rudof connect`). Accepted here but not yet functional: rudof can derive a property graph from RDF (`load`/`ddl`) but cannot yet read one back out as RDF triples. - `endpoint=<URL_OR_NAME>`: query an external SPARQL endpoint by URL or by the name of an endpoint registered in the TOML config. See also the `--endpoint` / `-e` shortcut.

  -e, --endpoint <URL_OR_NAME>
          Shortcut for `--backend endpoint=<URL_OR_NAME>`.

          Accepts either a full SPARQL endpoint URL or the name of an endpoint registered in the TOML config. Mutually exclusive with `--backend`.

      --min-request-interval <MS>
          Minimum milliseconds between two requests to the SPARQL endpoint (-e/--endpoint only); default: the endpoint's configured value, else 1100 for remote hosts and 0 for localhost

      --max-concurrent-requests <N>
          Maximum requests in flight at once to the SPARQL endpoint (-e/--endpoint only); default 1

      --max-nodes-per-query <N>
          Maximum nodes fetched per SPARQL query when prefetching a shapemap's nodes (-e/--endpoint only); 1 disables batching; default 20

      --qlever-index-dir <DIR>
          Directory for the QLever on-disk index, overriding `[rdf.qlever] index_dir` from the TOML config.

          Only meaningful with `--backend qlever`. Naming a directory explicitly is how you find out (and share) where an index lives: pass the same directory again — from this machine or another rudof session pointed at the same path (e.g. a shared/mounted volume) — and the idempotent build step is skipped, going straight to serving. When unset, rudof resolves a per-input fingerprinted path under the platform cache dir and logs it at startup.

      --html-extract <MODE>
          RDF to read from HTML data: microdata, rdfa, jsonld or any (default: the config, else any)

          [possible values: microdata, rdfa, jsonld, any]

  -h, --help
          Print help (see a summary with '-h')

See also

  • RDF backends: where the data is (memory, QLever or a SPARQL endpoint).