Detecting and Optimizing Flawed Queries in Triplestore-Based Knowledge Systems Using Reinforcement Learning
Reinforcement Learning for Secure SPARQL Query Optimization
Received: 29 June 2025 | Revised: 14 August 2025, 10 September 2025, 30 September 2025, 7 October 2025, and 10 November 2025 | Accepted: 11 November 2025 | Online: 9 February 2026
Corresponding author: Mourad M. H. Henchiri
Abstract
This study uses Reinforcement Learning (RL) to predict flawed SPARQL Protocol and Resource Description Framework Query Language (SPARQL) queries and optimize them by suggesting structural modifications and tuning execution parameters in triplestore-based knowledge systems, verified on smart car parking and medical datasets. The RL agent is trained not only to detect poorly performing queries but also to recommend query rewrites that improve completeness and efficiency. Applied to a medical knowledge base focused on Fahr's disease, the system achieved an 89% detection accuracy and significantly reduced average query time and timeout rates, demonstrating the potential of Artificial Intelligence (AI) to enhance both the quality and speed of query processing in sensitive semantic web databases.
Keywords:
triplestore, SPARQL, AI, RL, DO, CybersecurityDownloads
References
I. Al Agha and O. El-Radie, "Towards Verbalizing SPARQL Queries in Arabic," Engineering, Technology & Applied Science Research, vol. 6, no. 2, pp. 937–944, Apr. 2016. DOI: https://doi.org/10.48084/etasr.630
J. Piñero et al., "The DisGeNET knowledge platform for disease genomics: 2019 update," Nucleic Acids Research, vol. 48, no. D1, pp. D845–D855, Jan. 2020.
J. Piñero et al., "DisGeNET: a discovery platform for the dynamical exploration of human diseases and their genes," Database, vol. 2015, Jan. 2015, Art. no. bav028. DOI: https://doi.org/10.1093/database/bav028
A. Mavridis, S. Tegos, C. Anastasiou, M. Papoutsoglou, and G. Meditskos, "Large language models for intelligent RDF knowledge graph construction: results from medical ontology mapping," Frontiers in Artificial Intelligence, vol. 8, Apr. 2025, Art. no. 1546179. DOI: https://doi.org/10.3389/frai.2025.1546179
G. Singh, S. Bhatia, and R. Mutharaju, "Chapter 2. Neuro-Symbolic RDF and Description Logic Reasoners: The State-Of-The-Art and Challenges," in Frontiers in Artificial Intelligence and Applications, P. Hitzler, M. K. Sarker, and A. Eberhart, Eds. IOS Press, 2023. DOI: https://doi.org/10.3233/FAIA230134
"The Linked Open Data Cloud." https://lod-cloud.net/.
"DISGENET: Genomics Platform for Precision Medicine." https://www.disgenet.com.
C. J. C. H. Watkins and P. Dayan, "Q-learning," Machine Learning, vol. 8, no. 3, pp. 279–292, May 1992. DOI: https://doi.org/10.1023/A:1022676722315
G. A. Rummery and M. Niranjan, "On‐line Q‐learning using connectionist systems," Technical Report CUED/F-INFENF/TR, 1994.
R. S. Sutton, D. McAllester, S. Singh, and Y. Mansour, "Policy Gradient Methods for Reinforcement Learning with Function Approximation," in Advances in Neural Information Processing Systems, 1999, vol. 12.
V. Mnih et al., "Playing Atari with Deep Reinforcement Learning." arXiv, Dec. 19, 2013.
D. Silver, G. Lever, N. Heess, T. Degris, D. Wierstra, and M. Riedmiller, "Deterministic Policy Gradient Algorithms," in Proceedings of the 31st International Conference on Machine Learning, Jan. 2014, pp. 387–395.
"SmartSantander." https://smartsantander.eu/.
S. Krishnan, Z. Yang, K. Goldberg, J. Hellerstein, and I. Stoica, "Learning to Optimize Join Queries With Deep Reinforcement Learning." arXiv, Jan. 10, 2019.
R. Marcus and O. Papaemmanouil, "Deep Reinforcement Learning for Join Order Enumeration," in Proceedings of the First International Workshop on Exploiting Artificial Intelligence Techniques for Data Management, Houston, TX, USA, Mar. 2018, pp. 1–4. DOI: https://doi.org/10.1145/3211954.3211957
G. Li, X. Zhou, S. Li, and B. Gao, "QTune: a query-aware database tuning system with deep reinforcement learning," Proceedings of the VLDB Endowment, vol. 12, no. 12, pp. 2118–2130, May 2019. DOI: https://doi.org/10.14778/3352063.3352129
J. Zhang et al., "An End-to-End Automatic Cloud Database Tuning System Using Deep Reinforcement Learning," in Proceedings of the 2019 International Conference on Management of Data, New York, NY, USA, Mar. 2019, Amsterdam, Netherlands, pp. 415–4320. DOI: https://doi.org/10.1145/3299869.3300085
Downloads
How to Cite
License
Copyright (c) 2025 S. M. Emdad Hossain, Mourad M. H. Henchiri

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.
