@prefix jc:    <https://jouleclaw.transaction.science/vocab/v1#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix dc:    <http://purl.org/dc/terms/> .
@prefix prov:  <http://www.w3.org/ns/prov#> .

# ─────────────────────────────────────────────────────────────────────
# Ontology
# ─────────────────────────────────────────────────────────────────────

<https://jouleclaw.transaction.science/vocab/v1> a owl:Ontology ;
    dc:title       "JouleClaw vocabulary (v1)" ;
    dc:description "Stable IRIs for the JouleClaw open-standard data model — receipts (cascade + policy), workspace manifests, agent identity, tools, and the energy/sensitivity/decision enumerations the spec uses." ;
    dc:license     <https://creativecommons.org/licenses/by/4.0/> ;
    owl:versionInfo "1" .

# ─────────────────────────────────────────────────────────────────────
# Top-level classes
# ─────────────────────────────────────────────────────────────────────

jc:Receipt           a owl:Class ;
    rdfs:label "JouleClaw cascade receipt" ;
    rdfs:comment "One signed thermodynamic record per cascade walk; schema id \"1\". See SPEC.md §2." .

jc:PolicyReceipt     a owl:Class ;
    rdfs:label "JouleClaw policy receipt" ;
    rdfs:comment "One signed audit record per policy evaluation; schema id \"policy/1\". See SPEC.md §10." .

jc:WorkspaceManifest a owl:Class ;
    rdfs:label "JouleClaw workspace manifest" ;
    rdfs:comment "Content-addressed manifest of a persistent agent workspace; schema id \"workspace/1\". See SPEC.md §11." .

jc:WorkspaceEntry    a owl:Class ;
    rdfs:label "Workspace entry" ;
    rdfs:comment "One named entry inside a WorkspaceManifest — (path, content_hash, size, kind)." .

jc:AgentIdentity     a owl:Class ;
    rdfs:label "Agent identity" ;
    rdfs:comment "did:key-bound Ed25519 identity. See SPEC.md §8." ;
    rdfs:subClassOf prov:Agent .

jc:ToolTouch         a owl:Class ;
    rdfs:label "Tool touch" ;
    rdfs:comment "One tool invocation observed during a cascade walk." .

jc:ToolReceipt       a owl:Class ;
    rdfs:label "Tool receipt" ;
    rdfs:comment "HMAC-signed gateway attestation that a tool was invoked, observed by the gateway, not the model." .

jc:ClaimProvenance   a owl:Class ;
    rdfs:label "Claim provenance" ;
    rdfs:comment "Provenance of one retrieved claim that fed the cascade resolution." ;
    rdfs:subClassOf prov:Entity .

jc:Citation          a owl:Class ;
    rdfs:label "Citation" ;
    rdfs:comment "Span-level grounding linking an output byte range to a retrieval chunk." .

jc:TextSpan          a owl:Class ;
    rdfs:label "Text span" ;
    rdfs:comment "Half-open byte range [start, end) over an output text." .

jc:TokenAttribution  a owl:Class ;
    rdfs:label "Token attribution" ;
    rdfs:comment "Per-token attribution row produced by a TokenAttributor." .

jc:IntentVerdict     a owl:Class ;
    rdfs:label "Intent verdict" ;
    rdfs:comment "Query-intent classification verdict (six-variant taxonomy)." .

jc:Action            a owl:Class ;
    rdfs:label "Action" ;
    rdfs:comment "What a JouleClaw agent is about to do — filesystem, network, or process. See SPEC.md §9." .

jc:FsAction          a owl:Class ; rdfs:subClassOf jc:Action ;
    rdfs:label "Filesystem action" .
jc:NetAction         a owl:Class ; rdfs:subClassOf jc:Action ;
    rdfs:label "Network action" .
jc:ProcAction        a owl:Class ; rdfs:subClassOf jc:Action ;
    rdfs:label "Process action" .

jc:Decision          a owl:Class ;
    rdfs:label "Policy decision" ;
    rdfs:comment "Output of one policy evaluation — Allow or Deny." .

jc:Allow             a owl:Class ; rdfs:subClassOf jc:Decision ;
    rdfs:label "Allow decision" .
jc:Deny              a owl:Class ; rdfs:subClassOf jc:Decision ;
    rdfs:label "Deny decision" .

jc:AuditEvent        a owl:Class ;
    rdfs:label "Audit event" ;
    rdfs:comment "Append-only record of one policy evaluation; pairs with PolicyReceipt for off-engine shipping." ;
    rdfs:subClassOf prov:Activity .

# ─────────────────────────────────────────────────────────────────────
# Cascade tier vocabulary (L0–L4)
# ─────────────────────────────────────────────────────────────────────

