Presentation on theme: "Validation of a CGM Graphic Against the Web CGM Profile"— Presentation transcript:
1 Validation of a CGM Graphic Against the Web CGM Profile Stuart GaltThe Boeing Company
2 AgendaWhat is the WebCGM profileThe processHard parts
3 WebCGMCGM (ISO 8632) vector and composite vector/raster graphic format.WebCGM is a profile used to specify the subset of the CGM standard that will be used to exchange data on the web.This is background and most everyone in the audience should know this. Feel free to ad-lib here.
4 WebCGM History 1987 - ISO approved CGM as a Standard CGM became a registered mime typeW3C published “Scalable Graphics Requirements”W3C published “Use of CGM as a Scalable Graphic Format”WebCGM 1.0 approved in January
11 CGM States Container elements used to mark state changes Metafile defaults<MetafileDefaultsReplacement> …defaults go here … </MetafileDefaultsReplacement>Can be thought of similar to the “GSAVE” command in postscript.Major States :PCS Picture Closed StateMDS Metafile Descriptor StateDR Defaults Replacement ModeGSS Global Segment StateDSS Picture Descriptor Segment StatePDS Picture Descriptor StatePOS Picture Open StateLSS Local Segment StateSDS Structure Descriptor StateSOS Structure Open StateMinor States :FOS Figure Open StateTOS Text Open StateCPS Compound Path StatePRS Protection Region StateTAS Tile Array State
12 CGM States (cont’d) Picture Descriptor and Picture Open State <Picture> <StringFixed>Picture Description</StringFixed>…Picture descriptor data here…<BeginPictureBody/> …Picture data here… </Picture>
13 CGM States Computer Graphics Metafile Metafile Descriptor Picture EndMFBegMFPicturePictureDescriptorPictureBodyEndPicBegPicPictureBodyPictureOpenBegPicBody
15 Validating WebCGM Current state: Profile validation tool exists for WebCGM in binary encodingMetacheckWith a WebCGM schema definedGeneral purpose tools would be available
16 The SchemaSome elements are easy to representSome are hard
17 Metafile Version <element name="MetafileDescriptor"> <complexType><sequence><element name="MetafileVersion"><attribute name=“version” use=“required”type=“integer” minInclusive=“1”maxInclusive=“4”/></element><all><element name="MetafileDescription" type="string"/>...other required elements go here...</all></sequence></complexType></element>The Metafile Version tag may appear only once in the CGM file, and mustoccur somewhere in the metafile descriptor section. There are a few otherrequired elements in this descriptor section and could be represented in aschema by something like:The above example is a long way of saying that the Metafile Versiontag must occur in the somewhere in the Metafile Descriptor section, but doesn'tsay exactly where. In addition the allowable values for the required versionattribute are 1, 2, 3, or 4.
18 Non Graphical Text String <simpleType name=“NonGraphicText”><restriction base=“string”><minlength value=“0”/><maxlength value=“254”/></restriction></simpleType>A non-graphical text string is string that is not directly displayedon the graphic. An example would be the text associated with the CGM beginpicture element. Non-graphical text strings are required to be less than 254characters in length. By defining an element NonGraphicText type we can defineit as a type of string with a length from 0 to 254 charactersBy defining the nongraphic text string attribute as:type=“NonGraphicText”We ensure that the string length requirement is met.<
19 The HardSome elements are restricted (or required based on the value of the metafile versionIf version == 3 then a RestrictedTextType element must appear before the first RestrictedText elementIf ColorSelectionMode is indexed color is index value, else color is RGB valuesCurrently the author does not know how to represent some of the morecomplex restrictions in the WebCGM profile. There are several clauses thatrestrict (or require) an element based on the value of the metafile version.For example if you are in a version 3 metafile and you have a Restricted Textelement, then you are required to have a Restricted Text Type element beforethe first Restricted Text element appears.I don’t know how to represent regular expressions and branching type logic using schema. One of the talks at the conference is about regular expressions in schema…
20 The Hard Part Branching logic If (condition a) then foo else bar
21 ConclusionCreation of a schema that enforces WebCGM profile allows simple XML schema validator to validate conformance of CGM graphics.This approach could also be used to simplify validation of other binary structured formats.
22 What’s Ahead Complete mapping CGM binary to XML Finish WebCGM schema Work to continue in CGM Open Consortium: