1 / 16

XML XPath Formal Semantics

XML XPath Formal Semantics. XPath Type System Pontikakis Emmanuel. XPath Basics. Expressions (Queries) /books/book/author/lastname /books/book/author[address]/firstname //book[ISBN]/author. XPath Basics. XPath Processing Model. Parsing. (Step SQ 1 ) Static Context p rocessing.

alka
Télécharger la présentation

XML XPath Formal Semantics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML XPath Formal Semantics XPath Type System Pontikakis Emmanuel

  2. XPath Basics • Expressions (Queries) /books/book/author/lastname /books/book/author[address]/firstname //book[ISBN]/author CS 203 - Fall 2004

  3. XPath Basics CS 203 - Fall 2004

  4. XPath Processing Model • Parsing. • (Step SQ1) • Static Context processing. • (Steps SQ2, SQ3,SQ4) • Normalization. • (Step SQ5) • 4. Static type analysis.(Step SQ6) • Dynamic Context processing. • (Steps DQ2, DQ3) • 6. Dynamic Evaluation. (Steps DQ4, DQ5) CS 203 - Fall 2004

  5. Why Formal Semantics? • A reference for implementation, interoperability • Rigor definitions of the Language characteristics • Exact definition of relations between objects (types, elements, attributes, etc.) CS 203 - Fall 2004

  6. Semantics • Static Semantics are used to infer the type of an expression or raise an error, if there is a mismatch • Dynamic Semantics are used to map XPath expressions to the value they evaluate CS 203 - Fall 2004

  7. XML Schema and Type System • The relation between XML Schema and the formal XPath type system is given shortly by the following rules: • Formal Semantics uses formal notations for types instead of XML Schema syntax. • Formal notations are not exposed to the user. • All anonymous types are made explicit for the clarification of the semantics. • XML Schema identity constraints are not formally represented in the XPath type system. CS 203 - Fall 2004

  8. Normalization element(ElementName, TypeName) == element ElementName of type TypeName Examples: 1. element address of type xs:string { “100 Mission Str." } 2. element title of type xs:string, element year of type xs:integer CS 203 - Fall 2004

  9. The union of two element types • The "|" operator builds the "union" of two types. For example: element editor of type xs:string | element bib:author CS 203 - Fall 2004

  10. Interleaved product of types The "&" operator builds the "interleaved product" of two types. For example: (element a & element b) = element a, element b | element b, element a which specifies that the a and b elements can occur in any order. CS 203 - Fall 2004

  11. Type Derivation statEnv |- TypeName1derives fromTypeName2 Derivation is transitive. statEnv |- TypeName1 derives fromTypeName2      statEnv |- TypeName2 derives fromTypeName3 _______________________________________ statEnv |- TypeName1 derives fromTypeName3 CS 203 - Fall 2004

  12. Type Substitution statEnv |- TypeName1substitutes forTypeName2 Substitution is transitive. statEnv |- TypeName1 substitutes forTypeName2      statEnv |- TypeName2 substitutes forTypeName3 _______________________________________ statEnv |- TypeName1 substitutes forTypeName3 CS 203 - Fall 2004

  13. Type matching statEnv |- ValuematchesType element comment of type xsd:string { "This is a string" } matches element comment of type xsd:string Example: statEnv |- Value1 matchesType1 statEnv |- Value2 matchesType2 _______________________________________ statEnv |- Value1,Value2 matchesType1,Type2 CS 203 - Fall 2004

  14. Schema Definition • A type declaration with complex content: XML Schema: <xsd:complexType name="PurchaseOrderType"> <xsd:sequence> <xsd:element name="shipTo" type="USAddress"/> <xsd:element name="billTo" type="USAddress"/> <xsd:element name="items" type="Items"/> </xsd:sequence> <xsd:attribute name="orderDate" type="xsd:date"/> </xsd:complexType> CS 203 - Fall 2004

  15. Type Definition define type PurchaseOrderType { attribute orderDate of type xsd:date?, element shipTo of type USAddress, element billTo of type USAddress, element items of type Items } CS 203 - Fall 2004

  16. ευχαριστώ! CS 203 - Fall 2004

More Related