jc:Cascade           a owl:Class ;
    rdfs:label "Cascade tier" ;
    rdfs:comment "One of the five energy-class tiers a cascade walk can close at." .

jc:Cache   a jc:Cascade ; rdfs:label "L0 Cache"   ; jc:wireTag "L0" .
jc:Lawful  a jc:Cascade ; rdfs:label "L1 Lawful"  ; jc:wireTag "L1" .
jc:Embed   a jc:Cascade ; rdfs:label "L2 Embed"   ; jc:wireTag "L2" .
jc:Model   a jc:Cascade ; rdfs:label "L3 Model"   ; jc:wireTag "L3" .
jc:Wire    a jc:Cascade ; rdfs:label "L4 Wire"    ; jc:wireTag "L4" .

jc:wireTag a owl:DatatypeProperty ;
    rdfs:domain jc:Cascade ;
    rdfs:range xsd:string ;
    rdfs:label "Stable wire tag" .

# ─────────────────────────────────────────────────────────────────────
# Energy provenance (HwShunt > ModelBased > Estimator)
# ─────────────────────────────────────────────────────────────────────

jc:Provenance      a owl:Class ;
    rdfs:label "Energy provenance" ;
    rdfs:comment "Honesty tier of an energy counter — the breaker enforces at the worst counter seen across a span." .

jc:HwShunt    a jc:Provenance ; rdfs:label "Hardware shunt"      .
jc:ModelBased a jc:Provenance ; rdfs:label "Model-based estimate" .
jc:Estimator  a jc:Provenance ; rdfs:label "Estimator"           .

# ─────────────────────────────────────────────────────────────────────
# Filesystem / network / process enums
# ─────────────────────────────────────────────────────────────────────

jc:FsMode    a owl:Class ; rdfs:label "Filesystem access mode" .
jc:FsRead    a jc:FsMode ; rdfs:label "Read"    .
jc:FsWrite   a jc:FsMode ; rdfs:label "Write"   .
jc:FsExecute a jc:FsMode ; rdfs:label "Execute" .
jc:FsList    a jc:FsMode ; rdfs:label "List"    .

jc:NetMethod a owl:Class ; rdfs:label "Network method" .
jc:NetConnect a jc:NetMethod ; rdfs:label "Connect" .
jc:NetListen  a jc:NetMethod ; rdfs:label "Listen"  .
jc:NetResolve a jc:NetMethod ; rdfs:label "Resolve" .

# ─────────────────────────────────────────────────────────────────────
# Deny reasons
# ─────────────────────────────────────────────────────────────────────

jc:DenyReason      a owl:Class ;
    rdfs:label "Deny reason" ;
    rdfs:comment "Why a Deny decision was returned." .

jc:NoMatchingAllow a jc:DenyReason ; rdfs:label "No matching Allow (deny-by-default)" .
jc:ExplicitDeny    a jc:DenyReason ; rdfs:label "Explicit Deny rule"                  .

# ─────────────────────────────────────────────────────────────────────
# Workspace entry kinds
# ─────────────────────────────────────────────────────────────────────

jc:EntryKind  a owl:Class ; rdfs:label "Workspace entry kind" .
jc:Blob       a jc:EntryKind ; rdfs:label "Opaque bytes" .
jc:Text       a jc:EntryKind ; rdfs:label "UTF-8 text"   .
jc:Structured a jc:EntryKind ; rdfs:label "Structured artefact" .

# ─────────────────────────────────────────────────────────────────────
# Sensitivity levels
# ─────────────────────────────────────────────────────────────────────

jc:SensitivityLevel a owl:Class ;
    rdfs:label "Data sensitivity level" ;
    rdfs:comment "Four-level taxonomy used by the privacy-classifier route filter; numerically ordered." .

jc:Public       a jc:SensitivityLevel ; rdfs:label "Public"       .
jc:Internal     a jc:SensitivityLevel ; rdfs:label "Internal"     .
jc:Confidential a jc:SensitivityLevel ; rdfs:label "Confidential" .
jc:Restricted   a jc:SensitivityLevel ; rdfs:label "Restricted"   .

# ─────────────────────────────────────────────────────────────────────
# Properties — selection (full list in v1.jsonld)
# ─────────────────────────────────────────────────────────────────────

