, the complexity of deducing a set of constraint-sets from e and ? using our inference system. We obtain the complexity by solving the following set of recursive equations
,
, ?) = 1 + |split(?)| × max (?1,?2)?split(?) (I(e 1 , ? 1 ) + I
, <?>{e}</?> : element n {? }), ?) = 2 + I
, AnyElt) * ) + I(e 2 , ?) + I
, $v in e 1 return e 2 , ?) = 1 + I(e 2 , ?) + I
, + 5)) + N (e 2 , ?) × 2 O(T (e2,?)) + N
, The cases of let-expressions and for-loop expressions include the complexity of satisfiability checks for the inferred type for the bound variable
, Lastly, we state the worst-case time complexity of our backward type inference for the XQuery core
, Assume we are given an XQuery expression e and its output type ?. Then the set of solvable constraint-sets is computed in 2 O(2 (|e|+1) |?|) time by our inference system
Since the size of the largest type in S is O(2 |e| |?|) by Lemma 5.7, for each constraint-set C in S , its satisfiability can be tested in 2 O(2 |e| |?|) time by the decision procedure in, |e| |?|) time by Lemma 5.9 ,
,
, , p.0
, By induction hypothesis on (9) with (11) and (13), we have
there exists j such that (15) f 1 ,. .. , f j?1 ? C ($v) * and thus f k ? C ($v) where k = 1,. .. , j ? 1 750 (16) f j ? C($v) (17) f j+1 ,. .. , f n ? C ($v) * and thus f k ? C ($v) where k = j + 1, Assume Quant(?) = 1. The case where Quant(?) = + is similarly proved using the following property: ? ,
, Unlike the type inference for XPath axes, the type inference for the XQuery core is only sound and not 760 complete, mainly because of the approximation introduced for for-loop expressions. From the soundness and the decidability of the inference system, From (20) and (21)
, Let e be an XQuery expression with the only free variable $doc, which denotes an input document. Let ? i be an input type (the type for $doc) and ? o an output type, Then there exists an algorithm that says yes if S ? e : ? o and ?C ? S such that C = {?} and ? i <: C($doc)
,
, W3C Recommendation, 2010.
Regular expression types for XML, ACM Trans. Program. Lang. Syst, vol.27, issue.1, pp.46-90, 2005. ,
URL : https://hal.archives-ouvertes.fr/hal-00009271
, , p.895
, XQuery 1.0 and XPath 2.0 Formal Semantics, 2010.
XML Path Language (XPath) Version 1.0, W3C Recommendation, 1999. ,
, W3C Recommendation, 2010.
, XML Path Language (XPath) 3.0, W3C Recommendation, 2014.
XQuery 3.0: An XML Query Language, W3C Recommendation, 2014. ,
Precision and complexity of XQuery type inference, Proceedings of the 13th 910 International ACM SIGPLAN Symposium on Principles and Practices of Declarative Programming, pp.89-100, 2011. ,
URL : https://hal.archives-ouvertes.fr/inria-00626217
Towards static type checking for XSLT, ACM Symposium on Document Engineering, pp.18-27, 2001. ,
Typechecking for XML transformers, Journal of Computer and System, vol.915, issue.1, pp.66-97, 2003. ,
Macro forest transducers, Inf. Process. Lett, vol.89, issue.3, pp.141-149, 2004. ,
XML type checking with macro tree transducers, Proceedings of the Twenty-fourth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database ,
, Systems, PODS '05, pp.283-294, 2005.
XML type checking using high-level tree transducer, Proceedings of the 8th International Symposium on Functional and Logic Programming, FLOPS '06, pp.81-96, 2006. ,
Towards practical typechecking for macro tree transducers, Proceedings of the 925 11th International Conference on Database Programming Languages, DBPL'07, pp.246-260, 2007. ,
URL : https://hal.archives-ouvertes.fr/inria-00126895
Macro tree transducers, Journal of Computer and System Sciences, vol.31, issue.1, pp.90066-90068, 1985. ,
The time complexity of typechecking tree-walking tree transducers, Acta Informatica, vol.930, issue.2, pp.139-154, 2009. ,
A core calculus for XQuery 3.0: Combining navigational and pattern matching approaches, Proceedings of the 24th European Symposium on Programming, pp.232-256, 2015. ,
URL : https://hal.archives-ouvertes.fr/hal-01104872
The zipper, J. Funct. Program, vol.7, issue.5, pp.549-554, 1997. ,
XQuery and static typing: Tackling the problem of backward axes, Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, pp.88-100, 2015. ,
Efficient static analysis of XML paths and types, Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 940 '07, pp.342-351, 2007. ,
XML with data values: typechecking revisited, Journal of Computer and System Sciences, vol.66, issue.4, pp.688-727, 2003. ,
XDuce: A statically typed XML processing language, ACM Trans. Internet Technol, vol.3, issue.2, pp.117-148, 2003. ,
Taxonomy of XML schema languages using formal language theory, ACM Trans. Internet Technol, vol.5, issue.4, pp.660-704, 2005. ,
Subtyping recursive types, ACM Trans. Program. Lang. Syst, vol.15, issue.4, pp.575-631, 1993. ,
URL : https://hal.archives-ouvertes.fr/inria-00070035
, One-unambiguous regular languages, Information and Computation 950, vol.140, pp.229-253, 1998.
Efficiently deciding µ-calculus with converse over finite trees, ACM Trans. Comput. Logic, vol.16, issue.2, p.41, 2015. ,
Semantic subtyping: Dealing set-theoretically with function, union, intersection, and negation types, J. ACM, vol.55, issue.4, p.1391293, 2008. ,
URL : https://hal.archives-ouvertes.fr/hal-00336120
, Combinatorics of Compositions and Words, 2009.
CDuce: An XML-centric general-purpose language, Proceedings of the Eighth ACM SIGPLAN International Conference on Functional Programming, ICFP '03, pp.51-63, 2003. ,
URL : https://hal.archives-ouvertes.fr/hal-00152619
The design space of type checkers for XML transformation languages, Proceedings of the 10th International Conference on Database Theory, ICDT '05, pp.17-36, 2005. ,
, Encyclopedia of Database Systems, pp.3646-3650, 2009.
, IEEE 30th International Conference on Data Engineering, ICDE '14, pp.952-963, 2014.
Translations on a context free grammar, Information and Control, vol.19, issue.5, pp.90706-90712, 1971. ,
DOI : 10.1145/800169.805425
XPath: Looking forward, in: XML-Based Data Management and Multimedia Engineering-EDBT, pp.109-127, 2002. ,
Forward node-selecting queries over trees, ACM Trans. Database Syst, vol.32, issue.1 ,
DOI : 10.1145/1206049.1206052
URL : http://web.comlab.ox.ac.uk/oucl/work/dan.olteanu/papers/INFOSYS-TR-2005-5.pdf
Static validation of XSL transformations, ACM Trans. Program. Lang. Syst, vol.29, issue.4 ,
XSL Transformations (XSLT) Version 1.0, W3C Recommendation, 1999. ,
Optimizing XML querying using type-based docu980 ment projection, ACM Trans. Database Syst, vol.38, issue.1, p.4, 2013. ,
DOI : 10.1145/2445583.2445587
URL : http://arxiv.org/pdf/1104.2079
Semantics, types and effects for XML updates, Proceedings of the 12th International Symposium on Database Programming Languages, DBPL '09, pp.1-17, 2009. ,
DOI : 10.1007/978-3-642-03793-1_1
URL : http://homepages.inf.ed.ac.uk/jcheney/publications/drafts/w3c-update-types-tr.pdf
XQuery Update Facility 1.0, 985 W3C recommendation, 2011. ,
Destabilizers and independence of XML updates, Proc. VLDB Endow, vol.3, issue.1-2, pp.906-917, 2010. ,
DOI : 10.14778/1920841.1920956
URL : http://www.comp.nus.edu.sg/%7Evldb2010/proceedings/files/papers/R81.pdf
MONA Version 1.4 User Manual, BRICS, 2001. ,
Deciding XPath containment with MSO, Data Knowl. Eng, vol.63, issue.1, pp.108-136, 2007. ,
Tree acceptors and some of their applications, Journal of Computer and System Sciences, vol.4, issue.5, pp.80041-80042, 1970. ,
Higher-order functions and structured datatypes, Proceedings of the 15th 995 International Workshop on the Web and Databases, pp.43-48, 2012. ,
Parametric polymorphism and semantic subtyping: The logical connection, Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, pp.107-116, 2011. ,
DOI : 10.1145/2034574.2034789
URL : https://hal.archives-ouvertes.fr/inria-00585686