@prefix code: <https://code.described.at/> .
@prefix p: <https://pipeline.described.at/> .
@prefix shacl: <https://barnard59.zazuko.com/operations/shacl/> .
@prefix base: <https://barnard59.zazuko.com/operations/base/> .
@prefix n3: <https://barnard59.zazuko.com/operations/formats/n3/> .
@prefix ntriples: <https://barnard59.zazuko.com/operations/formats/ntriples/> .
@prefix rdf: <https://barnard59.zazuko.com/operations/rdf/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

@base <http://barnard59.zazuko.com/pipeline/cube-validation/> .


_:profile a p:Variable ;
  p:name "profile" ;
  rdfs:label "cube constraint profile URL" ;
  p:value "https://cube.link/latest/shape/standalone-constraint-constraint" ;
.

_:profileFormat a p:Variable ;
  p:name "profileFormat" ;
  rdfs:label "Override the profile format" ;
  p:required false ;
.

<check-metadata> a p:Pipeline , p:Readable ;
  p:variables [ p:variable _:profile, _:profileFormat ] ;
  p:steps
    [
      p:stepList (
        [ base:stdin () ]
        [ n3:parse () ]
        [ rdf:getDataset () ]
        [ shacl:report (_:getProfile) ]
        [ base:flatten () ]
        [ ntriples:serialize () ]
      )
    ]
.

_:getProfile a p:Pipeline , p:ReadableObjectMode;
  p:steps
    [
      p:stepList
        (
          [ rdf:open ( "profile"^^p:VariableName "profileFormat"^^p:VariableName ) ]
          [ rdf:transformCodeImports () ]
        )
    ]
  .