jc:schemaId          a owl:DatatypeProperty ; rdfs:range xsd:string  ; rdfs:label "Schema id" .
jc:receiptId         a owl:DatatypeProperty ; rdfs:range xsd:string  ; rdfs:label "Receipt id" .
jc:closedAt          a owl:DatatypeProperty ; rdfs:range xsd:dateTime ; rdfs:label "Closed at" .
jc:inputHash         a owl:DatatypeProperty ; rdfs:range xsd:string  ; rdfs:label "Input hash (BLAKE3 hex)" .
jc:contentHash       a owl:DatatypeProperty ; rdfs:range xsd:string  ; rdfs:label "Content hash (BLAKE3 hex)" .
jc:tier              a owl:ObjectProperty   ; rdfs:range jc:Cascade  ; rdfs:label "Closing tier" .
jc:joulesMicrojoules a owl:DatatypeProperty ; rdfs:range xsd:nonNegativeInteger ; rdfs:label "Joules (microjoules)" .
jc:energyProvenance  a owl:ObjectProperty   ; rdfs:range jc:Provenance ; rdfs:label "Energy provenance" .
jc:modelId           a owl:DatatypeProperty ; rdfs:range xsd:string  ; rdfs:label "Model identifier" .
jc:steward           a owl:ObjectProperty   ; rdfs:range jc:AgentIdentity ; rdfs:label "Steward" .
jc:agent             a owl:ObjectProperty   ; rdfs:range jc:AgentIdentity ; rdfs:label "Agent" .

jc:engineId          a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Engine id" .
jc:auditSequence     a owl:DatatypeProperty ; rdfs:range xsd:nonNegativeInteger ; rdfs:label "Audit sequence" .
jc:policyVersion     a owl:DatatypeProperty ; rdfs:range xsd:nonNegativeInteger ; rdfs:label "Policy version" .
jc:action            a owl:ObjectProperty   ; rdfs:range jc:Action     ; rdfs:label "Action" .
jc:decision          a owl:ObjectProperty   ; rdfs:range jc:Decision   ; rdfs:label "Decision" .
jc:rule              a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Rule name" .
jc:reason            a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Deny reason wire tag" .
jc:fsMode            a owl:ObjectProperty   ; rdfs:range jc:FsMode     ; rdfs:label "Filesystem mode" .
jc:netMethod         a owl:ObjectProperty   ; rdfs:range jc:NetMethod  ; rdfs:label "Network method" .
jc:host              a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Host" .
jc:port              a owl:DatatypeProperty ; rdfs:range xsd:nonNegativeInteger ; rdfs:label "Port" .
jc:path              a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Path" .
jc:binary            a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Binary path" .
jc:argv              a owl:DatatypeProperty ; rdfs:label "Argv (list of strings)" .

jc:owner             a owl:ObjectProperty   ; rdfs:range jc:AgentIdentity ; rdfs:label "Owner" .
jc:entries           a owl:ObjectProperty   ; rdfs:range jc:WorkspaceEntry ; rdfs:label "Entries" .
jc:handle            a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "did:key handle" .
jc:publicKey         a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Ed25519 public key (hex)" .
jc:size              a owl:DatatypeProperty ; rdfs:range xsd:nonNegativeInteger ; rdfs:label "Size (bytes)" .

jc:toolsTouched      a owl:ObjectProperty   ; rdfs:range jc:ToolTouch  ; rdfs:label "Tools touched" .
jc:claims            a owl:ObjectProperty   ; rdfs:range jc:ClaimProvenance ; rdfs:label "Claims" .
jc:citations         a owl:ObjectProperty   ; rdfs:range jc:Citation    ; rdfs:label "Citations" .
jc:toolReceipts      a owl:ObjectProperty   ; rdfs:range jc:ToolReceipt ; rdfs:label "Tool receipts" .
jc:tokenAttributions a owl:ObjectProperty   ; rdfs:range jc:TokenAttribution ; rdfs:label "Token attributions" .

jc:toolId            a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Tool id" .
jc:gatewayId         a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Gateway id" .
jc:hmacSha256Hex     a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "HMAC-SHA-256 (hex)" .
jc:source            a owl:ObjectProperty   ; rdfs:label "Source IRI" .
jc:trustTier         a owl:DatatypeProperty ; rdfs:range xsd:nonNegativeInteger ; rdfs:label "Trust tier" .

jc:intent            a owl:ObjectProperty   ; rdfs:range jc:IntentVerdict ; rdfs:label "Intent verdict" .
jc:classifierId      a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Classifier id" .
jc:confidence        a owl:DatatypeProperty ; rdfs:range xsd:double    ; rdfs:label "Confidence (0..1)" .
jc:label             a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "Label" .
jc:eocStage          a owl:DatatypeProperty ; rdfs:range xsd:string    ; rdfs:label "EOC stage" .

# ─── Validation Contract ─────────────────────────────────────────────

jc:ValidationContract  a owl:Class           ; rdfs:label "Validation contract" ;
                       rdfs:comment "Planning artifact a multi-step JouleClaw run is judged against. Authored before code, lives independently of the implementation." .
