Inconsistent Path Detection for XML IDEs Pierre Genevs Nabil Layada - - PowerPoint PPT Presentation

inconsistent path detection for xml ides
SMART_READER_LITE
LIVE PREVIEW

Inconsistent Path Detection for XML IDEs Pierre Genevs Nabil Layada - - PowerPoint PPT Presentation

Inconsistent Path Detection for XML IDEs Pierre Genevs Nabil Layada CNRS INRIA May 25 th , 2011 33 rd International Conference on Software Engineering Honolulu, HI, USA . A Simple XQuery Program Generate alerts for news related to stocks


slide-1
SLIDE 1

Inconsistent Path Detection for XML IDEs

Pierre Genevès Nabil Layaïda

CNRS INRIA

May 25th, 2011 33rd International Conference on Software Engineering Honolulu, HI, USA

.

slide-2
SLIDE 2

A Simple XQuery Program

Generate alerts for news related to stocks in portfolio:

for $s in doc("portfolio.xml")//stocks/stock for $line in doc("news.xml")/news/headline where contains($line, $s/name) return <alert>{$s/ticker, $line/parent::*/summary}</alert>

portfolio stock ticker qty QQQ 100

+

<alert>QQQ, Nasdaq falls...</alert>

Search, selection and information extraction done using XPath expressions

Pierre Genevès (CNRS, France) Inconsistent Path Detection for XML IDEs 05.25.2011 – ICSE’11 2 / 7

slide-3
SLIDE 3

Zoom on XPath Expressions

General form: (axis::nodetest[filter]′/′)n

a selected node context node

self a n c e s t

  • r

descendant preceding f

  • l

l

  • w

i n g following-sibling preceding-sibling child parent

Succinct but very powerful Describe binary relations between context and selected nodes Standard recommended by the W3 Consortium Central component (XSLT, XQuery, XML Schema, XPointer...)

Pierre Genevès (CNRS, France) Inconsistent Path Detection for XML IDEs 05.25.2011 – ICSE’11 3 / 7

slide-4
SLIDE 4

The Path Consistency Problem

In real life, XML data are complex and queried using complex paths Paths are error-prone for programmers Two types of inconsistencies:

self-contradicting paths paths violating schema constraints (more frequent since path and schemas are updated independently)

a/b[following-sibling::c/parent::d] self::a/child::e a[b*,c,d+]

Inconsistencies are hard to detect → Detect path inconsistencies automatically → Detect them all (be sound and complete)

Pierre Genevès (CNRS, France) Inconsistent Path Detection for XML IDEs 05.25.2011 – ICSE’11 4 / 7

slide-5
SLIDE 5

The Path Consistency Problem: Formal Overlook

An expression e, evaluated from a context node x in a tree t, returns a set of matching nodes e(t, x) XPath expression e is inconsistent ⇔ ∀t ∀x ∈ t, e(t, x) = ∅ e is inconsistent in the presence of s ⇔ ∀t ⊢ s ∀x ∈ t, e(t, x) = ∅ The problem of determining whether an XPath expression is inconsistent is:

Undecidable for XPath in general EXPTIME for the navigational core fragment of XPath (CXPath ↔ first-order logic over trees) EXPTIME for CXPath in the presence of schemas (regular tree grammars ↔ monadic second-order logic over trees)

Pierre Genevès (CNRS, France) Inconsistent Path Detection for XML IDEs 05.25.2011 – ICSE’11 5 / 7

slide-6
SLIDE 6

Proposed Approach

CXPath expression e Schema s Parsing and compilation (linear time) ϕe ∧ ϕs Logical formula ϕ Satisfiability check (2O(|ϕ|) time) ϕ is satisfiable ϕ is unsatisfiable: e is inconsistent in the presence of s

Reduction to satisfiability of a unifying tree logic:

The µ-calculus with converse of finite trees of [Geneves-PLDI07] CXPath expressions and schemas are compiled linearly into the logic Formula ϕ is checked for satisfiability in time complexity 2O(|ϕ|) Exact algorithm (sound and complete) The core logical solver is available online: http://wam.inrialpes.fr/websolver

Pierre Genevès (CNRS, France) Inconsistent Path Detection for XML IDEs 05.25.2011 – ICSE’11 6 / 7

slide-7
SLIDE 7

Other Applications and Demo

Dead code elimination (e.g. loops over inconsistent paths)

for $x in //news[article]/headline return { ... }

← − inconsistent w.r.t schema ← − dead code Code optimization (e.g. removing redundancies in path expressions) (the decision procedure can also check path equivalence) First IDE for XML augmented with static detection of inconsistent paths (demo)

Pierre Genevès (CNRS, France) Inconsistent Path Detection for XML IDEs 05.25.2011 – ICSE’11 7 / 7