Skip to content

Single instance data quality validation

What this is

Validate one instance at a time against structural and field-level SHACL constraints.

When to use it

Use this first when you need baseline quality controls such as:

  • required fields (sh:minCount)
  • datatype checks (sh:datatype)
  • range and pattern checks

This is the fastest path for initial onboarding and rule iteration. To choose between a local sample (run_validation()) and a full estate historic scan (enqueue_historic_validation()), see Confirm that rules work.

Industrial examples

  • A maintenance work order must include order, description, and type.
  • Completed work orders must include both actualStartTime and actualEndTime.
  • Equipment assets must include a valid serial number format and commissioning date.

Example (SHACL Core)

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix sp:  <http://purl.org/cognite/my_space/WorkOrder/> .

sp:WorkOrderShape
    a sh:NodeShape ;
    sh:targetClass sp:WorkOrder ;
    sh:property [
        sh:path sp:order ;
        sh:minCount 1 ;
        sh:datatype xsd:string ;
    ] ;
    sh:property [
        sh:path sp:description ;
        sh:minCount 1 ;
        sh:datatype xsd:string ;
    ] ;
    sh:property [
        sh:path sp:type ;
        sh:minCount 1 ;
        sh:datatype xsd:string ;
    ] .

Production path (DataProduct mode)

Most estates validate instances via historic orchestration then sync-cursor incremental validation — not one-shot trigger payloads. See Sync-cursor and historic orchestration.

Annotate rules with dq:dimension so records include quality dimensions — see Data quality dimensions in SHACL rules.

Previous section

Next section