# Every CLI command documented at https://barnard59.zazuko.com/commands,
# together with the pipeline each one runs.

@prefix b59: <https://barnard59.zazuko.com/vocab#>.
@prefix code: <https://code.described.at/>.
@prefix p: <https://pipeline.described.at/>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.

<http://barnard59.zazuko.com/pipeline/cube-validation/check-metadata> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (_:b1 _:b2 _:b3 _:b4 _:b5 _:b6)
    ];
  p:variables [
      p:variable [ a p:Variable;
          rdfs:label "cube constraint profile URL";
          p:name "profile";
          p:value "https://cube.link/latest/shape/standalone-constraint-constraint"
        ], [ a p:Variable;
          rdfs:label "Override the profile format";
          p:name "profileFormat";
          p:required false
        ]
    ].

<http://barnard59.zazuko.com/pipeline/cube-validation/check-observations> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (_:b7 _:b8 _:b9 _:b10 _:b11 _:b12 _:b13 _:b14 _:b15)
    ];
  p:variables [
      p:variable
        _:b16, [ a p:Variable;
          rdfs:label "batch size";
          p:name "batchSize";
          p:value 50
        ], [ a p:Variable;
          rdfs:label "max number of violations";
          p:name "maxViolations";
          p:value 500
        ], [ a p:Variable;
          rdfs:label "sort chunk size";
          p:name "sortChunkSize";
          p:value 100000
        ]
    ].

<http://barnard59.zazuko.com/pipeline/cube-validation/fetch-constraint> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (<http://barnard59.zazuko.com/pipeline/cube-validation/queryConstraint> _:b17)
    ];
  p:variables [
      p:variable [ a p:Variable;
          rdfs:label "SPARQL endpoint";
          p:name "endpoint"
        ], [ a p:Variable;
          rdfs:label "cube URI";
          p:name "cube"
        ]
    ].

<http://barnard59.zazuko.com/pipeline/cube-validation/fetch-cube> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (_:b18 _:b19)
    ];
  p:variables [
      p:variable [ a p:Variable;
          rdfs:label "SPARQL endpoint";
          p:name "endpoint"
        ], [ a p:Variable;
          rdfs:label "cube URI";
          p:name "cube"
        ]
    ].

<http://barnard59.zazuko.com/pipeline/cube-validation/fetch-metadata> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (_:b20 _:b21)
    ];
  p:variables [
      p:variable [ a p:Variable;
          rdfs:label "SPARQL endpoint";
          p:name "endpoint"
        ], [ a p:Variable;
          rdfs:label "cube URI";
          p:name "cube"
        ]
    ].

<http://barnard59.zazuko.com/pipeline/cube-validation/fetch-observations> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (<http://barnard59.zazuko.com/pipeline/cube-validation/queryObservations> _:b22)
    ];
  p:variables [
      p:variable [ a p:Variable;
          rdfs:label "SPARQL endpoint";
          p:name "endpoint"
        ], [ a p:Variable;
          rdfs:label "cube URI";
          p:name "cube"
        ]
    ].

<https://barnard59.zazuko.com/command/cube/check-metadata> a b59:CliCommand;
  rdfs:label "Validate input cube and its constraint against profile shapes";
  b59:command "check-metadata";
  b59:source "barnard59-cube/pipeline/check-metadata.ttl".

<https://barnard59.zazuko.com/command/cube/check-observations> a b59:CliCommand;
  rdfs:label "Validate input observations against cube constraint";
  b59:command "check-observations";
  b59:source "barnard59-cube/pipeline/check-observations.ttl".

<https://barnard59.zazuko.com/command/cube/fetch-constraint> a b59:CliCommand;
  rdfs:label "Retrieves cube constraint from SPARQL endpoint";
  b59:command "fetch-constraint";
  b59:source "barnard59-cube/pipeline/fetch-constraint.ttl".

<https://barnard59.zazuko.com/command/cube/fetch-cube> a b59:CliCommand;
  rdfs:label "Retrieves cube with observations from SPARQL endpoint";
  b59:command "fetch-cube";
  b59:source "barnard59-cube/pipeline/fetch-cube.ttl".

<https://barnard59.zazuko.com/command/cube/fetch-metadata> a b59:CliCommand;
  rdfs:label "Retrieves cube and its constraint shape from SPARQL endpoint";
  b59:command "fetch-metadata";
  b59:source "barnard59-cube/pipeline/fetch-metadata.ttl".

