monotonequery term transformations.
• ifqhas incomplete subterm specification, it may be transformed to the analogous query term with complete subterm specification.
a{{q1,. . .,qn}}
a{q1,. . .,qn} ,
a[[q1,. . .,qn]]
a[q1,. . .,qn] (
8.1) • ifqhas unordered subterm specification, it may be transformed to the
analogous query term with ordered subterm specification. a{{q1,. . .,qn}}
a[[q1,. . .,qn]],
a{q1,. . .,qn}
a[q1,. . .,qn] (
8.2) • ifqis of the formdesc q0then the descendant construct may be elimi- nated or it may be split into two descendant constructs separated by the regular expression/.*/, the inner descendant construct being wrapped in double curly braces.
descq q ,
descq
desc /.∗/{{desc q}} (8.3) • ifqhas incomplete-unordered subterm specification, then a fresh vari- ableXmay be appended to the end of the subterm list. Afreshvariable is a variable that does not occur inq1orq2and is not otherwise intro-
duced by the rewriting system.
Xfresh⇒ a{{q1,. . .,qn}},
a{{q1,. . .,qn,var X}} (
168 x c e r p t q u e r y t e r m s u b s u m p t i o n a{{ b{c, var X}, desc d, without e{{ f }} }} a{{ b{c, var X}, desc d, without e{{ f }}, var Y }} a{{ b{var X, c}, /.*/{{ desc d }}, without e{{ f }}, var Y }} a{{ b{var X, c}, g{{ desc d }}, var Y, without e{{ f }} }} a{{ b{var X, c}, g{{ /.*/{{ desc d }} }}, var Y, without e{{ f }} }} a{{ b{var X, c}, g{{ h{{ d }} }}, var Y, without e{{ f }} }} a{ b{var X, c}, g{{ h{{ d }} }}, var Y, without e{{ f }} } a{ b{var X, c}, g{{ h{{ d }} }}, i{ }, without e{{ }} } Equation8.4 Equations8.3,8.6,8.9 Equations8.10,8.6 Equation8.3 Equation8.10 Equation8.1 Equation8.8,8.11,8.9
• ifqhas incomplete-ordered subterm specification, then a fresh variable may be inserted at the beginning, at the end, or in between two subterms ofq:
Xfresh,i∈{1,. . .,n}⇒
a[[q1,. . .,qn]],
a[[q1,. . .,qi,var X,qi+1,. . .,qn]]
(8.5)
• ifqhas unordered subterm specification, then the subterms ofqmay be arbitrarily permuted. π∈Perms({1,. . .,n})⇒ a{{q1, ..., qn}} a{{qπ(1), ..., qπ(n)}} ( 8.6) π∈Perms({1,. . .,n})⇒ a{q1, ..., qn} a{qπ(1), ..., qπ(n)} ( 8.7)
• ifqcontains a variablevar X, which occurs inqat least once in a pos- itive context (i.e. not within the scope of a without) then all occurrences ofvar Xmay be substituted by another Xcerpt query term.
X∈PV(q),t∈QT erms⇒ q
8.3 s i m u l at i o n s u b s u m p t i o n b y r e w r i t i n g 169
This rule may only be applied, ifqcontainsalloccurrences ofXinq1.
Furthermore, no further rewriting rules may be applied to the replace- ment termt.
If a variable appears withinqonly in a negative context (i.e. within the scope of awithout), the variable cannot be substituted by an arbitrary term to yield a transformed term that is subsumed by q. The query terms a{{ without var X }} and a{{ without b{ } }} together with the data terma{ c }illustrate this characteristic of the subsump- tion relationship. For further discussion of substitution of variables in a negative context see Example39.
• ifqhas a subtermqi, thenqimay be transformed by any of the trans- formations in this list except for Equation8.8 to the termt(qi), and
this transformed version may be substituted at the place ofqi inq, as
formalized by the following rule:2 3
qi
t(qi) ⇒
a{{q1,. . .,qn}}
a{{q1,. . .,qi−1,t(qi),qi+1,. . . qn}} (
8.9) • if the label ofqis a regular expressione, this regular expression may be replaced by any label that matches withe, or any other regular expres- sione0which is subsumed bye(see Definition57).2
e∈RE,e subsumes e’⇒ e{{q1,. . .,qn}}
e0{{q1,. . .,qn}}
(8.10)
• ifqcontains a negated subtermqi =withoutrandr0is a query term
such thatt(r0) =r(i.e.r0subsumesr) for some transformation stept, thenqican be replaced byqi0:=withoutr0.4
(qi=withoutr)∧ r0 r ∧(q 0 i=withoutr0) ⇒ a{{q1,. . .,qi,. . .,qn}} a{{q1,. . .,qi0,. . . qn}} (8.11)
• ifqis breadth-complete and contains a negated subterm, this subterm may simply be omitted:5
(qi=withoutr),i∈{1,. . .,n} ⇒ a{q1,. . .,qi,. . .,qn}
a{q1,. . .,qi−1,qi+1. . . qn}
(8.12) 2 The respective rules for complete-unordered subterm specification, incomplete-ordered subterm specification and complete-ordered subterm specification are omitted for the sake of brevity.
3 The exclusion of Equation8.8ensures that variable substitutions are only applied to entire
query terms and not to subterms. Otherwise the same variable might be substituted by different terms in different subterms.
4 The respective transformation rule for ordered-incomplete query terms is omitted for the sake of brevity. Since negated subterms in complete query terms are irrelevant, we assume complete subterms to not contain negated subterms. Alternatively, these terms can be transformed by Rule8.12
5 The respective rule for ordered-complete query term specification is omitted for the sake of brevity.
170 x c e r p t q u e r y t e r m s u b s u m p t i o n
• if q is breadth-incomplete and contains two negated subterms s1 =
withouts10 ands2 =withouts20 such thats10 =t(s20)for some trans-
formation stept, thens1can be omitted fromq.
8.4 p r o p e r t i e s o f t h e r e w r i t i n g s y s t e m
In this section, we show that the rewriting system introduced in the previous section is sound (Section8.4.1) and complete (Section8.4.2). Furthermore, we study the structure of the search tree induced by the rewriting rules, show that it can be pruned without losing the completeness of the rewriting system and conclude that simulation subsumption is decidable. Finally we derive complexity results from the size of the search tree in Section8.4.3.
8.4.1 Subsumption Monotonicity and Soundness
Lemma11(Monotonicity of the transformations in Definition75). All of