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

ev:ClaimShape
    a sh:NodeShape ;
    rdfs:label "claim shape"@en ;
    rdfs:comment "Validates that claims are RDF resources while leaving their content representation to domain or statement-target vocabularies."@en ;
    sh:targetClass ev:Claim ;
    sh:nodeKind sh:BlankNodeOrIRI .

ev:ReasoningBasisShape
    a sh:NodeShape ;
    rdfs:label "reasoning basis shape"@en ;
    rdfs:comment "Validates that reusable reasoning bases are RDF resources while leaving their formalism and content open."@en ;
    sh:targetClass ev:ReasoningBasis ;
    sh:nodeKind sh:BlankNodeOrIRI .

ev:ArgumentShape
    a sh:NodeShape ;
    rdfs:label "argument shape"@en ;
    rdfs:comment "Requires an argument to have exactly one conclusion and at least one premise or evidentiary artifact, while validating the contextual roles of its components."@en ;
    sh:targetClass ev:Argument ;
    sh:nodeKind sh:BlankNodeOrIRI ;
    sh:property [
        sh:path ev:hasEvidence ;
        sh:class prov:Entity ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:property [
        sh:path ev:hasPremise ;
        sh:class ev:Claim ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:property [
        sh:path ev:hasConclusion ;
        sh:class ev:Claim ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] ;
    sh:property [
        sh:path ev:hasWarrant ;
        sh:class ev:ReasoningBasis ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:sparql [
        sh:message "An argument must identify at least one premise or evidentiary artifact."@en ;
        sh:select """
            PREFIX ev: <https://ontology.inferal.com/modules/evidence/>
            SELECT $this WHERE {
                FILTER NOT EXISTS {
                    $this (ev:hasEvidence|ev:hasPremise) ?input .
                }
            }
        """ ;
    ] .

ev:SupportArgumentShape
    a sh:NodeShape ;
    rdfs:label "support argument shape"@en ;
    rdfs:comment "Validates support arguments through the common argument contract without treating their conclusions as entailed."@en ;
    sh:targetClass ev:SupportArgument ;
    sh:nodeKind sh:BlankNodeOrIRI .

ev:DefeatingArgumentShape
    a sh:NodeShape ;
    rdfs:label "defeating argument shape"@en ;
    rdfs:comment "Requires a defeating argument to identify at least one challenged entity and validates typed rebuttal, undercutting, and undermining targets."@en ;
    sh:targetClass ev:DefeatingArgument ;
    sh:nodeKind sh:BlankNodeOrIRI ;
    sh:property [
        sh:path [
            sh:alternativePath (
                ev:challenges
                ev:rebuts
                ev:undercuts
                ev:undermines
            )
        ] ;
        sh:nodeKind sh:BlankNodeOrIRI ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path ev:challenges ;
        sh:class prov:Entity ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:property [
        sh:path ev:rebuts ;
        sh:class ev:Claim ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:property [
        sh:path ev:undercuts ;
        sh:class ev:Argument ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:property [
        sh:path ev:undermines ;
        sh:class prov:Entity ;
        sh:nodeKind sh:BlankNodeOrIRI ;
    ] ;
    sh:sparql [
        sh:message "A defeating argument must not challenge itself."@en ;
        sh:select """
            PREFIX ev: <https://ontology.inferal.com/modules/evidence/>
            SELECT $this WHERE {
                $this (ev:challenges|ev:rebuts|ev:undercuts|ev:undermines) $this .
            }
        """ ;
    ] .
