@prefix risk: <http://ggen.dev/ontology/risk-management#> .
@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#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .

# Ontology Metadata
risk:RiskManagementOntology a owl:Ontology ;
    dc:title "Risk Management Ontology" ;
    dc:description "Comprehensive ontology for financial risk management systems" ;
    dc:creator "ggen Marketplace" ;
    dc:date "2025-11-08" ;
    owl:versionInfo "1.0.0" .

# ==================== Core Classes ====================

risk:Portfolio a owl:Class ;
    rdfs:label "Portfolio" ;
    rdfs:comment "Investment portfolio subject to risk analysis" .

risk:Position a owl:Class ;
    rdfs:label "Position" ;
    rdfs:comment "Individual position within a portfolio" .

risk:RiskFactor a owl:Class ;
    rdfs:label "Risk Factor" ;
    rdfs:comment "Factor contributing to portfolio risk" .

risk:MarketRiskFactor a owl:Class ;
    rdfs:subClassOf risk:RiskFactor ;
    rdfs:label "Market Risk Factor" ;
    rdfs:comment "Market-related risk factor" .

risk:CreditRiskFactor a owl:Class ;
    rdfs:subClassOf risk:RiskFactor ;
    rdfs:label "Credit Risk Factor" ;
    rdfs:comment "Credit-related risk factor" .

risk:OperationalRiskFactor a owl:Class ;
    rdfs:subClassOf risk:RiskFactor ;
    rdfs:label "Operational Risk Factor" ;
    rdfs:comment "Operational risk factor" .

# ==================== Risk Metrics ====================

risk:RiskMetric a owl:Class ;
    rdfs:label "Risk Metric" ;
    rdfs:comment "Quantitative risk measurement" .

risk:ValueAtRisk a owl:Class ;
    rdfs:subClassOf risk:RiskMetric ;
    rdfs:label "Value at Risk" ;
    rdfs:comment "VaR risk metric" .

risk:ConditionalVaR a owl:Class ;
    rdfs:subClassOf risk:RiskMetric ;
    rdfs:label "Conditional VaR" ;
    rdfs:comment "Expected Shortfall (CVaR)" .

risk:HistoricalVaR a owl:Class ;
    rdfs:subClassOf risk:ValueAtRisk ;
    rdfs:label "Historical VaR" ;
    rdfs:comment "Historical simulation VaR" .

risk:MonteCarloVaR a owl:Class ;
    rdfs:subClassOf risk:ValueAtRisk ;
    rdfs:label "Monte Carlo VaR" ;
    rdfs:comment "Monte Carlo simulation VaR" .

risk:ParametricVaR a owl:Class ;
    rdfs:subClassOf risk:ValueAtRisk ;
    rdfs:label "Parametric VaR" ;
    rdfs:comment "Variance-Covariance VaR" .

risk:GreeksMetric a owl:Class ;
    rdfs:subClassOf risk:RiskMetric ;
    rdfs:label "Greeks Metric" ;
    rdfs:comment "Options Greeks risk metric" .

risk:Delta a owl:Class ;
    rdfs:subClassOf risk:GreeksMetric ;
    rdfs:label "Delta" ;
    rdfs:comment "Price sensitivity" .

risk:Gamma a owl:Class ;
    rdfs:subClassOf risk:GreeksMetric ;
    rdfs:label "Gamma" ;
    rdfs:comment "Delta sensitivity" .

risk:Vega a owl:Class ;
    rdfs:subClassOf risk:GreeksMetric ;
    rdfs:label "Vega" ;
    rdfs:comment "Volatility sensitivity" .

risk:Theta a owl:Class ;
    rdfs:subClassOf risk:GreeksMetric ;
    rdfs:label "Theta" ;
    rdfs:comment "Time decay" .

risk:Rho a owl:Class ;
    rdfs:subClassOf risk:GreeksMetric ;
    rdfs:label "Rho" ;
    rdfs:comment "Interest rate sensitivity" .

# ==================== Stress Testing ====================

risk:StressTest a owl:Class ;
    rdfs:label "Stress Test" ;
    rdfs:comment "Stress testing scenario" .

risk:Scenario a owl:Class ;
    rdfs:label "Scenario" ;
    rdfs:comment "Risk scenario definition" .

risk:HistoricalScenario a owl:Class ;
    rdfs:subClassOf risk:Scenario ;
    rdfs:label "Historical Scenario" ;
    rdfs:comment "Historical crisis scenario" .

