Ontology Version: 2.11.0

cacontology-synthesis-shapes:TextEvidencePointerHashShape leaf node


URI

https://cacontology.projectvic.org/synthesis/shapes#TextEvidencePointerHashShape

Label

Text Evidence Pointer Hash Shape

Shape Properties

Instances of cacontology-synthesis:TextEvidencePointer can have the following properties:

PROPERTY

MIN COUNT

MAX COUNT

TYPE

cacontology-synthesis:TextEvidencePointer
cacontology-synthesis:lineEnd 1 1 xsd:integer
cacontology-synthesis:lineStart 1 1 xsd:integer
cacontology-synthesis:pageEnd 1 1 xsd:integer
cacontology-synthesis:pageStart 1 1 xsd:integer
cacontology-synthesis:referencesArtifact 1 1 uco-observable:ObservableObject

Implementation

@prefix cacontology-synthesis: <https://cacontology.projectvic.org/synthesis#> .
@prefix cacontology-synthesis-shapes: <https://cacontology.projectvic.org/synthesis/shapes#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
cacontology-synthesis-shapes:TextEvidencePointerHashShape a sh:NodeShape ;
    rdfs:label "Text Evidence Pointer Hash Shape"@en ;
    sh:sparql [ sh:message "If exactQuote is present, include either (1) a UCO HashFacet, or (2) legacy quoteHashSha256 + hashScope."@en ;
            sh:select """
          SELECT $this
          WHERE {
            $this cacontology-synthesis:exactQuote ?q .
            FILTER NOT EXISTS {
              # Preferred: HashFacet path
              $this uco-core:hasFacet ?facet .
              ?facet a uco-observable:HashFacet ;
                     uco-observable:hash ?h .
            }
            FILTER NOT EXISTS {
              # Legacy: inline hash + scope
              $this cacontology-synthesis:quoteHashSha256 ?legacyHash ;
                    cacontology-synthesis:hashScope ?scope .
            }
          }
        """ ;
            sh:severity sh:Violation ],
        [ sh:message "When using HashFacet, hashMethod should indicate SHA-256 (common literal variants accepted)."@en ;
            sh:select """
          SELECT $this
          WHERE {
            $this cacontology-synthesis:exactQuote ?q ;
                  uco-core:hasFacet ?facet .
            ?facet a uco-observable:HashFacet ;
                   uco-observable:hash ?h .
            ?h a uco-types:Hash ;
               uco-types:hashMethod ?m .
            FILTER (
              isLiteral(?m) &&
              !(LCASE(STR(?m)) IN ("sha-256","sha256","sha 256"))
            )
          }
        """ ;
            sh:severity sh:Warning ] ;
    sh:targetClass cacontology-synthesis:TextEvidencePointer .