1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
module invoice <https://example.com/rentals/>
version "2023-12-21" <https://example.com/v2/rentals/> is
; Part of a larger example.
import [ dc skos xsd:decimal xsd:date xsd:string ]
import customers:foo
import finance
import vehicles
@skos:release = xsd:date("2023-08-12")
@skos:definition = "hello"
structure DateRange is
assert valid_date_range is
self.end_date >= self.start_date
end
start_date -> xsd:date
end_date -> xsd:date
end
structure OdometerRange is
start_miles -> vehicles:OdometerReading
end_miles -> vehicles:OdometerReading is
assert valid_range = "self.end_miles >= self.start_miles"
end
end
entity Invoice is
identity id -> integer
customer -> customers:Customer
vehicle -> vehicles:Vehicle
rental_dates -> DateRange
mileage -> OdometerRange
day_rate -> finance:CurrencyRate
mile_rate -> finance:CurrencyRate
discount -> finance:DiscountPercentage
end
datatype Name <- xsd:string is
@xsd:minLength = true
@xsd:maxLength = 25
end
datatype InvoiceId <- opaque integer
event InvoiceCreated is
source Invoice
at -> xsd:dateTime
end
event InvoicePayed is
source Invoice
at -> xsd:dateTime
end
event InvoiceOverdue is
source Invoice
at -> xsd:dateTime
end
structure Payment is
received -> xsd:dateTime
amount -> finance:CurrencyAmount
kind -> finance:PaymentKind
end
enum Terms of
Immediate is
@skos:preLabel = "NOW"
end
ThirtyDays
SixtyDays
end
union PaymentKind of
Cash
Card as Plastic
end
end
|