business-partners.rq 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. PREFIX gesli: <https://gesli.example/ontology#>
  2. PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
  3. SELECT DISTINCT ?partnerName ?partnerRole ?partnerType ?country ?region ?serviceCity ?servicePort
  4. ?businessRegistrationNo ?taxNo ?isActivePartner ?contactName ?contactRole ?phone
  5. WHERE {
  6. ?partner a/rdfs:subClassOf* gesli:BusinessPartner ;
  7. rdfs:label ?partnerName .
  8. OPTIONAL { ?partner gesli:platformSupplierType ?partnerType . }
  9. OPTIONAL { ?partner gesli:serviceCity ?serviceCity . }
  10. OPTIONAL { ?partner gesli:servicePort ?servicePort . }
  11. OPTIONAL {
  12. ?partner a/rdfs:subClassOf* gesli:Customer .
  13. BIND("客户" AS ?customerRole)
  14. }
  15. OPTIONAL {
  16. ?partner a/rdfs:subClassOf* gesli:Supplier .
  17. BIND("平台供应商" AS ?supplierRole)
  18. }
  19. OPTIONAL {
  20. ?partner gesli:hasBusinessPartnerBasicInfo ?basic .
  21. OPTIONAL { ?basic gesli:businessPartnerRole ?basicPartnerRole . }
  22. OPTIONAL { ?basic gesli:country ?country . }
  23. OPTIONAL { ?basic gesli:region ?region . }
  24. OPTIONAL { ?basic gesli:businessRegistrationNo ?businessRegistrationNo . }
  25. OPTIONAL { ?basic gesli:taxNo ?taxNo . }
  26. OPTIONAL { ?basic gesli:isActivePartner ?isActivePartner . }
  27. }
  28. OPTIONAL {
  29. ?partner gesli:hasBusinessPartnerContact ?contact .
  30. OPTIONAL { ?contact gesli:contactName ?contactName . }
  31. OPTIONAL { ?contact gesli:contactRole ?contactRole . }
  32. OPTIONAL { ?contact gesli:phone ?phone . }
  33. }
  34. BIND(COALESCE(?basicPartnerRole, ?customerRole, ?supplierRole) AS ?partnerRole)
  35. }
  36. ORDER BY ?partnerRole ?partnerType ?partnerName