@prefix iso: <http://example.org/iso20022#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

# ============================================================
# ISO 20022 Payment Messages Ontology
# Version: 1.0.0
# Coverage: pain.001, pain.002, pacs.008, pacs.003, camt.053
# ============================================================

# ============================================================
# Core Message Types
# ============================================================

iso:PaymentMessage a owl:Class ;
    rdfs:label "Payment Message" ;
    rdfs:comment "Base class for all ISO 20022 payment messages" .

iso:CustomerCreditTransferInitiation a owl:Class ;
    rdfs:subClassOf iso:PaymentMessage ;
    rdfs:label "pain.001 - Customer Credit Transfer Initiation" ;
    rdfs:comment "Initiates a credit transfer on behalf of the initiating party" .

iso:PaymentStatusReport a owl:Class ;
    rdfs:subClassOf iso:PaymentMessage ;
    rdfs:label "pain.002 - Payment Status Report" ;
    rdfs:comment "Reports the status of a payment instruction" .

iso:FIToFICustomerCreditTransfer a owl:Class ;
    rdfs:subClassOf iso:PaymentMessage ;
    rdfs:label "pacs.008 - FI to FI Customer Credit Transfer" ;
    rdfs:comment "Settles a credit transfer between financial institutions" .

iso:FIToFICustomerDirectDebit a owl:Class ;
    rdfs:subClassOf iso:PaymentMessage ;
    rdfs:label "pacs.003 - FI to FI Customer Direct Debit" ;
    rdfs:comment "Settles a direct debit between financial institutions" .

iso:BankToCustomerStatement a owl:Class ;
    rdfs:subClassOf iso:PaymentMessage ;
    rdfs:label "camt.053 - Bank to Customer Statement" ;
    rdfs:comment "Provides account statement information to customers" .

# ============================================================
# Payment Instruction Components
# ============================================================

iso:PaymentInstruction a owl:Class ;
    rdfs:label "Payment Instruction" ;
    rdfs:comment "Container for payment details and transactions" .

iso:PaymentTransaction a owl:Class ;
    rdfs:label "Payment Transaction" ;
    rdfs:comment "Individual payment transaction within an instruction" .

iso:GroupHeader a owl:Class ;
    rdfs:label "Group Header" ;
    rdfs:comment "Message-level identification and control information" .

iso:PaymentInformation a owl:Class ;
    rdfs:label "Payment Information" ;
    rdfs:comment "Payment-level information shared across transactions" .

iso:CreditTransferTransactionInformation a owl:Class ;
    rdfs:subClassOf iso:PaymentTransaction ;
    rdfs:label "Credit Transfer Transaction Information" ;
    rdfs:comment "Detailed credit transfer transaction data" .

iso:DirectDebitTransactionInformation a owl:Class ;
    rdfs:subClassOf iso:PaymentTransaction ;
    rdfs:label "Direct Debit Transaction Information" ;
    rdfs:comment "Detailed direct debit transaction data" .

# ============================================================
# Party and Account Classes
# ============================================================

iso:Party a owl:Class ;
    rdfs:label "Party" ;
    rdfs:comment "Entity involved in payment (person or organization)" .

iso:Debtor a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Debtor" ;
    rdfs:comment "Party that owes an amount of money" .

iso:Creditor a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Creditor" ;
    rdfs:comment "Party to which an amount of money is due" .

iso:DebtorAgent a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Debtor Agent" ;
    rdfs:comment "Financial institution servicing the debtor's account" .

iso:CreditorAgent a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Creditor Agent" ;
    rdfs:comment "Financial institution servicing the creditor's account" .

iso:IntermediaryAgent a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Intermediary Agent" ;
    rdfs:comment "Financial institution between debtor and creditor agents" .

iso:InitiatingParty a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Initiating Party" ;
    rdfs:comment "Party that initiates the payment instruction" .

iso:UltimateDebtor a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Ultimate Debtor" ;
    rdfs:comment "Ultimate party that owes the payment" .

iso:UltimateCreditor a owl:Class ;
    rdfs:subClassOf iso:Party ;
    rdfs:label "Ultimate Creditor" ;
    rdfs:comment "Ultimate party to which payment is due" .

