The following protocol for hello-world was already treated:
protocol GreetWorld {Now suppose we have a very nice XML schema for greetings and you wish to use it as a message format. What do you do? Here is how it goes:
participant You, World;
channel chWorld @ World;
chWorld.greetings(string) from You to World;
}
import greetings.xsd;This protocol definition starts from an "import" clause which imports document/data types as well as other definitions (for example protocol itself) from outside. Above we assume a package hierarchy (which can use among others a standard directory/folder hierarchy) and that, in the same directory as this protocol definition is stored, there is an XML schema called greetings.xsd. We are not specifying a target name space here but we do not demand prefixing the schema with "noNameSpaceSchemeLocation" but if you like we can use the familiar XSI notation:
protocol GreetWorld {
participant You, World;
channel chWorld @ World;
chWorld.greetings.xsd from You to World;
}
import xsi:noNameSpaceSchemeLocation="greetings.xsd";(Above division into multiple sentences has no effect, as usual.) Note the import clause is still prefixed with "import": this makes clear (in our curly-brace syntax) that this is about importing a document type.
Similarly we have two ways to import an XML schema (or other data/document formats) using URL (not specifying a target namespace for simplicity). The first one is a simpler one:
importwhich defines the xsd file we need. Once imported, you can use the format as greetings.xsd (or even just greetings if there is no confusion). Or if you wish to use a long format you may write:
http://www.somewhewre.org/xsdrepository greetings.xsd;
import xsi:schemeLocation=which has exactly the same effect.
"http://www.somewhewre.org/xsdrepository greetings.xsd";
Various data formats (including UML class models) can be imported in the same way. Incorporation of these data types of course means that, when we specify behaviours, we need to find a good way to fill and extract datum from such a data format: this is the concern when we move to conversation models and behavioural specifications and not needed for protocols (i.e. type structure).
The notations for importing various document and data formats are important for practical usage of scribble in the area of (among others) financial protocols: the above is a tentative idea and we ask for your ideas and observations to make this part very good, for now and for future.