wsmlVariant _"http://www.wsmo.org/wsml/wsml-syntax/wsml-flight" namespace {_"http://ontologies.deri.org/spChoreographies#", sp _"http://ontologies.deri.org/supplierProvider#", spws _"http://ontologies.deri.org/supplierProviderWebService#", dates _"http://ontologies.deri.org/notableDates#", corp _"http://ontologies.deri.org/corporate#" } /* * There is no format for definition of choreography that * passes the validator. The following form is used. */ webService _"http://ontologies.deri.org/spWebService" // Supplier-Producer Choreographies: interface spUserInterface choreography spUserChoreography choreography spUserChoreography stateSignature importsOntology (_"http://ontologies.deri.org/SPOntology", _"http://ontologies.deri.org/SPWSOntology"} in { sp#globalOffer withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/GlobalOffer/In), sp#globalConfirm withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/GlobalConfirm/In) } out { sp#productName withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ProductName/Out), sp#destination withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/Destination/Out), sp#globalAnswer withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/GlobalAnswer/Out) } /* ProductName outputs a product name and destination given a requirement for a quantity of that product by a department. Destination outputs an address to which a product is to be shipped. The address of the department and the secretary's phone number are included in the destination specification. GlobalOffer inputs an offer for the sale and shipping of some product) and outputs an answer which is either a rejection of the offer, or an acceptance with extra details possibly filled in, in return. GlobalConfirm inputs a confirmation of a contract for purchase and shipping of some product, including all details of the transaction, and outputs the information to other programs in the user system as appropriate in response. */ guardedTransition SupplierShipperRules /* * Specify product and shipping destination */ forAll {?requirement, ?pName, ?num ?dept, ?deptAddress, ?sec, ?secPhone } with ( ?requirement[ product hasValue ?pName, quantity hasValue ?num, dept hasValue ?dept] memberOf corp#requirement) and ?dept[ contactSecretary hasValue ?sec address hasValue ?deptAddress ] memberOf corp#department and ?sec[mainOfficePhone hasValue ?secPhone, name hasValue ?secName] memberOf corp#employee do add( _#[name hasValue ?pName, quantity hasValue ?num] memberOf sp#productName) and add( _#[address hasValue ?deptAddress, phone hasValue ?secPhone, consignee hasValue ?secName] memberOf sp#destination) endForAll /* * Receive offer and return answer */ doForAll {?goffer, ?delivTime, ?price, ?id, ?product, ?restriction, ?priceLimit} with ( ?goffer[ deliveryTime hasValue ?delivTime, totalPrice hasValue ?price, quoteID hasValue ?id, productType hasValue ?product] memberOf sp#globalOffer // ?selection, above, is the input. The items below are already // in the knowledge base. and ?restriction[maxPrice hasValue ?priceLimit, productType hasValue ?product] memberOf sp#maxPrice and before(?delivTime, dates#newYears2006) and wsml#lessThan(?price, ?priceLimit) do add(_#[ deliveryTime hasValue ?delivTime, totalPrice hasValue ?price, quoteID hasValue ?id, acceptance hasValue sp#accept] memberOf sp#globalAnswer) endForAll /* * Receive confirmation and update own answer */ forAll (?gconfirm, ?id, ?pConfirm, ?sConfirm, ?ganswer) ?gconfirm[ quoteID hasValue ?id, pConfirm hasValue ?pConfirm, sConfirm hasValue ?sConfirm] memberOf sp#GlobalConfirm and ?ganswer[ quoteID hasValue ?id, acceptance hasValue sp#accept] memberOf sp#globalAnswer do update(?ganswer[acceptance hasValue sp#confirmed]) endForAll /* * * * * * * * * * */ interface spProducerInterface choreography spProducerChoreography stateSignature importsOntology _"http://ontologies.deri.org/SPOntology" in { sp#producerRequest withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ProducerRequest/In), sp#producerAnswer withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ProducerAnswer/In) } out { sp#producerOrder withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ProducerOrder/Out), sp#producerConfirm withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ProducerConfirm/Out } /* ProducerRequest inputs a request for purchase including product name and quantity. It outputs a ProducerOffer including details such as price, size, date available, etc. ProducerAnswer inputs an answer which is either a rejection of the offer, or an acceptance with extra details possibly filled in, in return. It outputs a GlobalConfirm which is a confirmation of a contract for purchase with values left optional, filled in, given any new data provided in the ProducerAnswer and internal considerations. */ guardedTransition ProducerRules /* * Produce offer by Producer */ forAll {?request, ?product, ?num, ?item, ?min, ?max, ?price } with ( ?request[ product hasValue ?product, quantity hasValue ?num] memberOf sp#producerRequest and ?item[ product hasValue ?product, minQuantity hasValue ?min, maxQuantity hasValue ?max, price hasValue ?price ] memberOf corp#priceListItem and lessThan(?min, ?num) and lessThan(?num, ?max) // leaving out calculation for when it will be ready and shipping size // and generating quoteID do add( _#[ product hasValue ?product, quantity hasValue ?num, price hasValue ?price, size hasValue ?size, availableDate hasValue ?availableDate, quoteID hasValue ?quoteID ] memberOf sp#producerOffer ) endForAll /* * Producer receive answers and confirms if accepted */ doForAll {?poffer, ?price, ?id, ?product, ?restriction, ?priceLimit} with ( ?answer[ pPrice hasValue ?price, productType hasValue ?product, quantity hasValue ?num, quoteID hasValue ?id, acceptance hasValue accept] memberOf sp#producerAnswer and // ?answer, above, is the input. The offer below is already // in the knowledge base. ?poffer[ pPrice hasValue ?price, productType hasValue ?product, quantity hasValue ?num, quoteID hasValue ?id] memberOf sp#producerOffer do add( _#[pPrice hasValue ?price, quoteID hasValue ?id, productType hasValue ?product] memberOf sp#producerConfirm) // other details would probably be added endForAll /* * * * * * */ interface spShipperInterface choreography spShipperChoreography stateSignature importsOntology _"http://ontologies.deri.org/SPOntology" in { sp#producerRequest withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ShipperRequest/In), sp#producerAnswer withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ShipperAnswer/In) } out { sp#producerOrder withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ShipperOrder/Out), sp#producerConfirm withGrounding spWS#wsdl.interfaceMessageReference(SP_ServicePortType/ShipperConfirm/Out } /* ShipperRequest inputs a request for shipping including product type, size, and destination. It outputs a ShipperOffer including details such as price, delivery date, etc. ShipperAnswer inputs an answer which is either a rejection of the offer, or an acceptance with extra details possibly filled in, in return. It outputs a ShipperConfirm which is a confirmation of a contract for shipping with values which were left optional filled in, given any new data provided in the ShipperAnswer and internal considerations. */ guardedTransition ShipperRules /* * Produce offer by Shipper */ forAll {?request, ?product, ?size, ?item, ?min, ?max, ?price, ?deliveryDate, ?quoteID } with ( ?request[ product hasValue ?product, size hasValue ?size ] memberOf sp#shipperRequest and ?item[ product hasValue ?product, minSize hasValue ?min, maxSize hasValue ?max, price hasValue ?price ] memberOf corp#priceListItem and lessThan(?min, ?size) and lessThan(?size, ?max) // leaving out calculation for delivery date and quoteID do add( _#[ product hasValue ?product, size hasValue ?size, price hasValue ?price, deliveryDate hasValue ?deliveryDate, quoteID hasValue ?quoteID ] memberOf sp#shipperOffer ) endForAll /* * Shipper receives answers and confirms if accepted */ doForAll {?answer, ?price, ?product, ?size, ?id, ?poffer, ?restriction, ?priceLimit} with ( ?answer[ pPrice hasValue ?price, productType hasValue ?product, size hasValue ?size, quoteID hasValue ?id, acceptance hasValue accept] memberOf sp#shipperAnswer and // ?answer, above, is the input. The offer below is already // in the knowledge base. ?poffer[ pPrice hasValue ?price, productType hasValue ?product, size hasValue ?size, quoteID hasValue ?id] memberOf sp#shipperOffer do add( _#[pPrice hasValue ?price, quoteID hasValue ?id, productType hasValue ?product] memberOf sp#shipperConfirm) // other details would probably be added endForAll