risk:HypotheticalScenario a owl:Class ;
    rdfs:subClassOf risk:Scenario ;
    rdfs:label "Hypothetical Scenario" ;
    rdfs:comment "Hypothetical stress scenario" .

risk:ReverseStressTest a owl:Class ;
    rdfs:subClassOf risk:StressTest ;
    rdfs:label "Reverse Stress Test" ;
    rdfs:comment "Identify portfolio breaking scenarios" .

risk:SensitivityAnalysis a owl:Class ;
    rdfs:label "Sensitivity Analysis" ;
    rdfs:comment "Parameter sensitivity analysis" .

# ==================== Credit Risk ====================

risk:CreditRisk a owl:Class ;
    rdfs:label "Credit Risk" ;
    rdfs:comment "Credit default risk" .

risk:Counterparty a owl:Class ;
    rdfs:label "Counterparty" ;
    rdfs:comment "Credit exposure counterparty" .

risk:ProbabilityOfDefault a owl:Class ;
    rdfs:label "Probability of Default" ;
    rdfs:comment "PD estimate" .

risk:LossGivenDefault a owl:Class ;
    rdfs:label "Loss Given Default" ;
    rdfs:comment "LGD estimate" .

risk:ExposureAtDefault a owl:Class ;
    rdfs:label "Exposure at Default" ;
    rdfs:comment "EAD estimate" .

risk:CreditRating a owl:Class ;
    rdfs:label "Credit Rating" ;
    rdfs:comment "Credit quality rating" .

risk:CreditMigration a owl:Class ;
    rdfs:label "Credit Migration" ;
    rdfs:comment "Rating transition" .

# ==================== Limits & Controls ====================

risk:LimitStructure a owl:Class ;
    rdfs:label "Limit Structure" ;
    rdfs:comment "Risk limit framework" .

risk:RiskLimit a owl:Class ;
    rdfs:label "Risk Limit" ;
    rdfs:comment "Individual risk limit" .

risk:VaRLimit a owl:Class ;
    rdfs:subClassOf risk:RiskLimit ;
    rdfs:label "VaR Limit" ;
    rdfs:comment "VaR threshold limit" .

risk:ExposureLimit a owl:Class ;
    rdfs:subClassOf risk:RiskLimit ;
    rdfs:label "Exposure Limit" ;
    rdfs:comment "Maximum exposure limit" .

risk:ConcentrationLimit a owl:Class ;
    rdfs:subClassOf risk:RiskLimit ;
    rdfs:label "Concentration Limit" ;
    rdfs:comment "Concentration risk limit" .

risk:LimitBreach a owl:Class ;
    rdfs:label "Limit Breach" ;
    rdfs:comment "Risk limit violation" .

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

risk:hasPosition a owl:ObjectProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range risk:Position ;
    rdfs:label "has position" .

risk:exposedTo a owl:ObjectProperty ;
    rdfs:domain risk:Position ;
    rdfs:range risk:RiskFactor ;
    rdfs:label "exposed to" .

risk:measuredBy a owl:ObjectProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range risk:RiskMetric ;
    rdfs:label "measured by" .

risk:calculatesVaR a owl:ObjectProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range risk:ValueAtRisk ;
    rdfs:label "calculates VaR" .

risk:subjectTo a owl:ObjectProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range risk:StressTest ;
    rdfs:label "subject to" .

risk:appliesScenario a owl:ObjectProperty ;
    rdfs:domain risk:StressTest ;
    rdfs:range risk:Scenario ;
    rdfs:label "applies scenario" .

risk:hasCreditRisk a owl:ObjectProperty ;
    rdfs:domain risk:Position ;
    rdfs:range risk:CreditRisk ;
    rdfs:label "has credit risk" .

risk:exposedToCounterparty a owl:ObjectProperty ;
    rdfs:domain risk:Position ;
    rdfs:range risk:Counterparty ;
    rdfs:label "exposed to counterparty" .

risk:hasPD a owl:ObjectProperty ;
    rdfs:domain risk:Counterparty ;
    rdfs:range risk:ProbabilityOfDefault ;
    rdfs:label "has PD" .

risk:hasLGD a owl:ObjectProperty ;
    rdfs:domain risk:Counterparty ;
    rdfs:range risk:LossGivenDefault ;
    rdfs:label "has LGD" .

risk:hasEAD a owl:ObjectProperty ;
    rdfs:domain risk:Position ;
    rdfs:range risk:ExposureAtDefault ;
    rdfs:label "has EAD" .

