Presentation is loading. Please wait.

Presentation is loading. Please wait.

XPath Help Karl Lieberherr. Source of information / Plan 20050915/http://www.w3.org/TR/2005/WD-xpath20- 20050915/

Similar presentations


Presentation on theme: "XPath Help Karl Lieberherr. Source of information / Plan 20050915/http://www.w3.org/TR/2005/WD-xpath20- 20050915/"— Presentation transcript:

1 XPath Help Karl Lieberherr

2 Source of information / Plan http://www.w3.org/TR/2005/WD-xpath20- 20050915/http://www.w3.org/TR/2005/WD-xpath20- 20050915/ Complex definition We want to extract the “static” part of XPath Objective: Use / and /+/ (//) to build sequences and use operators: union, intersection and except to combine them.

3 Mismatches XPath can work without schema. But we want to visualize XPath expression in schema. Works only for “static” XPath expressions XPath views meaning of expression as a sequence. Strategies views the meaning of an expression as a function that maps objects to object graph slices. Traversing slice: sequence of nodes.

4 Mismatches But we can also view the meaning of a strategy and a class graph as another graph: TraversalGraph

5 XPath data model In the data model, a value is always a sequence. A sequence is an ordered collection of zero or more items. An item is either an atomic value or a node. singleton, empty sequence. Sequences are never nested.

6 EBNF for XPath [26] PathExpr ::= ("/" RelativePathExpr?) | ("//" RelativePathExpr) | RelativePathExprPathExpr RelativePathExpr [27] RelativePathExpr ::= StepExpr (("/" | "//") StepExpr)*RelativePathExprStepExpr [28] StepExpr ::= AxisStep | FilterExprStepExprAxisStepFilterExpr

7 Class dictionaries / EBNF exercise3.txt class dictionaries are both a simplification and extension of EBNF.

8 EBNF for XPath [30] ForwardStep ::= (ForwardAxis NodeTest) | AbbrevForwardStepForwardStepForwardAxis NodeTestAbbrevForwardStep [31] ForwardAxis ::= | | | | | | | ForwardAxis

9 EBNF for XPath 3.3.3 Combining Node Sequences [14] UnionExpr ::= IntersectExceptExpr ( ("union" | "|") IntersectExceptExpr )*UnionExprIntersectExceptExpr [15] IntersectExceptExpr ::= Instanceof Expr ( ("intersect" | "except") InstanceofExpr )*IntersectExceptExprInstanceof Expr InstanceofExpr [16] InstanceofExpr::= PathExprInstanceofExprPathExpr

10 sequence operations XPath provides the following operators for combining sequences of nodes: The union and | operators are equivalent. They take two node sequences as operands and return a sequence containing all the nodes that occur in either of the operands. The intersect operator takes two node sequences as operands and returns a sequence containing all the nodes that occur in both operands. The except operator takes two node sequences as operands and returns a sequence containing all the nodes that occur in the first operand but not in the second operand.

11 sequence operations $seq1 is bound to (A, B) $seq2 is bound to (A, B) $seq3 is bound to (B, C) Then: $seq1 union $seq2 evaluates to the sequence (A, B). $seq2 union $seq3 evaluates to the sequence (A, B, C). $seq1 intersect $seq2 evaluates to the sequence (A, B). $seq2 intersect $seq3 evaluates to the sequence containing B only. $seq1 except $seq2 evaluates to the empty sequence. $seq2 except $seq3 evaluates to the sequence containing A only.

12 Declare context node type what is meaning of / B and /+/ B?

13 Mixing strategies and XPath?? what would the meaning be of: –s1 : from A via B to C –s2 : A /+/ D –union (s1 s2)


Download ppt "XPath Help Karl Lieberherr. Source of information / Plan 20050915/http://www.w3.org/TR/2005/WD-xpath20- 20050915/"

Similar presentations


Ads by Google