# ============================================================
# Account and Identification
# ============================================================

iso:Account a owl:Class ;
    rdfs:label "Account" ;
    rdfs:comment "Bank account involved in payment" .

iso:DebtorAccount a owl:Class ;
    rdfs:subClassOf iso:Account ;
    rdfs:label "Debtor Account" ;
    rdfs:comment "Account to be debited" .

iso:CreditorAccount a owl:Class ;
    rdfs:subClassOf iso:Account ;
    rdfs:label "Creditor Account" ;
    rdfs:comment "Account to be credited" .

iso:AccountIdentification a owl:Class ;
    rdfs:label "Account Identification" ;
    rdfs:comment "Unique identification of an account" .

iso:IBAN a owl:Class ;
    rdfs:subClassOf iso:AccountIdentification ;
    rdfs:label "IBAN" ;
    rdfs:comment "International Bank Account Number" .

iso:BBAN a owl:Class ;
    rdfs:subClassOf iso:AccountIdentification ;
    rdfs:label "BBAN" ;
    rdfs:comment "Basic Bank Account Number" .

# ============================================================
# Financial Institution Identification
# ============================================================

iso:FinancialInstitutionIdentification a owl:Class ;
    rdfs:label "Financial Institution Identification" ;
    rdfs:comment "Identification of a financial institution" .

iso:BIC a owl:Class ;
    rdfs:subClassOf iso:FinancialInstitutionIdentification ;
    rdfs:label "BIC" ;
    rdfs:comment "Business Identifier Code (SWIFT code)" .

iso:ClearingSystemMemberIdentification a owl:Class ;
    rdfs:subClassOf iso:FinancialInstitutionIdentification ;
    rdfs:label "Clearing System Member ID" ;
    rdfs:comment "Identification within a clearing system" .

# ============================================================
# Remittance Information
# ============================================================

iso:RemittanceInformation a owl:Class ;
    rdfs:label "Remittance Information" ;
    rdfs:comment "Information supplied to match payment with receivables" .

iso:UnstructuredRemittanceInformation a owl:Class ;
    rdfs:subClassOf iso:RemittanceInformation ;
    rdfs:label "Unstructured Remittance" ;
    rdfs:comment "Free-form remittance text" .

iso:StructuredRemittanceInformation a owl:Class ;
    rdfs:subClassOf iso:RemittanceInformation ;
    rdfs:label "Structured Remittance" ;
    rdfs:comment "Structured remittance information (e.g., invoice reference)" .

iso:CreditorReferenceInformation a owl:Class ;
    rdfs:label "Creditor Reference Information" ;
    rdfs:comment "Reference information supplied by creditor" .

# ============================================================
# Amount and Currency
# ============================================================

iso:Amount a owl:Class ;
    rdfs:label "Amount" ;
    rdfs:comment "Monetary amount" .

iso:InstructedAmount a owl:Class ;
    rdfs:subClassOf iso:Amount ;
    rdfs:label "Instructed Amount" ;
    rdfs:comment "Amount as instructed by the initiating party" .

iso:EquivalentAmount a owl:Class ;
    rdfs:subClassOf iso:Amount ;
    rdfs:label "Equivalent Amount" ;
    rdfs:comment "Amount in a different currency" .

iso:Currency a owl:Class ;
    rdfs:label "Currency" ;
    rdfs:comment "ISO 4217 currency code" .

# ============================================================
# Status and Reason Codes
# ============================================================

iso:TransactionStatus a owl:Class ;
    rdfs:label "Transaction Status" ;
    rdfs:comment "Status of a payment transaction" .

iso:StatusReason a owl:Class ;
    rdfs:label "Status Reason" ;
    rdfs:comment "Reason for the status" .

iso:RejectReasonCode a owl:Class ;
    rdfs:subClassOf iso:StatusReason ;
    rdfs:label "Reject Reason Code" ;
    rdfs:comment "Code explaining why a payment was rejected" .

iso:ReturnReasonCode a owl:Class ;
    rdfs:subClassOf iso:StatusReason ;
    rdfs:label "Return Reason Code" ;
    rdfs:comment "Code explaining why a payment was returned" .

# ============================================================
# SEPA-Specific Classes
# ============================================================

