我正在通过以下方式从注册表中获取特定资产的资源:-
var flight = factory.newResource(Namespace,'Aircraft',flightId);
我通过以下方式为该资源分配关系:-
flight.aircraft = factory.newRelationship('org.acme.airline.aircraft','Aircraft',aircraftId);
flight.aircraft.firstClassSeats = 10;
flight.aircraft.secondClassSeats = 10;
此关系包含模型文件中定义的以下属性:
asset Aircraft identified by aircraftId {
o String aircraftId
// Number of seats per class
o Integer firstClassSeats default = 0
o Integer businessClassSeats default = 0
o Integer economyClassSeats default = 0
}
航班数据:
asset Flight identified by flightId {
o String flightId regex=/[A-Z][A-Z][0-9][0-9][0-9]-[0-9][0-9]-[0-3][0-9]-[0-9][0-9]/
o String flightNumber
o Route route
o String[] aliasFlightNumber optional
--> Aircraft aircraft optional
}
现在,如何更新特定航班资源的这些关系值(例如firstClassSeats)并将其更新到相应的注册表。