saf

Uploaded from authorPOINT
Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Beyond Schemas: 

Beyond Schemas Extending Schemas with the Schema Adjunct Framework Scott Vorthmann, Extensibility Jonathan Robie, Software AG

Extending Schemas: 

Extending Schemas Goals: Provide extensibility for schema languages, similar to libraries in programming languages Schema language and programming language independence Allow extensions to the data associated with types declared in schema languages Allow processing to use this data in a language-independent way

DTDs: associate, validate: 

DTDs: associate, validate andlt;customerandgt; andlt;custNameandgt; andlt;/custNameandgt;

DTDs: associate, validate: 

DTDs: associate, validate andlt;!ELEMENT customer (name , shippingAddress , bi andlt;!ELEMENT name (#PCDATA)andgt; andlt;customerandgt; andlt;custNameandgt; andlt;/custNameandgt;

DTDs: associate, validate: 

DTDs: associate, validate andlt;customerandgt; andlt;custNameandgt; andlt;/custNameandgt; andlt;!ELEMENT customer (name , shippingAddress , bi andlt;!ELEMENT name (#PCDATA)andgt;

Java: associate, validate: 

Java: associate, validate checkCreditRating(n); andlt;customerandgt; andlt;custNameandgt; andlt;/custNameandgt;

Query: associate, validate: 

Query: associate, validate empty ( FROM $d IN //deadbeats, $c IN $this WHERE $d/name = $this/name RETURN $d ) andlt;customerandgt; andlt;custNameandgt; andlt;/custNameandgt;

DTDs: associate, enhance: 

DTDs: associate, enhance andlt;collectionandgt; andlt;itemandgt; Hi Mom! andlt;/itemandgt; andlt;itemandgt; Hi Dad! andlt;item /andgt; andlt;/collectionandgt; andlt;!ELEMENT collection (%item; )andgt; andlt;!ATTLIST collection ordered (true | false ) 'true' duplicates (allowed | prohibited ) 'allowed' andgt;

DTDs: associate, enhance: 

DTDs: associate, enhance andlt;collection ordered='false' duplicates='allowed'andgt; andlt;itemandgt; Hi Mom! andlt;/itemandgt; andlt;itemandgt; Hi Dad! andlt;item /andgt; andlt;/collectionandgt; andlt;!ELEMENT collection (%item; )andgt; andlt;!ATTLIST collection ordered (true | false ) 'true' duplicates (allowed | prohibited ) 'allowed' andgt;

Schemas: associate, enhance: 

Schemas: associate, enhance andlt;element name = 'person'andgt; andlt;complexType content = 'elementOnly'andgt; andlt;sequenceandgt; andlt;element ref = 'name'/andgt; andlt;element ref = 'iq'/andgt; andlt;element ref = 'gender'/andgt; andlt;/sequenceandgt; andlt;/complexTypeandgt; andlt;/elementandgt; andlt;simpleType name = 'iq' base = 'decimal'/andgt;

Schemas: associate, enhance: 

Schemas: associate, enhance andlt;personandgt; andlt;nameandgt;Alexander B. Poindexterandlt;/nameandgt; andlt;iqandgt;53andlt;/iqandgt; andlt;genderandgt;Maleandlt;/genderandgt; andlt;/personandgt;

Schemas: associate, enhance: 

Schemas: associate, enhance andlt;personandgt; andlt;nameandgt;Alexander B. Poindexterandlt;/nameandgt; andlt;iqandgt;53andlt;/iqandgt; andlt;genderandgt;Maleandlt;/genderandgt; andlt;/personandgt; Base='decimal!' andlt;simpleType name = 'iq' base = 'decimal'/andgt;

What’s not in a schema language?: 

What’s not in a schema language? Data types? Input masks? Boundary conditions? Uniqueness constraints? Primary/foreign keys? Inheritance models? Co-occurrence constraints? Database mappings? Algorithmic validation? Indexing strategies? Data bindings to OO systems? Does it ever stop?

In fact, just yesterday...: 

In fact, just yesterday... Makoto MURATA, Relaxer Name mapping XML andlt;--andgt; Java Specifying alternative mappings (e.g. choosing which container type) Identifying the location of earlier versions of definitions

Schema Adjunct Framework: 

Schema Adjunct Framework Associate data with XML node types Data is represented in any language The processor for this language may be Known in advance, (or) Identified by means of a namespace

Adjuncts and Associations: 

Adjuncts and Associations andlt;schema-adjunct target='http://www.example.com/pat-admit.xdr' xmlns:sto = 'http://www.example.com/xml-store.xsd'andgt; andlt;element which = 'admission'andgt; andlt;sto:rootable/andgt; andlt;sto:indexandgt;textandlt;/sto:indexandgt; andlt;/elementandgt; andlt;/schema-adjunctandgt;

Associations: 

Associations andlt;schema-adjunct target='http://www.example.com/pat-admit.xdr' xmlns:sto = 'http://www.example.com/xml-store.xsd'andgt; andlt;element which = 'admission'andgt; andlt;sto:rootable/andgt; andlt;sto:indexandgt;textandlt;/sto:indexandgt; andlt;/elementandgt; andlt;/schema-adjunctandgt; andlt;?xml version='1.0'?andgt; andlt;Schema name='pat-admit.xdr'andgt; andlt;ElementType name='admission' content='eltOnly' order='seq'andgt; andlt;AttributeType name='id' dt:type='string' required='yes' /andgt; andlt;attribute type='id'/andgt; andlt;element type='patient-name'/andgt; andlt;element type='age'/andgt; andlt;/ElementTypeandgt; andlt;/Schemaandgt;

Associations: 

Associations andlt;schema-adjunct target='http://www.example.com/pat-admit.xdr' xmlns:sto = 'http://www.example.com/xml-store.xsd'andgt; andlt;element which = 'admission'andgt; andlt;sto:rootable/andgt; andlt;sto:indexandgt;textandlt;/sto:indexandgt; andlt;/elementandgt; andlt;/schema-adjunctandgt; Isn’t this a lot like XSLT?

SAF Implementations: 

SAF Implementations SAF is declarative, and language independent SAF per se is the XML syntax for adjuncts Supporting SAF associations is usually just one function Further support may exist for: loading and managing adjuncts finding a processor that understands an adjunct

SAF Implementations: 

SAF Implementations DOM NodeList assoc = sa.getAssociations(node) XSLT andlt;template match='*[associations(‘index’)]'andgt; SAX extending the events

Schema Adjunct Framework: 

Schema Adjunct Framework an XML format for stating schema-specific, task-specific meta-data alternative viewpoints: extend schemas with task-specific meta-data OR parameterize tasks with schema-specific meta-data

Schema Adjunct Syntax: 

Schema Adjunct Syntax andlt;schema-adjunct target='target NS URI' xmlns:proc='processor NS URI'andgt; andlt;documentandgt; andlt;proc:global-meta-data/andgt; andlt;/documentandgt; andlt;element which='element1/element2'andgt; andlt;proc:some-meta-data/andgt; andlt;/elementandgt; andlt;attribute which='element3/@attr1'andgt; andlt;proc:more-meta-data/andgt; andlt;/attributeandgt; andlt;!-- more element and attribute associations --andgt; andlt;/schema-adjunctandgt;

Schema Lock-in: 

Schema Lock-in XML PO PO persist DB

Schema-generic Processing: 

Schema-generic Processing XML instance generic persist DB Schema Adjunct

Schema Adjunct Processors: 

Schema Adjunct Processors Schema XML instance Schema Adjunct adjunct processor ...

Enabling Processing per-Schema: 

Enabling Processing per-Schema purchase order invoice HR record catalog config file tax return persist validate route compile analyze transform ... ...

Example: Form Generation: 

Example: Form Generation XML instance Schema Adjunct form generator HTML form

Example: Form Generation: 

Example: Form Generation andlt;schema-adjunct target='pat-admit.xdr' xmlns:xfg='xmlformgen.xsd'andgt; andlt;element which='admission'andgt; andlt;xfg:form name='admit-form'/andgt; andlt;/elementandgt; andlt;attribute which='patient/@name'andgt; andlt;xfg:labelandgt;Patient Nameandlt;/xfg:labelandgt; andlt;xfg:typeandgt;textandlt;/xfg:typeandgt; andlt;xfg:tagandgt;patnmandlt;/xfg:tagandgt; andlt;/attributeandgt; andlt;/schema-adjunctandgt;

Schema with Embedded Adjunct: 

Schema with Embedded Adjunct andlt;Schema name = 'pat-admit.xdr' xmlns:xfg='xmlformgen.xsd'andgt; andlt;ElementType name = 'admission' content = 'eltOnly' order = 'seq' xfg:form='true'andgt; andlt;element type = 'patient'/andgt; andlt;element type = 'home'/andgt; andlt;/ElementTypeandgt; andlt;ElementType name = 'patient' content = 'textOnly'andgt; andlt;AttributeType name='name' dt:type='string' xfg:label='Patient Name' xfg:type='text' xfg:tag='patnm'/andgt; andlt;attribute type='name'/andgt; andlt;/ElementTypeandgt; andlt;/Schemaandgt;

Example: Extended Validation: 

Example: Extended Validation Schema XML instance Schema Adjunct standard validation extended validation ...

Example: Extended Validation: 

Example: Extended Validation andlt;schema-adjunct target='invoice.xdr' xmlns:xval='morevalid.xsd'andgt; andlt;documentandgt; andlt;xval:func name='checkZip' signature='...' class='...' codebase='...'/andgt; andlt;/documentandgt; andlt;element which='mailto/address'andgt; andlt;xval:test lang='xpath' level='5'andgt; checkZip( @zip, @city, @state ) = 0 andlt;/xval:testandgt; andlt;/elementandgt; andlt;/schema-adjunctandgt;

Example: Indexes in XDR: 

Example: Indexes in XDR andlt;schema-adjunct target = 'http://www.example.com/pat-admit.xsd' xmlns:sto = 'http://www.example.com/xml-store.xsd'andgt; andlt;element which = 'admission'andgt; andlt;sto:rootable/andgt; andlt;sto:indexandgt;textandlt;/sto:indexandgt; andlt;/elementandgt; andlt;element which = 'patient-name'andgt; andlt;sto:indexandgt;standardandlt;/sto:indexandgt; andlt;/elementandgt; andlt;/schema-adjunctandgt;

Example: Indexes in XDR: 

Example: Indexes in XDR Adds index definition to XDR Defined at the schema / data dictionary level, with no instance documents Instance documents are indexed by the database when stored Tight integration of two commercial products - with no shared code Libraries of Schema Adjuncts

Summary: 

Summary Schema XML instance Schema Adjunct adjunct processor ...

Summary: 

Summary purchase order invoice HR record catalog config file tax return persist validate route forms extend transform ... ...

For More Information: 

For More Information SAF toolkit freely available http://www.extensibility.com/saf Currently: DOM with Associations Next release adds SAX Specification is now being revised 'you heard the latest here!'