Title: Beyond Schemas
1Beyond Schemas
- Extending Schemas with the Schema Adjunct
Framework
Scott Vorthmann, Extensibility Jonathan Robie,
Software AG
2Extending 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
3DTDs associate, validate
ltcustomergt ltcustNamegt lt/custNamegt
4DTDs associate, validate
lt!ELEMENT customer (name , shippingAddress ,
bi lt!ELEMENT name (PCDATA)gt
ltcustomergt ltcustNamegt lt/custNamegt
5DTDs associate, validate
lt!ELEMENT customer (name , shippingAddress ,
bi lt!ELEMENT name (PCDATA)gt
ltcustomergt ltcustNamegt lt/custNamegt
6Java associate, validate
checkCreditRating(n)
ltcustomergt ltcustNamegt lt/custNamegt
7Query associate, validate
empty ( FROM d IN //deadbeats,
c IN this WHERE d/name
this/name RETURN d )
ltcustomergt ltcustNamegt lt/custNamegt
8DTDs associate, enhance
lt!ELEMENT collection (item )gt lt!ATTLIST
collection ordered (true
false ) 'true' duplicates
(allowed prohibited ) 'allowed' gt
ltcollectiongt ltitemgt Hi Mom! lt/itemgt
ltitemgt Hi Dad! ltitem /gt lt/collectiongt
9DTDs associate, enhance
lt!ELEMENT collection (item )gt lt!ATTLIST
collection ordered (true
false ) 'true' duplicates
(allowed prohibited ) 'allowed' gt
ltcollection orderedfalse duplicatesallowed
gt ltitemgt Hi Mom! lt/itemgt
ltitemgt Hi Dad! ltitem /gt lt/collectiongt
10Schemas associate, enhance
ltelement name "person"gt
ltcomplexType content "elementOnlygt
ltsequencegt ltelement ref "name"/gt
ltelement ref "iq"/gt
ltelement ref "gender"/gt
lt/sequencegt lt/complexTypegt
lt/elementgt ltsimpleType name "iq" base
"decimal"/gt
11Schemas associate, enhance
ltpersongt ltnamegtAlexander B. Poindexterlt/namegt
ltiqgt53lt/iqgt ltgendergtMalelt/gendergt lt/persongt
12Schemas associate, enhance
ltsimpleType name "iq" base "decimal"/gt
ltpersongt ltnamegtAlexander B. Poindexterlt/namegt
ltiqgt53lt/iqgt ltgendergtMalelt/gendergt lt/persongt
Basedecimal!
13Whats not in a schema language?
- Database mappings?
- Algorithmic validation?
- Indexing strategies?
- Data bindings to OO systems?
- Does it ever stop?
- Data types?
- Input masks?
- Boundary conditions?
- Uniqueness constraints?
- Primary/foreign keys?
- Inheritance models?
- Co-occurrence constraints?
14In fact, just yesterday...
- Makoto MURATA, Relaxer
- Name mapping XML lt--gt Java
- Specifying alternative mappings (e.g. choosing
which container type) - Identifying the location of earlier versions of
definitions
15Schema 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
16Adjuncts and Associations
ltschema-adjunct target"http//www.example.com/pat
-admit.xdr" xmlnssto
"http//www.example.com/xml-store.xsd"gt ltelement
which 'admission'gt ltstorootable/gt
ltstoindexgttextlt/stoindexgt lt/elementgt
lt/schema-adjunctgt
17Associations
ltschema-adjunct target"http//www.example.com/pat
-admit.xdr" xmlnssto
"http//www.example.com/xml-store.xsd"gt ltelement
which 'admission'gt ltstorootable/gt
ltstoindexgttextlt/stoindexgt lt/elementgt
lt/schema-adjunctgt
lt?xml version"1.0"?gt ltSchema name"pat-admit.xdr
"gt ltElementType name"admission"
content"eltOnly" order"seq"gt ltAttributeType
name"id" dttype"string" required"yes /gt
ltattribute type"id"/gt ltelement
type"patient-name"/gt ltelement
type"age"/gt lt/ElementTypegt lt/Schemagt
18Associations
ltschema-adjunct target"http//www.example.com/pat
-admit.xdr" xmlnssto
"http//www.example.com/xml-store.xsd"gt ltelement
which 'admission'gt ltstorootable/gt
ltstoindexgttextlt/stoindexgt lt/elementgt
lt/schema-adjunctgt
Isnt this a lot like XSLT?
19SAF 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
20SAF Implementations
- DOM
- NodeList assoc sa.getAssociations(node)
- XSLT
- lttemplate matchassociations(index)gt
- SAX
- extending the events
21Schema 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
22Schema Adjunct Syntax
- ltschema-adjunct targettarget NS URI
xmlnsprocprocessor NS URIgt - ltdocumentgt
- ltprocglobal-meta-data/gt
- lt/documentgt
- ltelement whichelement1/element2gt
- ltprocsome-meta-data/gt
- lt/elementgt
- ltattribute whichelement3/_at_attr1gt
- ltprocmore-meta-data/gt
- lt/attributegt
- lt!-- more element and attribute associations --gt
- lt/schema-adjunctgt
23Schema Lock-in
XML PO
PO persist
DB
24Schema-generic Processing
Schema Adjunct
XML instance
generic persist
DB
25Schema Adjunct Processors
Schema Adjunct
Schema
XML instance
adjunct processor
...
26Enabling Processing per-Schema
persist
route
compile
...
validate
analyze
transform
purchase order
invoice
HR record
catalog
config file
tax return
...
27Example Form Generation
Schema Adjunct
XML instance
form generator
HTML form
28Example Form Generation
- ltschema-adjunct targetpat-admit.xdr
xmlnsxfgxmlformgen.xsdgt - ltelement whichadmissiongt
- ltxfgform nameadmit-form/gt
- lt/elementgt
- ltattribute whichpatient/_at_namegt
- ltxfglabelgtPatient Namelt/xfglabelgt
- ltxfgtypegttextlt/xfgtypegt
- ltxfgtaggtpatnmlt/xfgtaggt
- lt/attributegt
- lt/schema-adjunctgt
29Schema with Embedded Adjunct
- ltSchema name "pat-admit.xdr
xmlnsxfgxmlformgen.xsdgt - ltElementType name admission" content
"eltOnly - order "seq" xfgformtrue"gt
- ltelement type patient"/gt
- ltelement type "home"/gt
- lt/ElementTypegt
- ltElementType name patient" content
"textOnly"gt - ltAttributeType namename dttypestring
- xfglabelPatient Name xfgtypetext
xfgtagpatnm/gt - ltattribute typename/gt
- lt/ElementTypegt
- lt/Schemagt
30Example Extended Validation
Schema Adjunct
Schema
XML instance
standard validation
extended validation
...
31Example Extended Validation
- ltschema-adjunct targetinvoice.xdr
xmlnsxvalmorevalid.xsdgt - ltdocumentgt
- ltxvalfunc namecheckZip signature...
- class... codebase.../gt
- lt/documentgt
- ltelement whichmailto/addressgt
- ltxvaltest langxpath level5gt
- checkZip( _at_zip, _at_city, _at_state ) 0
- lt/xvaltestgt
- lt/elementgt
- lt/schema-adjunctgt
32Example Indexes in XDR
- ltschema-adjunct target "http//www.example.com/p
at-admit.xsd" - xmlnssto "http//www.example.c
om/xml-store.xsd"gt -
- ltelement which 'admission'gt
- ltstorootable/gt
- ltstoindexgttextlt/stoindexgt
- lt/elementgt
- ltelement which 'patient-name'gt
- ltstoindexgtstandardlt/stoindexgt
- lt/elementgt
- lt/schema-adjunctgt
33Example 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
34Summary
Schema Adjunct
Schema
XML instance
adjunct processor
...
35Summary
persist
route
forms
...
validate
extend
transform
purchase order
invoice
HR record
catalog
config file
tax return
...
36For 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!