risk:hasRating a owl:ObjectProperty ;
    rdfs:domain risk:Counterparty ;
    rdfs:range risk:CreditRating ;
    rdfs:label "has rating" .

risk:governedBy a owl:ObjectProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range risk:LimitStructure ;
    rdfs:label "governed by" .

risk:hasLimit a owl:ObjectProperty ;
    rdfs:domain risk:LimitStructure ;
    rdfs:range risk:RiskLimit ;
    rdfs:label "has limit" .

risk:breaches a owl:ObjectProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range risk:LimitBreach ;
    rdfs:label "breaches" .

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

risk:portfolioId a owl:DatatypeProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range xsd:string ;
    rdfs:label "portfolio ID" .

risk:portfolioName a owl:DatatypeProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range xsd:string ;
    rdfs:label "portfolio name" .

risk:marketValue a owl:DatatypeProperty ;
    rdfs:domain risk:Portfolio ;
    rdfs:range xsd:decimal ;
    rdfs:label "market value" .

risk:positionId a owl:DatatypeProperty ;
    rdfs:domain risk:Position ;
    rdfs:range xsd:string ;
    rdfs:label "position ID" .

risk:instrument a owl:DatatypeProperty ;
    rdfs:domain risk:Position ;
    rdfs:range xsd:string ;
    rdfs:label "instrument" .

risk:quantity a owl:DatatypeProperty ;
    rdfs:domain risk:Position ;
    rdfs:range xsd:decimal ;
    rdfs:label "quantity" .

risk:varValue a owl:DatatypeProperty ;
    rdfs:domain risk:ValueAtRisk ;
    rdfs:range xsd:decimal ;
    rdfs:label "VaR value" .

risk:confidenceLevel a owl:DatatypeProperty ;
    rdfs:domain risk:ValueAtRisk ;
    rdfs:range xsd:decimal ;
    rdfs:label "confidence level" .

risk:timeHorizon a owl:DatatypeProperty ;
    rdfs:domain risk:ValueAtRisk ;
    rdfs:range xsd:integer ;
    rdfs:label "time horizon" .

risk:deltaValue a owl:DatatypeProperty ;
    rdfs:domain risk:Delta ;
    rdfs:range xsd:decimal ;
    rdfs:label "delta value" .

risk:gammaValue a owl:DatatypeProperty ;
    rdfs:domain risk:Gamma ;
    rdfs:range xsd:decimal ;
    rdfs:label "gamma value" .

risk:vegaValue a owl:DatatypeProperty ;
    rdfs:domain risk:Vega ;
    rdfs:range xsd:decimal ;
    rdfs:label "vega value" .

risk:scenarioName a owl:DatatypeProperty ;
    rdfs:domain risk:Scenario ;
    rdfs:range xsd:string ;
    rdfs:label "scenario name" .

risk:impact a owl:DatatypeProperty ;
    rdfs:domain risk:StressTest ;
    rdfs:range xsd:decimal ;
    rdfs:label "impact" .

risk:pdValue a owl:DatatypeProperty ;
    rdfs:domain risk:ProbabilityOfDefault ;
    rdfs:range xsd:decimal ;
    rdfs:label "PD value" .

risk:lgdValue a owl:DatatypeProperty ;
    rdfs:domain risk:LossGivenDefault ;
    rdfs:range xsd:decimal ;
    rdfs:label "LGD value" .

risk:eadValue a owl:DatatypeProperty ;
    rdfs:domain risk:ExposureAtDefault ;
    rdfs:range xsd:decimal ;
    rdfs:label "EAD value" .

risk:ratingValue a owl:DatatypeProperty ;
    rdfs:domain risk:CreditRating ;
    rdfs:range xsd:string ;
    rdfs:label "rating value" .

risk:limitValue a owl:DatatypeProperty ;
    rdfs:domain risk:RiskLimit ;
    rdfs:range xsd:decimal ;
    rdfs:label "limit value" .

risk:utilization a owl:DatatypeProperty ;
    rdfs:domain risk:RiskLimit ;
    rdfs:range xsd:decimal ;
    rdfs:label "utilization" .

risk:breachAmount a owl:DatatypeProperty ;
    rdfs:domain risk:LimitBreach ;
    rdfs:range xsd:decimal ;
    rdfs:label "breach amount" .

risk:breachTime a owl:DatatypeProperty ;
    rdfs:domain risk:LimitBreach ;
    rdfs:range xsd:dateTime ;
    rdfs:label "breach time" .
