Learning Concise Relax NG Schemas Supporting Interleaving from XML Documents

  • Yeting Li
  • Xiaoying Mou
  • Haiming ChenEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11323)


Relax NG is a popular and powerful schema language for XML, which concerns the relative order among the elements. Since many XML documents in practice either miss schemas or lack valid schemas, we focus on inferring a concise Relax NG from some XML documents. The fundamental task of Relax NG inference is learning regular expressions. Previous work in this direction lacks support of all operators allowed in Relax NG especially for interleaving. In this paper, by analysis of large-scale real-world Relax NG, we propose a restricted subclass of regular expressions called chain regular expressions with interleaving (ICREs). Meanwhile, we develop a learning algorithm to infer a descriptive generalized ICRE from XML samples, based on single occurrence automata and the maximum clique. We conduct experiments on real benchmark from DBLP. Experimental results show that ICREs are expressive enough to cover the vast majority of practical Relax NG. Our algorithm can effectively learn from small and large dataset, and our results are concise and more precise than other popular methods.


Relax NG Regular expressions Interleaving XML documents Schema inference 


  1. 1.
    Abiteboul, S., Buneman, P., Suciu, D.: Data on the Web: from Relations to Semistructured Data and XML. Morgan Kaufmann, Burlington (2000)Google Scholar
  2. 2.
    Barbosa, D., Mignet, L., Veltri, P.: Studying the XML web: gathering statistics from an XML sample. World Wide Web-Internet Web Inf. Syst. 9(2), 187–212 (2006)CrossRefGoogle Scholar
  3. 3.
    Beek, M.H.T., Kleijn, J.: Infinite unfair shuffles and associativity. Theor. Comput. Sci. 380(3), 401–410 (2007)MathSciNetCrossRefGoogle Scholar
  4. 4.
    Bex, G.J., Gelade, W., Neven, F., Vansummeren, S.: Learning deterministic regular expressions for the inference of schemas from XML data. ACM Trans. Web 4(4), 1–32 (2010)CrossRefGoogle Scholar
  5. 5.
    Bex, G.J., Neven, F., Bussche, J.V.D.: DTDs versus XML schema: a practical study. In: International Workshop on the Web and Databases, pp. 79–84 (2004)Google Scholar
  6. 6.
    Bex, G.J., Neven, F., Schwentick, T., Vansummeren, S.: Inference of concise regular expressions and DTDs. ACM Trans. Database Syst. 35(2), 1–47 (2010)CrossRefGoogle Scholar
  7. 7.
    Bex, G.J., Neven, F., Vansummeren, S.: Inferring XML schema definitions from XML data. In: International Conference on Very Large Data Bases, University of Vienna, Austria, September, pp. 998–1009 (2007)Google Scholar
  8. 8.
    Boneva, I., Ciucanu, R., Staworko, S.: Simple schemas for unordered XML. In: International Workshop on the Web and Databases (2015)Google Scholar
  9. 9.
    Brüggemann-Klein, A.: Unambiguity of extended regular expressions in SGML document grammars. In: Lengauer, T. (ed.) ESA 1993. LNCS, vol. 726, pp. 73–84. Springer, Heidelberg (1993). Scholar
  10. 10.
    Che, D., Aberer, K., Özsu, M.T.: Query optimization in XML structured-document databases. VLDB J. 15(3), 263–289 (2006)CrossRefGoogle Scholar
  11. 11.
    Ciucanu, R., Staworko, S.: Learning schemas for unordered XML. Computer Science (2013)Google Scholar
  12. 12.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn, p. 1297C1305 (2001)Google Scholar
  13. 13.
    Demany, D.: InstanceToSchema: a RELAX NG schema generator from XML instances (2003).
  14. 14.
    Feige, U.: Approximating maximum clique by removing subgraphs. SIAM J. Discret. Math. 18(2), 219–225 (2006)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Fernau, H.: Algorithms for learning regular expressions. Inf. Comput. 207(4), 521–541 (2009)CrossRefGoogle Scholar
  16. 16.
    Florescu, D.: Managing semi-structured data. ACM Queue 3(8), 18–24 (2005)CrossRefGoogle Scholar
  17. 17.
    Freydenberger, D.D., Kötzing, T.: Fast learning of restricted regular expressions and DTDs. Theory Comput. Syst. 57(4), 1114–1158 (2015)MathSciNetCrossRefGoogle Scholar
  18. 18.
    Garcia, P., Vidal, E.: Inference of k-testable languages in the strict sense and application to syntactic pattern recognition. IEEE Trans. Pattern Anal. Mach. Intell. 12(9), 920–925 (2002)CrossRefGoogle Scholar
  19. 19.
    Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, New York (1979)zbMATHGoogle Scholar
  20. 20.
    Garofalakis, M., Gionis, A., Shim, K., Shim, K., Shim, K.: XTRACT: learning document type descriptors from XML document collections. Data Mining Knowl. Discov. 7(1), 23–56 (2003)MathSciNetCrossRefGoogle Scholar
  21. 21.
    Garofalakis, M.N., Gionis, A., Rastogi, R., Seshadri, S., Shim, K.: XTRACT: a system for extracting document type descriptors from XML documents. In: Proceedings of the 2000 ACM SIGMOD International Conference on Management of Data, Dallas, Texas, USA, 16–18 May 2000, pp. 165–176 (2000)Google Scholar
  22. 22.
    Gold, E.M.: Language identification in the limit. Inf. Control 10(5), 447–474 (1967)MathSciNetCrossRefGoogle Scholar
  23. 23.
    Grijzenhout, S., Marx, M.: The quality of the XML web. Web Semant.: Sci. Serv. Agents World Wide Web 19, 59–68 (2013)CrossRefGoogle Scholar
  24. 24.
    Hopcroft, J.E., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation. Addison-Wesley Series in Computer Science, 2nd edn. Addison-Wesley-Longman, Boston (2001). ISBN: 978-0-201-44124-6zbMATHGoogle Scholar
  25. 25.
    Clark, J., Murata, M.: Organization for the Advancement of Structured Information Standards (OASIS). Relax NG specification (2001)Google Scholar
  26. 26.
    Kim, G.-H., Ko, S.-K., Han, Y.-S.: Inferring a relax NG schema from XML documents. In: Dediu, A.-H., Janoušek, J., Martín-Vide, C., Truthe, B. (eds.) LATA 2016. LNCS, vol. 9618, pp. 400–411. Springer, Cham (2016). Scholar
  27. 27.
    Koch, C., Scherzinger, S., Schweikardt, N., Stegmaier, B.: Schema-based scheduling of event processors and buffer minimization for queries on structured data streams. In: Thirtieth International Conference on Very Large Data Bases, pp. 228–239 (2004)CrossRefGoogle Scholar
  28. 28.
    Manolescu, I., Florescu, D., Kossmann, D.: Answering XML queries on heterogeneous data sources. In: International Conference on Very Large Data Bases, pp. 241–250 (2001)Google Scholar
  29. 29.
    Martens, W., Neven, F.: Typechecking top-down uniform unranked tree transducers. In: International Conference on Database Theory, pp. 64–78 (2003)Google Scholar
  30. 30.
    Martens, W., Neven, F.: Frontiers of tractability for typechecking simple XML transformations. In: ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, pp. 23–34 (2004)Google Scholar
  31. 31.
    Peng, F., Chen, H.: Discovering restricted regular expressions with interleaving. In: Cheng, R., Cui, B., Zhang, Z., Cai, R., Xu, J. (eds.) APWeb 2015. LNCS, vol. 9313, pp. 104–115. Springer, Cham (2015). Scholar
  32. 32.
    Quinlan, J.R., Rivest, R.L.: Inferring decision trees using the minimum description length principle. Inf. Comput. 80(3), 227–248 (1989)MathSciNetCrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  1. 1.State Key Laboratory of Computer ScienceInstitute of Software, Chinese Academy of SciencesBeijingChina
  2. 2.University of Chinese Academy of SciencesBeijingChina

Personalised recommendations