@prefix : <https://ontology.inferal.com/modules/scoped-statements/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

:QuadTargetShape
    a sh:NodeShape ;
    rdfs:label "quad target shape" ;
    rdfs:comment "Validates RDF quad target terms, requiring subject and predicate terms, exactly one object term form, and optional graph term." ;
    sh:targetClass :QuadTarget ;
    sh:property [
        sh:path :subjectTerm ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :predicateTerm ;
        sh:nodeKind sh:IRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:xone (
        [
            sh:property [
                sh:path :objectResourceTerm ;
                sh:nodeKind sh:BlankNodeOrIRI ;
                sh:minCount 1 ;
                sh:maxCount 1 ;
            ] ;
            sh:property [
                sh:path :objectLiteralValue ;
                sh:maxCount 0 ;
            ]
        ]
        [
            sh:property [
                sh:path :objectLiteralValue ;
                sh:minCount 1 ;
                sh:maxCount 1 ;
            ] ;
            sh:property [
                sh:path :objectResourceTerm ;
                sh:maxCount 0 ;
            ]
        ]
    ) ;
    sh:property [
        sh:path :graphTerm ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:maxCount 1 ;
    ] .

:QuadGroupShape
    a sh:NodeShape ;
    rdfs:label "quad group shape" ;
    rdfs:comment "Validates that quad groups contain at least one quad target." ;
    sh:targetClass :QuadGroup ;
    sh:property [
        sh:path :hasQuad ;
        sh:class :QuadTarget ;
        sh:minCount 1 ;
    ] .

:ScopedClaimShape
    a sh:NodeShape ;
    rdfs:label "scoped claim shape" ;
    rdfs:comment "Validates scoped claim target, scope, and claim value resources." ;
    sh:targetClass :ScopedClaim ;
    sh:property [
        sh:path :claimTarget ;
        sh:or (
            [ sh:class :ScopedTarget ]
            [ sh:class :QuadTarget ]
            [ sh:class :QuadGroup ]
        ) ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :scope ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path :claimValue ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] .