jc:Assertion           a owl:Class           ; rdfs:label "Assertion" ;
                       rdfs:comment "One falsifiable claim with a stable id, a priority, and an AssertionCheck." .
jc:AssertionCheck      a owl:Class           ; rdfs:label "Assertion check" ;
                       rdfs:comment "How an assertion is verified — Tool / Artifact / Command / Checker." .
jc:Feature             a owl:Class           ; rdfs:label "Feature" ;
                       rdfs:comment "One unit of work that claims one or more assertion ids." .
jc:ContractVerdict     a owl:Class           ; rdfs:label "Contract verdict" ;
                       rdfs:comment "Result of running the verifier — passed flag, coverage matrix, blocking-gap list." .

jc:Priority            a owl:Class           ; rdfs:label "Priority enum" .
jc:MustHave            a jc:Priority         ; rdfs:label "Must have" .
jc:ShouldHave          a jc:Priority         ; rdfs:label "Should have" .
jc:NiceToHave          a jc:Priority         ; rdfs:label "Nice to have" .

jc:CheckKind           a owl:Class           ; rdfs:label "Check kind enum" .
jc:ToolCheck           a jc:CheckKind        ; rdfs:label "Tool check" .
jc:ArtifactCheck       a jc:CheckKind        ; rdfs:label "Artifact check" .
jc:CommandCheck        a jc:CheckKind        ; rdfs:label "Command check" .
jc:CheckerCheck        a jc:CheckKind        ; rdfs:label "Delegated checker" .

jc:CellState           a owl:Class           ; rdfs:label "Coverage-cell state" .
jc:Verified            a jc:CellState        ; rdfs:label "Verified" .
jc:ClaimedUnverified   a jc:CellState        ; rdfs:label "Claimed, unverified" .
jc:Failed              a jc:CellState        ; rdfs:label "Failed" .
jc:Unclaimed           a jc:CellState        ; rdfs:label "Unclaimed" .
jc:Gap                 a jc:CellState        ; rdfs:label "Gap (no feature claims this assertion)" .

jc:authoredBy          a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Authored by (did:key handle)" .
jc:assertions          a owl:ObjectProperty   ; rdfs:range jc:Assertion ; rdfs:label "Assertions (ordered)" .
jc:features            a owl:ObjectProperty   ; rdfs:range jc:Feature ; rdfs:label "Features (ordered)" .
jc:acceptance          a owl:ObjectProperty   ; rdfs:label "Acceptance metadata" .
jc:blockOnShouldHave   a owl:DatatypeProperty ; rdfs:range xsd:boolean ; rdfs:label "Block ship on should-have gaps" .
jc:assertionId         a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Assertion stable id" .
jc:featureId           a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Feature stable id" .
jc:title               a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Title" .
jc:rationale           a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Rationale (free-form why)" .
jc:description         a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Description" .
jc:priority            a owl:ObjectProperty   ; rdfs:range jc:Priority ; rdfs:label "Priority" .
jc:check               a owl:ObjectProperty   ; rdfs:range jc:AssertionCheck ; rdfs:label "Check" .
jc:contractHash        a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Contract content hash (hex BLAKE3)" .
jc:passed              a owl:DatatypeProperty ; rdfs:range xsd:boolean ; rdfs:label "Passed (ship gate)" .
jc:summary             a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Human-readable summary" .
jc:coverage            a owl:ObjectProperty   ; rdfs:label "Coverage matrix" .
jc:blockingGaps        a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Blocking-gap assertion ids" .
jc:shouldHaveGaps      a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Should-have gap assertion ids" .

# ─── Worker Handoff ──────────────────────────────────────────────────

jc:WorkerHandoff       a owl:Class           ; rdfs:label "Worker handoff" ;
                       rdfs:comment "Structured record an agent emits at end of a unit of work: what got done, what was left undone, commands run, issues discovered, procedures followed." .
jc:HandoffCommand      a owl:Class           ; rdfs:label "Handoff command" ;
                       rdfs:comment "One command observed during the handoff window." .

jc:worker              a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Worker id" .
jc:completed           a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Completed items" .
jc:undone              a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Undone items" .
jc:issuesFound         a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Issues discovered" .
jc:proceduresFollowed  a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Procedures followed" .
jc:commands            a owl:ObjectProperty   ; rdfs:range jc:HandoffCommand ; rdfs:label "Commands" .
jc:commandHash         a owl:DatatypeProperty ; rdfs:range xsd:string ; rdfs:label "Command hash (hex BLAKE3)" .
jc:exitCode            a owl:DatatypeProperty ; rdfs:range xsd:integer ; rdfs:label "Exit code" .