<https://barnard59.zazuko.com/command/cube/fetch-observations> a b59:CliCommand;
  rdfs:label "Retrieves cube observations from SPARQL endpoint";
  b59:command "fetch-observations";
  b59:source "barnard59-cube/pipeline/fetch-observations.ttl".

<https://barnard59.zazuko.com/command/graph-store/put> a b59:CliCommand;
  rdfs:label "Upload RDF documents using SPARQL Graph Store Protocol";
  b59:command "put";
  b59:source "barnard59-graph-store/pipeline/put.ttl".

<https://barnard59.zazuko.com/operations/n3/command/applyRules> a b59:CliCommand;
  rdfs:label "Applies N3 rules to datasets in barnard59 pipelines";
  b59:command "apply";
  b59:pipeline <https://barnard59.zazuko.com/pipeline/n3/apply>;
  b59:source "barnard59-n3/pipeline/applyRules.ttl".

<https://barnard59.zazuko.com/operations/shacl/command/report-summary> a b59:CliCommand;
  rdfs:label "Human-readable summary of SHACL validation report";
  b59:command "report-summary";
  b59:source "barnard59-shacl/pipeline/report-summary.ttl".

<https://barnard59.zazuko.com/operations/shacl/command/validate> a b59:CliCommand;
  rdfs:label "Validates the RDF in standard input against a SHACL document";
  b59:command "validate";
  b59:pipeline <https://barnard59.zazuko.com/pipeline/shacl/validate>;
  b59:source "barnard59-shacl/pipeline/validate.ttl".

<https://barnard59.zazuko.com/pipeline/graph-store/put> a p:Pipeline;
  p:steps [
      p:stepList (_:b23 _:b24 _:b25)
    ];
  p:variables [
      p:variable [ a p:Variable;
          rdfs:label "Glob of RDF documents to upload";
          p:name "source"
        ], [ a p:Variable;
          p:name "graph";
          p:required false
        ], [ a p:Variable;
          p:name "endpoint"
        ], [ a p:Variable;
          p:name "user";
          p:required false
        ], [ a p:Variable;
          p:name "password";
          p:required false
        ]
    ].

<https://barnard59.zazuko.com/pipeline/shacl/_getShapes> a p:Pipeline, p:ReadableObjectMode;
  p:steps [
      p:stepList (_:b26 _:b27)
    ];
  p:variables _:b28.

<https://barnard59.zazuko.com/pipeline/shacl/_validate> a p:Pipeline, p:Readable, p:Writable;
  p:steps [
      p:stepList (_:b29 _:b30 _:b31 _:b32 _:b33)
    ].

<https://barnard59.zazuko.com/pipeline/shacl/report-summary> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (_:b34 _:b35 _:b36 _:b37 _:b38)
    ].

<https://barnard59.zazuko.com/pipeline/shacl/validate> a p:Pipeline, p:Readable;
  p:steps [
      p:stepList (_:b39 <https://barnard59.zazuko.com/pipeline/shacl/_validate>)
    ];
  p:variables _:b28.

_:b4
  <https://barnard59.zazuko.com/operations/shacl/report> (_:b40).

_:b40 a p:Pipeline, p:ReadableObjectMode;
  p:steps [
      p:stepList (_:b41 _:b42)
    ].

_:b5
  <https://barnard59.zazuko.com/operations/base/flatten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b6
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b41
  <https://barnard59.zazuko.com/operations/rdf/open> ("profile"^^p:VariableName "profileFormat"^^p:VariableName).

_:b42
  <https://barnard59.zazuko.com/operations/rdf/transformCodeImports> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b1
  <https://barnard59.zazuko.com/operations/base/stdin> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b2
  <https://barnard59.zazuko.com/operations/formats/n3/parse> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b3
  <https://barnard59.zazuko.com/operations/rdf/getDataset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b16 a p:Variable;
  rdfs:label "cube constraint file";
  p:name "constraint".

_:b9 a p:Step;
  code:arguments ("sortChunkSize"^^p:VariableName);
  code:implementedBy [ a code:EcmaScriptModule;
      code:link <file:../lib/sort.js#sortBySubject>
    ].

_:b10
  <https://barnard59.zazuko.com/operations/rdf/splitDataset/bySubject> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b11
  <https://barnard59.zazuko.com/operations/base/batch> ("batchSize"^^p:VariableName).

_:b12
  <https://barnard59.zazuko.com/operations/base/map> (_:b43).

_:b13
  <https://barnard59.zazuko.com/operations/shacl/report> [
      code:name "shape";
      code:value [ a p:Pipeline, p:ReadableObjectMode;
          p:steps [
              p:stepList (_:b44 _:b45 _:b46 _:b47)
            ];
          p:variables [
              p:variable _:b16
            ]
        ]
    ], [
      code:name "maxErrors";
      code:value "maxViolations"^^p:VariableName
    ].

