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

SELECT DISTINCT ?supplierName ?supplierNature ?platformSupplierType ?servicePort
       ?primaryRouteName ?primaryProductName ?primaryServiceForm
       ?routeConcentrationRatio ?productConcentrationRatio ?serviceConcentrationRatio
       ?totalRouteCount ?totalProductCount ?coveredTransportModes ?coveredRoutes ?coveredServiceForms
       ?offeringCode ?capacityCommitment ?bookingSuccessRate ?spaceReleaseSuccessRate
       ?settlementTermDays ?prepaymentRequired ?feeDisputeCount
WHERE {
  ?supplier a/rdfs:subClassOf* gesli:Supplier ;
            rdfs:label ?supplierName .

  OPTIONAL { ?supplier gesli:supplierNature ?supplierNature . }
  OPTIONAL { ?supplier gesli:platformSupplierType ?platformSupplierType . }
  OPTIONAL { ?supplier gesli:servicePort ?servicePort . }

  {
    ?supplier gesli:hasSupplierConcentrationProfile ?profileMarker .
  } UNION {
    ?supplier gesli:hasSupplierServiceCapabilityProfile ?profileMarker .
  } UNION {
    ?supplier gesli:hasProductOffering ?profileMarker .
  } UNION {
    ?supplier gesli:hasSupplierSettlementProfile ?profileMarker .
  }

  OPTIONAL {
    ?supplier gesli:hasSupplierConcentrationProfile ?concentration .
    OPTIONAL { ?concentration gesli:primaryRouteName ?primaryRouteName . }
    OPTIONAL { ?concentration gesli:primaryProductName ?primaryProductName . }
    OPTIONAL { ?concentration gesli:primaryServiceForm ?primaryServiceForm . }
    OPTIONAL { ?concentration gesli:routeConcentrationRatio ?routeConcentrationRatio . }
    OPTIONAL { ?concentration gesli:productConcentrationRatio ?productConcentrationRatio . }
    OPTIONAL { ?concentration gesli:serviceConcentrationRatio ?serviceConcentrationRatio . }
  }

  OPTIONAL {
    ?supplier gesli:hasSupplierServiceCapabilityProfile ?capability .
    OPTIONAL { ?capability gesli:totalRouteCount ?totalRouteCount . }
    OPTIONAL { ?capability gesli:totalProductCount ?totalProductCount . }
    OPTIONAL { ?capability gesli:coveredTransportModes ?coveredTransportModes . }
    OPTIONAL { ?capability gesli:coveredRoutes ?coveredRoutes . }
    OPTIONAL { ?capability gesli:coveredServiceForms ?coveredServiceForms . }
  }

  OPTIONAL {
    ?supplier gesli:hasProductOffering ?offering .
    OPTIONAL { ?offering gesli:offeringCode ?offeringCode . }
    OPTIONAL { ?offering gesli:capacityCommitment ?capacityCommitment . }
    OPTIONAL { ?offering gesli:bookingSuccessRate ?bookingSuccessRate . }
    OPTIONAL { ?offering gesli:spaceReleaseSuccessRate ?spaceReleaseSuccessRate . }
  }

  OPTIONAL {
    ?supplier gesli:hasSupplierSettlementProfile ?settlement .
    OPTIONAL { ?settlement gesli:settlementTermDays ?settlementTermDays . }
    OPTIONAL { ?settlement gesli:prepaymentRequired ?prepaymentRequired . }
    OPTIONAL { ?settlement gesli:feeDisputeCount ?feeDisputeCount . }
  }
}
ORDER BY ?supplierNature ?platformSupplierType ?supplierName
