
Hello everybody, for the AssessGrid project, we are working on SLA support for our resource management system. At the very moment, I am in the stage of generating an extensive SLA template to get a good feeling about the current WSAG specification. (I didn't follow the development for some time because I was busy with other projects). I would like to send you my results for comment once they are available, but right now I have encountered the first problem already. Maybe you can help me with this: I would like to add a CreationConstraint that models a boolean flag, whether some fault tolerance mechanisms need to be activated. The respective XML fragment looks like this: <wsag:Item wsag:Name="Checkpointing"> <wsag:Location>//assessgrid:FTService/assessgrid:Requested</wsag:Location> <wsag:ItemConstraint> <!-- I don't quite know how to put true / false here --> </wsag:ItemConstraint> </wsag:Item> So what do I put there to allow only true and false? My first idea was to use a xs:restriction like <xs:restriction base="xs:string"> <xs:enumeration value="true"/> <xs:enumeration value="false"/> </xs:restriction> but to my surprise my editor (WTP of Eclipse) tells me that xs:restriction is not a valid tag at this place - despite being explicitly mentioned in the WSAG specification. Now, who is right? The syntax checker of the editor or the WSAG spec, or both, meaning that I am wrong? The error message is: cvc-complex-type.2.4.a: Invalid content was found starting with element 'xs:restriction'. One of '{"http://www.w3.org/2001/XMLSchema":simpleType, "http://www.w3.org/2001/XMLSchema":minExclusive, "http://www.w3.org/2001/XMLSchema":minInclusive, "http://www.w3.org/2001/XMLSchema":maxExclusive, "http://www.w3.org/2001/XMLSchema":maxInclusive, "http://www.w3.org/2001/XMLSchema":totalDigits, "http://www.w3.org/2001/XMLSchema":fractionDigits, "http://www.w3.org/2001/XMLSchema":length, "http://www.w3.org/2001/XMLSchema":minLength, "http://www.w3.org/2001/XMLSchema":maxLength, "http://www.w3.org/2001/XMLSchema":enumeration, "http://www.w3.org/2001/XMLSchema":whiteSpace, "http://www.w3.org/2001/XMLSchema":pattern, "http://www.w3.org/2001/XMLSchema":group, "http://www.w3.org/2001/XMLSchema":all, "http://www.w3.org/2001/XMLSchema":choice, "http://www.w3.org/2001/XMLSchema":sequence}' is expected. This matches mostly with the specification except for the xs:restriction. Coming back to the problem of modeling "Put true or false there", what would be the best way? If I understand the xs:group, xs:all, xs:choice, xs:sequence correctly, they all operate on complex types. Does this leave anything but the xs:pattern alternative? (Note that true/false is just a special case for any kind of enumeration.) Thanks, Dominic P.S. In case you have some example files of templates, I would be very interested in having a look at them.

Hi Dominic, since you are using our implementation I think the following code should work for you: AgreementTemplateType template = AgreementTemplateType.Factory.newInstance(); template.setAgreementId("some_id"); AgreementContextType context = template.addNewContext(); context.setServiceProvider(AgreementRoleType.AGREEMENT_RESPONDER); template.addNewTerms(); ConstraintSectionType section = template.addNewCreationConstraints(); OfferItemType offer = section.addNewItem(); offer.setLocation("some_location"); ItemConstraint constraint = offer.addNewItemConstraint(); LocalSimpleType simpleType = constraint.addNewSimpleType(); Restriction restriction = simpleType.addNewRestriction(); restriction.setBase(new QName("http://www.w3.org/2001/XMLSchema", "string")); restriction.addNewEnumeration().addNewValue().setStringValue("true"); restriction.addNewEnumeration().addNewValue().setStringValue("false"); This creates the following XML: <?xml version="1.0" encoding="UTF-8"?> <ws:Template ws:AgreementId="some_id" xmlns:ws="http://schemas.ggf.org/graap/2006/07/ws-agreement" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.ggf.org/graap/2006/07/ws-agreement agreement_types.xsd"> <ws:Context> <ws:ServiceProvider>AgreementResponder</ws:ServiceProvider> </ws:Context> <ws:Terms /> <ws:CreationConstraints> <ws:Item> <ws:Location>some_location</ws:Location> <ws:ItemConstraint> <xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:restriction base="xs:string"> <xs:enumeration value="true" /> <xs:enumeration value="false" /> </xs:restriction> </xs:simpleType> </ws:ItemConstraint> </ws:Item> </ws:CreationConstraints> </ws:Template> I think this is what you want. Regards, Oliver -----Ursprüngliche Nachricht----- Von: graap-wg-bounces@ogf.org [mailto:graap-wg-bounces@ogf.org] Im Auftrag von Dominic Battre Gesendet: Montag, 12. Februar 2007 11:55 An: graap-wg@ogf.org Betreff: [GRAAP-WG] SLA Template Hello everybody, for the AssessGrid project, we are working on SLA support for our resource management system. At the very moment, I am in the stage of generating an extensive SLA template to get a good feeling about the current WSAG specification. (I didn't follow the development for some time because I was busy with other projects). I would like to send you my results for comment once they are available, but right now I have encountered the first problem already. Maybe you can help me with this: I would like to add a CreationConstraint that models a boolean flag, whether some fault tolerance mechanisms need to be activated. The respective XML fragment looks like this: <wsag:Item wsag:Name="Checkpointing"> <wsag:Location>//assessgrid:FTService/assessgrid:Requested</wsag:Location> <wsag:ItemConstraint> <!-- I don't quite know how to put true / false here --> </wsag:ItemConstraint> </wsag:Item> So what do I put there to allow only true and false? My first idea was to use a xs:restriction like <xs:restriction base="xs:string"> <xs:enumeration value="true"/> <xs:enumeration value="false"/> </xs:restriction> but to my surprise my editor (WTP of Eclipse) tells me that xs:restriction is not a valid tag at this place - despite being explicitly mentioned in the WSAG specification. Now, who is right? The syntax checker of the editor or the WSAG spec, or both, meaning that I am wrong? The error message is: cvc-complex-type.2.4.a: Invalid content was found starting with element 'xs:restriction'. One of '{"http://www.w3.org/2001/XMLSchema":simpleType, "http://www.w3.org/2001/XMLSchema":minExclusive, "http://www.w3.org/2001/XMLSchema":minInclusive, "http://www.w3.org/2001/XMLSchema":maxExclusive, "http://www.w3.org/2001/XMLSchema":maxInclusive, "http://www.w3.org/2001/XMLSchema":totalDigits, "http://www.w3.org/2001/XMLSchema":fractionDigits, "http://www.w3.org/2001/XMLSchema":length, "http://www.w3.org/2001/XMLSchema":minLength, "http://www.w3.org/2001/XMLSchema":maxLength, "http://www.w3.org/2001/XMLSchema":enumeration, "http://www.w3.org/2001/XMLSchema":whiteSpace, "http://www.w3.org/2001/XMLSchema":pattern, "http://www.w3.org/2001/XMLSchema":group, "http://www.w3.org/2001/XMLSchema":all, "http://www.w3.org/2001/XMLSchema":choice, "http://www.w3.org/2001/XMLSchema":sequence}' is expected. This matches mostly with the specification except for the xs:restriction. Coming back to the problem of modeling "Put true or false there", what would be the best way? If I understand the xs:group, xs:all, xs:choice, xs:sequence correctly, they all operate on complex types. Does this leave anything but the xs:pattern alternative? (Note that true/false is just a special case for any kind of enumeration.) Thanks, Dominic P.S. In case you have some example files of templates, I would be very interested in having a look at them. -- graap-wg mailing list graap-wg@ogf.org http://www.ogf.org/mailman/listinfo/graap-wg
participants (2)
-
Dominic Battre
-
Oliver Wäldrich