{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,1]],"date-time":"2026-10-01T14:13:59Z","timestamp":1790864039271,"version":"4.1.0"},"reference-count":45,"publisher":"Cambridge University Press (CUP)","issue":"5-6","license":[{"start":{"date-parts":[[2019,9,20]],"date-time":"2019-09-20T00:00:00Z","timestamp":1568937600000},"content-version":"unspecified","delay-in-days":19,"URL":"https:\/\/www.cambridge.org\/core\/terms"}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Theory and Practice of Logic Programming"],"published-print":{"date-parts":[[2019,9]]},"abstract":"<jats:title>Abstract<\/jats:title><jats:p>Magic sets are a Datalog to Datalog rewriting technique to optimize query answering. The rewritten program focuses on a portion of the stable model(s) of the input program which is sufficient to answer the given query. However, the rewriting may introduce new recursive definitions, which can involve even negation and aggregations, and may slow down program evaluation. This paper enhances the magic set technique by preventing the creation of (new) recursive definitions in the rewritten program. It turns out that the new version of magic sets is closed for Datalog programs with stratified negation and aggregations, which is very convenient to obtain efficient computation of the stable model of the rewritten program. Moreover, the rewritten program is further optimized by the elimination of subsumed rules and by the efficient handling of the cases where binding propagation is lost. The research was stimulated by a challenge on the exploitation of Datalog\/dlv for efficient reasoning on large ontologies. All proposed techniques have been hence implemented in the dlv system, and tested for ontological reasoning, confirming their effectiveness.<\/jats:p>","DOI":"10.1017\/s1471068419000115","type":"journal-article","created":{"date-parts":[[2019,9,20]],"date-time":"2019-09-20T13:06:21Z","timestamp":1568984781000},"page":"654-670","source":"Crossref","is-referenced-by-count":2,"title":["Enhancing Magic Sets with an Application to Ontological Reasoning"],"prefix":"10.1017","volume":"19","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-2052-2063","authenticated-orcid":false,"given":"MARIO","family":"ALVIANO","sequence":"first","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"NICOLA","family":"LEONE","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"PIERFRANCESCO","family":"VELTRI","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-6418-7711","authenticated-orcid":false,"given":"JESSICA","family":"ZANGARI","sequence":"additional","affiliation":[],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"56","published-online":{"date-parts":[[2019,9,20]]},"reference":[{"key":"S1471068419000115_ref41","first-page":"167","article-title":"On the declarative and procedural semantics of logic programs","volume":"2","author":"Przymusinski","year":"1989","journal-title":"J. Autom. Reasoning 5"},{"key":"S1471068419000115_ref23","doi-asserted-by":"crossref","unstructured":"Eiter, T. , Ortiz, M. , Simkus, M. , Tran, T. , and Xiao, G. 2012. Query rewriting for horn-shiq plus rules. In J. Hoffmann and B. Selman (Eds.), Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, July 22-26, 2012, Toronto, Ontario, Canada. AAAI Press.","DOI":"10.1609\/aaai.v26i1.8219"},{"key":"S1471068419000115_ref42","doi-asserted-by":"publisher","DOI":"10.1145\/195613.195646"},{"key":"S1471068419000115_ref36","unstructured":"Leone, N. , Allocca, C. , Alviano, M. , Calimeri, F. , Civili, C. , Costabile, R. , Cuteri, B. , Fiorentino, A. , Fusc\u00e0, D. , Germano, S. , Laboccetta, G. , Manna, M. , Perri, S. , Reale, K. , Ricca, F. , Veltri, P. , and Zangari, J. 2019. Large scale DLV: preliminary results. In A. Casagrande and E. G. Omodeo (Eds.), Proceedings of the 34th Italian Conference on Computational Logic, Trieste, Italy, June 19-21, 2019., Volume 2396 of CEUR Workshop Proceedings. CEUR-WS.org."},{"key":"S1471068419000115_ref43","doi-asserted-by":"crossref","first-page":"181","DOI":"10.1016\/S0004-3702(02)00187-X","article-title":"Extending and implementing the stable model semantics","volume":"1","author":"Simons","year":"2002","journal-title":"Artif. Intell. 138"},{"key":"S1471068419000115_ref2","doi-asserted-by":"crossref","unstructured":"Alviano, M. , Amendola, G. , Dodaro, C. , Leone, N. , Maratea, M. , and Ricca, F. 2019. Evaluation of disjunctive programs in WASP. In M. Balduccini, Y. Lierler, and S. Woltran (Eds.), Logic Programming and Nonmonotonic Reasoning - 15th International Conference, LPNMR 2019, Philadelphia, PA, USA, June 3-7, 2019, Proceedings, Volume 11481 of Lecture Notes in Computer Science, pp. 241\u2013255. Springer.","DOI":"10.1007\/978-3-030-20528-7_18"},{"key":"S1471068419000115_ref32","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068404002273"},{"key":"S1471068419000115_ref40","doi-asserted-by":"crossref","first-page":"301","DOI":"10.1017\/S1471068406002973","article-title":"Well-founded and stable semantics of logic programs with aggregates","volume":"3","author":"Pelov","year":"2007","journal-title":"Theory and Practice of Logic Programming 7"},{"key":"S1471068419000115_ref37","doi-asserted-by":"crossref","unstructured":"Leone, N. , Allocca, C. , Alviano, M. , Calimeri, F. , Civili, C. , Costabile, R. , Fiorentino, A. , Fusc\u00e0, D. , Germano, S. , Laboccetta, G. , Cuteri, B. , Manna, M. , Perri, S. , Reale, K. , Ricca, F. , Veltri, P. , and Zangari, J. 2019. Enhancing DLV for large-scale reasoning. In M. Balduccini, Y. Lierler, and S. Woltran (Eds.), Logic Programming and Nonmonotonic Reasoning - 15th International Conference, LPNMR 2019, Philadelphia, PA, USA, June 3-7, 2019, Proceedings, Volume 11481 of Lecture Notes in Computer Science, pp. 312\u2013325. Springer.","DOI":"10.1007\/978-3-030-20528-7_23"},{"key":"S1471068419000115_ref26","doi-asserted-by":"crossref","first-page":"321","DOI":"10.1016\/S0306-4379(02)00006-6","article-title":"Pushing extrema aggregates to optimize logic queries","volume":"5","author":"Furfaro","year":"2002","journal-title":"Inf. Syst. 27"},{"key":"S1471068419000115_ref34","unstructured":"Kemp, D. B. , Srivastava, D. , and Stuckey, P. J. 1995. Bottom-up evaluation and query optimization of well-founded models. Theor. Comput. Sci. 146, 1&2, 145\u2013184."},{"key":"S1471068419000115_ref38","doi-asserted-by":"publisher","DOI":"10.1016\/j.artint.2009.11.016"},{"key":"S1471068419000115_ref10","first-page":"119","article-title":"Aggregates in answer set programming","volume":"2","author":"Alviano","year":"2018","journal-title":"KI 32"},{"key":"S1471068419000115_ref31","doi-asserted-by":"crossref","first-page":"587","DOI":"10.1017\/S1471068414000222","article-title":"Vicious circle principle and logic programs with aggregates","volume":"4","author":"Gelfond","year":"2014","journal-title":"Theory and Practice of Logic Programming 14"},{"key":"S1471068419000115_ref39","unstructured":"Mumick, I. S. , Pirahesh, H. , and Ramakrishnan, R. 1990. The magic of duplicates and aggregates. In D. McLeod, R. Sacks-Davis, and H. Schek (Eds.), 16th International Conference on Very Large Data Bases, August 13-16, 1990, Brisbane, Queensland, Australia, Proceedings., pp. 264\u2013277. Morgan Kaufmann."},{"key":"S1471068419000115_ref30","unstructured":"Gelfond, M. and Lifschitz, V. 1991. Classical negation in logic programs and disjunctive databases. New Generation Comput. 9, 3\/4, 365\u2013386."},{"key":"S1471068419000115_ref28","unstructured":"Gelder, A. V. 1989. Negation as failure using tight derivations for general logic programs. J. Log. Program. 6, 1&2, 109\u2013133."},{"key":"S1471068419000115_ref22","unstructured":"Dodaro, C. , Alviano, M. , Faber, W. , Leone, N. , Ricca, F. , and Sirianni, M. 2011. The birth of a WASP: preliminary report on a new ASP solver. In F. Fioravanti (Ed.), Proceedings of the 26th Italian Conference on Computational Logic, Pescara, Italy, August 31 - September 2, 2011, Volume 810 of CEUR Workshop Proceedings, pp. 99\u2013113. CEUR-WS.org."},{"key":"S1471068419000115_ref24","doi-asserted-by":"crossref","first-page":"278","DOI":"10.1016\/j.artint.2010.04.002","article-title":"Semantics and complexity of recursive aggregates in answer set programming","volume":"1","author":"Faber","year":"2011","journal-title":"Artif. Intell. 175"},{"key":"S1471068419000115_ref9","doi-asserted-by":"crossref","first-page":"125","DOI":"10.3233\/AIC-2011-0492","article-title":"Dynamic magic sets and super-coherent answer set programs","volume":"2","author":"Alviano","year":"2011","journal-title":"AI Commun. 24"},{"key":"S1471068419000115_ref18","unstructured":"Bartholomew, M. , Lee, J. , and Meng, Y. 2011. First-order semantics of aggregates in answer set programming via modified circumscription. In Logical Formalizations of Commonsense Reasoning, Papers from the 2011 AAAI Spring Symposium, Technical Report SS-11-06, Stanford, California, USA, March 21-23, 2011. AAAI."},{"key":"S1471068419000115_ref17","doi-asserted-by":"crossref","unstructured":"Bancilhon, F. , Maier, D. , Sagiv, Y. , and Ullman, J. D. 1986. Magic sets and other strange ways to implement logic programs. In A. Silberschatz (Ed.), Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems, March 24-26, 1986, Cambridge, Massachusetts, USA, pp. 1\u201315. ACM.","DOI":"10.1145\/6012.15399"},{"key":"S1471068419000115_ref11","doi-asserted-by":"crossref","first-page":"559","DOI":"10.1017\/S1471068415000228","article-title":"Rewriting recursive aggregates in answer set programming: back to monotonicity","volume":"4","author":"Alviano","year":"2015","journal-title":"Theory and Practice of Logic Programming 15"},{"key":"S1471068419000115_ref12","unstructured":"Alviano, M. , Faber, W. , and Gebser, M. 2016. From non-convex aggregates to monotone aggregates in ASP. In S. Kambhampati (Ed.), Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pp. 4100\u20134194. IJCAI\/AAAI Press."},{"key":"S1471068419000115_ref21","doi-asserted-by":"crossref","first-page":"249","DOI":"10.1016\/0743-1066(95)00064-X","article-title":"Analyzing logic programs using \u201cPROP\u201d-ositional logic programs and a magic wand","volume":"3","author":"Codish","year":"1995","journal-title":"J. Log. Program. 25"},{"key":"S1471068419000115_ref14","doi-asserted-by":"publisher","DOI":"10.1017\/S147106841300001X"},{"key":"S1471068419000115_ref35","unstructured":"Kerisit, J. and Pugin, J. 1988. Efficient query answering on stratified databases. In FGCS, pp. 719\u2013726."},{"key":"S1471068419000115_ref33","doi-asserted-by":"crossref","first-page":"368","DOI":"10.1109\/TKDE.2003.1185840","article-title":"Binding propagation techniques for the optimization of bound disjunctive queries","volume":"2","author":"Greco","year":"2003","journal-title":"IEEE Trans. Knowl. Data Eng. 15,"},{"key":"S1471068419000115_ref3","doi-asserted-by":"crossref","unstructured":"Alviano, M. , Calimeri, F. , Dodaro, C. , Fusc\u00e0, D. , Leone, N. , Perri, S. , Ricca, F. , Veltri, P. , and Zangari, J. 2017. The ASP system DLV2. In M. Balduccini and T. Janhunen (Eds.), Logic Programming and Nonmonotonic Reasoning - 14th International Conference, LPNMR 2017, Espoo, Finland, July 3-6, 2017, Proceedings, Volume 10377 of Lecture Notes in Computer Science, pp. 215\u2013221. Springer.","DOI":"10.1007\/978-3-319-61660-5_19"},{"key":"S1471068419000115_ref4","doi-asserted-by":"publisher","DOI":"10.1017\/S147106841600020X"},{"key":"S1471068419000115_ref15","doi-asserted-by":"crossref","unstructured":"Alviano, M. , Greco, G. , and Leone, N. 2011. Dynamic magic sets for programs with monotone recursive aggregates. In J. P. Delgrande and W. Faber (Eds.), Logic Programming and Nonmonotonic Reasoning - 11th International Conference, LPNMR 2011, Vancouver, Canada, May 16-19, 2011. Proceedings, Volume 6645 of Lecture Notes in Computer Science, pp. 148\u2013160. Springer.","DOI":"10.1007\/978-3-642-20895-9_14"},{"key":"S1471068419000115_ref5","doi-asserted-by":"crossref","unstructured":"Alviano, M. and Dodaro, C. 2017. Unsatisfiable core shrinking for anytime answer set optimization. In C. Sierra (Ed.), Proceedings of the Twenty-Sixth International Joint Conference on Artificial Intelligence, IJCAI 2017, Melbourne, Australia, August 19-25, 2017, pp. 4781\u20134785. ijcai.org.","DOI":"10.24963\/ijcai.2017\/666"},{"key":"S1471068419000115_ref25","first-page":"25","article-title":"Logic programs with propositional connectives and aggregates","volume":"4","author":"Ferraris","year":"2011","journal-title":"ACM Trans. Comput. Log. 12,"},{"key":"S1471068419000115_ref45","doi-asserted-by":"crossref","unstructured":"Whaley, J. , Avots, D. , Carbin, M. , and Lam, M. S. 2005. Using datalog with binary decision diagrams for program analysis. In K. Yi (Ed.), Programming Languages and Systems, Third Asian Symposium, APLAS 2005, Tsukuba, Japan, November 2-5, 2005, Proceedings, Volume 3780 of Lecture Notes in Computer Science, pp. 97\u2013118. Springer.","DOI":"10.1007\/11575467_8"},{"key":"S1471068419000115_ref19","unstructured":"Beeri, C. and Ramakrishnan, R. 1991. On the power of magic. J. Log. Program. 10, 3&4, 255\u2013299."},{"key":"S1471068419000115_ref16","unstructured":"Balbin, I. , Port, G. S. , Ramamohanarao, K. , and Meenakshi, K. 1991. Efficient bottom-up computation of queries on stratified databases. J. Log. Program. 11, 3&4, 295\u2013344."},{"key":"S1471068419000115_ref27","doi-asserted-by":"crossref","unstructured":"Gebser, M. , Kaminski, R. , Kaufmann, B. , and Schaub, T. 2009. On the implementation of weight constraint rules in conflict-driven ASP solvers. In P. M. Hill and D. S. Warren (Eds.), Logic Programming, 25th International Conference, ICLP 2009, Pasadena, CA, USA, July 14-17, 2009. Proceedings, Volume 5649 of Lecture Notes in Computer Science, pp. 250\u2013264. Springer.","DOI":"10.1007\/978-3-642-02846-5_23"},{"key":"S1471068419000115_ref8","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068414000325"},{"key":"S1471068419000115_ref13","unstructured":"Alviano, M. , Faber, W. , Greco, G. , and Leone, N. 2012. Magic sets for disjunctive datalog programs. Artif. Intell. 187, 156\u2013192."},{"key":"S1471068419000115_ref20","doi-asserted-by":"crossref","unstructured":"Behrend, A. 2003. Soft stratification for magic set based query evaluation in deductive databases. In F. Neven, C. Beeri, and T. Milo (Eds.), Proceedings of the Twenty-Second ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, June 9-12, 2003, San Diego, CA, USA, pp. 102\u2013110. ACM.","DOI":"10.1145\/773153.773164"},{"key":"S1471068419000115_ref7","doi-asserted-by":"crossref","first-page":"301","DOI":"10.1017\/S1471068418000133","article-title":"Shared aggregate sets in answer set programming","volume":"3","author":"Alviano","year":"2018","journal-title":"Theory and Practice of Logic Programming 18"},{"key":"S1471068419000115_ref44","unstructured":"Stuckey, P. J. and Sudarshan, S. 1994. Compiling query constraints. In V. Vianu (Ed.), Proceedings of the Thirteenth ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems, May 24-26, 1994, Minneapolis, Minnesota, USA, pp. 56\u201367. ACM Press."},{"key":"S1471068419000115_ref1","first-page":"177","article-title":"The ASP system DLV: advancements and applications","volume":"2","author":"Adrian","year":"2018","journal-title":"KI 32"},{"key":"S1471068419000115_ref6","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068418000145"},{"key":"S1471068419000115_ref29","first-page":"620","article-title":"The well-founded semantics for general logic programs","volume":"3","author":"Gelder","year":"1991","journal-title":"J. ACM 38"}],"container-title":["Theory and Practice of Logic Programming"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.cambridge.org\/core\/services\/aop-cambridge-core\/content\/view\/S1471068419000115","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2022,9,29]],"date-time":"2022-09-29T04:42:07Z","timestamp":1664426527000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.cambridge.org\/core\/product\/identifier\/S1471068419000115\/type\/journal_article"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2019,9]]},"references-count":45,"journal-issue":{"issue":"5-6","published-print":{"date-parts":[[2019,9]]}},"alternative-id":["S1471068419000115"],"URL":"https:\/\/doi.org\/10.1017\/s1471068419000115","relation":{},"ISSN":["1471-0684","1475-3081"],"issn-type":[{"value":"1471-0684","type":"print"},{"value":"1475-3081","type":"electronic"}],"subject":[],"published":{"date-parts":[[2019,9]]}}}