iso:SEPAPayment a owl:Class ;
    rdfs:label "SEPA Payment" ;
    rdfs:comment "Payment within Single Euro Payments Area" .

iso:SEPACreditTransfer a owl:Class ;
    rdfs:subClassOf iso:SEPAPayment ;
    rdfs:label "SEPA Credit Transfer" ;
    rdfs:comment "SEPA credit transfer payment" .

iso:SEPADirectDebit a owl:Class ;
    rdfs:subClassOf iso:SEPAPayment ;
    rdfs:label "SEPA Direct Debit" ;
    rdfs:comment "SEPA direct debit payment" .

iso:MandateRelatedInformation a owl:Class ;
    rdfs:label "Mandate Related Information" ;
    rdfs:comment "Direct debit mandate information" .

# ============================================================
# Object Properties
# ============================================================

iso:hasGroupHeader a owl:ObjectProperty ;
    rdfs:domain iso:PaymentMessage ;
    rdfs:range iso:GroupHeader ;
    rdfs:label "has group header" .

iso:hasPaymentInformation a owl:ObjectProperty ;
    rdfs:domain iso:PaymentMessage ;
    rdfs:range iso:PaymentInformation ;
    rdfs:label "has payment information" .

iso:hasTransaction a owl:ObjectProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range iso:PaymentTransaction ;
    rdfs:label "has transaction" .

iso:hasDebtor a owl:ObjectProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range iso:Debtor ;
    rdfs:label "has debtor" .

iso:hasCreditor a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:Creditor ;
    rdfs:label "has creditor" .

iso:hasDebtorAgent a owl:ObjectProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range iso:DebtorAgent ;
    rdfs:label "has debtor agent" .

iso:hasCreditorAgent a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:CreditorAgent ;
    rdfs:label "has creditor agent" .

iso:hasIntermediaryAgent a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:IntermediaryAgent ;
    rdfs:label "has intermediary agent" .

iso:hasDebtorAccount a owl:ObjectProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range iso:DebtorAccount ;
    rdfs:label "has debtor account" .

iso:hasCreditorAccount a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:CreditorAccount ;
    rdfs:label "has creditor account" .

iso:hasAccountIdentification a owl:ObjectProperty ;
    rdfs:domain iso:Account ;
    rdfs:range iso:AccountIdentification ;
    rdfs:label "has account identification" .

iso:hasFinancialInstitutionIdentification a owl:ObjectProperty ;
    rdfs:domain iso:Party ;
    rdfs:range iso:FinancialInstitutionIdentification ;
    rdfs:label "has financial institution identification" .

iso:hasRemittanceInformation a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:RemittanceInformation ;
    rdfs:label "has remittance information" .

iso:hasInstructedAmount a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:InstructedAmount ;
    rdfs:label "has instructed amount" .

iso:hasCurrency a owl:ObjectProperty ;
    rdfs:domain iso:Amount ;
    rdfs:range iso:Currency ;
    rdfs:label "has currency" .

iso:hasStatus a owl:ObjectProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range iso:TransactionStatus ;
    rdfs:label "has status" .

iso:hasStatusReason a owl:ObjectProperty ;
    rdfs:domain iso:TransactionStatus ;
    rdfs:range iso:StatusReason ;
    rdfs:label "has status reason" .

# ============================================================
# Data Properties
# ============================================================

iso:messageIdentification a owl:DatatypeProperty ;
    rdfs:domain iso:GroupHeader ;
    rdfs:range xsd:string ;
    rdfs:label "message identification" ;
    rdfs:comment "Unique message identifier" .

iso:creationDateTime a owl:DatatypeProperty ;
    rdfs:domain iso:GroupHeader ;
    rdfs:range xsd:dateTime ;
    rdfs:label "creation date time" .

iso:numberOfTransactions a owl:DatatypeProperty ;
    rdfs:domain iso:GroupHeader ;
    rdfs:range xsd:integer ;
    rdfs:label "number of transactions" .

iso:controlSum a owl:DatatypeProperty ;
    rdfs:domain iso:GroupHeader ;
    rdfs:range xsd:decimal ;
    rdfs:label "control sum" ;
    rdfs:comment "Total of all individual amounts in the message" .

