PREFIX gesli: <https://gesli.example/ontology#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?solutionName ?solutionType ?marketBenchmarkAmount
       ?strategyName ?strategyObjective ?aiRecommendedAmount
       ?allowedQuoteLowerAmount ?allowedQuoteUpperAmount
       ?customerName ?loyaltyTransactionCount ?customerPremiumAmount
       ?salespersonAdjustmentAmount ?finalQuoteAmount ?currency ?pricingExplanation
WHERE {
  ?recommendedPrice a gesli:AIRecommendedPrice ;
                    gesli:recommendedForSolution ?solution ;
                    gesli:basedOnMarketBenchmark ?benchmark ;
                    gesli:basedOnProductStrategy ?strategy ;
                    gesli:aiRecommendedAmount ?aiRecommendedAmount ;
                    gesli:allowedQuoteLowerAmount ?allowedQuoteLowerAmount ;
                    gesli:allowedQuoteUpperAmount ?allowedQuoteUpperAmount ;
                    gesli:currency ?currency .

  ?solution gesli:solutionName ?solutionName ;
            gesli:solutionType ?solutionType .
  ?benchmark gesli:marketBenchmarkAmount ?marketBenchmarkAmount .
  ?strategy gesli:strategyName ?strategyName ;
            gesli:strategyObjective ?strategyObjective .

  OPTIONAL { ?recommendedPrice gesli:pricingExplanation ?pricingExplanation . }
  OPTIONAL {
    ?premium a gesli:CustomerPremiumDecision ;
             gesli:basedOnAIRecommendedPrice ?recommendedPrice ;
             gesli:premiumForCustomer ?customer ;
             gesli:loyaltyTransactionCount ?loyaltyTransactionCount ;
             gesli:customerPremiumAmount ?customerPremiumAmount .
    ?customer rdfs:label ?customerName .
    OPTIONAL {
      ?customerQuote a gesli:CustomerQuote ;
                     gesli:usesRecommendedPrice ?recommendedPrice ;
                     gesli:usesPremiumDecision ?premium ;
                     gesli:salespersonAdjustmentAmount ?salespersonAdjustmentAmount ;
                     gesli:finalQuoteAmount ?finalQuoteAmount .
    }
  }
}
ORDER BY ?solutionName ?customerName