_:b14
  <https://barnard59.zazuko.com/operations/base/flatten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b15
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b44 a p:Step;
  code:arguments ("constraint"^^p:VariableName);
  code:implementedBy "\n  function (path) {\n    return this.env.fromFile(path)\n  }\n  "^^code:EcmaScript.

_:b45
  <https://barnard59.zazuko.com/operations/rdf/getDataset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b46
  <https://barnard59.zazuko.com/operations/base/map> (_:b48).

_:b47
  <https://barnard59.zazuko.com/operations/base/flatten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b43 a code:EcmaScriptModule;
  code:link <file:../lib/merge.js#default>.

_:b48 a code:EcmaScriptModule;
  code:link <file:../lib/target.js#addTarget>.

_:b7
  <https://barnard59.zazuko.com/operations/base/stdin> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b8
  <https://barnard59.zazuko.com/operations/formats/n3/parse> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-constraint>
].

_:b17
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-cube>
].

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-observation-sets>
].

_:b19
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-observations>
].

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-constraint>
].

_:b18
  <https://barnard59.zazuko.com/operations/base/concat/object> (<http://barnard59.zazuko.com/pipeline/cube-validation/queryCube> <http://barnard59.zazuko.com/pipeline/cube-validation/queryConstraint> <http://barnard59.zazuko.com/pipeline/cube-validation/queryObservationSet> <http://barnard59.zazuko.com/pipeline/cube-validation/queryObservations>).

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-cube>
].

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-constraint>
].

_:b21
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-observation-sample>
].

_:b20
  <https://barnard59.zazuko.com/operations/base/concat/object> (<http://barnard59.zazuko.com/pipeline/cube-validation/queryCube> <http://barnard59.zazuko.com/pipeline/cube-validation/queryConstraint> <http://barnard59.zazuko.com/pipeline/cube-validation/queryObservationSample>).

[
  code:extension "ttl";
  code:imports <https://unpkg.com/barnard59-cube/pipeline/query-observations>
].

_:b22
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b24
  <https://barnard59.zazuko.com/operations/rdf/fs.js#parse> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b25
  <https://barnard59.zazuko.com/operations/graph-store/put> [
      code:name "graph";
      code:value "graph"^^p:VariableName
    ], [
      code:name "endpoint";
      code:value "endpoint"^^p:VariableName
    ], [
      code:name "user";
      code:value "user"^^p:VariableName
    ], [
      code:name "password";
      code:value "password"^^p:VariableName
    ].

_:b23
  <https://barnard59.zazuko.com/operations/base/glob> [
      code:name "pattern";
      code:value "source"^^p:VariableName
    ].

_:b38
  <https://barnard59.zazuko.com/operations/base/flatten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b34
  <https://barnard59.zazuko.com/operations/base/stdin> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b35
  <https://barnard59.zazuko.com/operations/formats/n3/parse> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b36
  <https://barnard59.zazuko.com/operations/rdf/getDataset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b37 a p:Step;
  code:implementedBy [ a code:EcmaScriptModule;
      code:link <file:../lib/report.js#getSummary>
    ].

_:b28
  p:variable [ a p:Variable;
      rdfs:label "URL or path of the shapes graph";
      p:name "shapes";
      p:required false
    ], [ a p:Variable;
      rdfs:label "Override the shapes graph format";
      p:name "shapesMediaType";
      p:required false
    ].

_:b30
  <https://barnard59.zazuko.com/operations/rdf/getDataset> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b31 a p:Step;
  code:implementedBy [ a code:EcmaScriptModule;
      code:link <file:validate.js#default>
    ].

_:b32
  <https://barnard59.zazuko.com/operations/base/flatten> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b33
  <https://barnard59.zazuko.com/operations/formats/ntriples/serialize> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b26
  <https://barnard59.zazuko.com/operations/rdf/open> ("shapes"^^p:VariableName "shapesMediaType"^^p:VariableName).

_:b27
  <https://barnard59.zazuko.com/operations/rdf/transformCodeImports> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b39
  <https://barnard59.zazuko.com/operations/base/stdin> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.

_:b29
  <https://barnard59.zazuko.com/operations/formats/n3/parse> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>.