iso:paymentInformationIdentification a owl:DatatypeProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range xsd:string ;
    rdfs:label "payment information identification" .

iso:paymentMethod a owl:DatatypeProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range xsd:string ;
    rdfs:label "payment method" ;
    rdfs:comment "TRF (transfer) or DD (direct debit)" .

iso:requestedExecutionDate a owl:DatatypeProperty ;
    rdfs:domain iso:PaymentInformation ;
    rdfs:range xsd:date ;
    rdfs:label "requested execution date" .

iso:endToEndIdentification a owl:DatatypeProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range xsd:string ;
    rdfs:label "end to end identification" ;
    rdfs:comment "Unique reference assigned by initiating party" .

iso:transactionIdentification a owl:DatatypeProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range xsd:string ;
    rdfs:label "transaction identification" .

iso:instructionIdentification a owl:DatatypeProperty ;
    rdfs:domain iso:PaymentTransaction ;
    rdfs:range xsd:string ;
    rdfs:label "instruction identification" .

iso:amountValue a owl:DatatypeProperty ;
    rdfs:domain iso:Amount ;
    rdfs:range xsd:decimal ;
    rdfs:label "amount value" .

iso:currencyCode a owl:DatatypeProperty ;
    rdfs:domain iso:Currency ;
    rdfs:range xsd:string ;
    rdfs:label "currency code" ;
    rdfs:comment "ISO 4217 three-letter currency code" .

iso:iban a owl:DatatypeProperty ;
    rdfs:domain iso:IBAN ;
    rdfs:range xsd:string ;
    rdfs:label "IBAN" ;
    rdfs:comment "International Bank Account Number" .

iso:bban a owl:DatatypeProperty ;
    rdfs:domain iso:BBAN ;
    rdfs:range xsd:string ;
    rdfs:label "BBAN" .

iso:bic a owl:DatatypeProperty ;
    rdfs:domain iso:BIC ;
    rdfs:range xsd:string ;
    rdfs:label "BIC" ;
    rdfs:comment "Business Identifier Code (8 or 11 characters)" .

iso:partyName a owl:DatatypeProperty ;
    rdfs:domain iso:Party ;
    rdfs:range xsd:string ;
    rdfs:label "party name" .

iso:addressLine a owl:DatatypeProperty ;
    rdfs:domain iso:Party ;
    rdfs:range xsd:string ;
    rdfs:label "address line" .

iso:countryCode a owl:DatatypeProperty ;
    rdfs:domain iso:Party ;
    rdfs:range xsd:string ;
    rdfs:label "country code" ;
    rdfs:comment "ISO 3166-1 alpha-2 country code" .

iso:unstructuredRemittance a owl:DatatypeProperty ;
    rdfs:domain iso:UnstructuredRemittanceInformation ;
    rdfs:range xsd:string ;
    rdfs:label "unstructured remittance" ;
    rdfs:comment "Free-form remittance text (max 140 chars)" .

iso:creditorReference a owl:DatatypeProperty ;
    rdfs:domain iso:CreditorReferenceInformation ;
    rdfs:range xsd:string ;
    rdfs:label "creditor reference" .

iso:statusCode a owl:DatatypeProperty ;
    rdfs:domain iso:TransactionStatus ;
    rdfs:range xsd:string ;
    rdfs:label "status code" ;
    rdfs:comment "ACCP, ACSC, ACTC, ACWC, RJCT, PDNG, etc." .

iso:reasonCode a owl:DatatypeProperty ;
    rdfs:domain iso:StatusReason ;
    rdfs:range xsd:string ;
    rdfs:label "reason code" .

iso:additionalInformation a owl:DatatypeProperty ;
    rdfs:domain iso:StatusReason ;
    rdfs:range xsd:string ;
    rdfs:label "additional information" .

iso:mandateIdentification a owl:DatatypeProperty ;
    rdfs:domain iso:MandateRelatedInformation ;
    rdfs:range xsd:string ;
    rdfs:label "mandate identification" .

iso:dateOfSignature a owl:DatatypeProperty ;
    rdfs:domain iso:MandateRelatedInformation ;
    rdfs:range xsd:date ;
    rdfs:label "date of signature" .
