{"id":{"repo_id":"ohiolink","oai_identifier":"oai:etd.ohiolink.edu:wright1779816646291536"},"canonical_url":"https://search.ndltd.org/etd/ohiolink/oai:etd.ohiolink.edu:wright1779816646291536","repository":{"repo_id":"ohiolink","name":"OhioLINK","base_url":"https://etd.ohiolink.edu/acprod/odb_etd/ws/oai/oai"},"display":{"title":"Assessing Prompt Engineering Strategies for Natural Language to SPARQL Query Generation over Knowledge Graphs","abstract":"Knowledge graphs (KGs) provide structured and semantically meaningful representations of information, while large language models (LLMs) offer strong natural language understanding and generation capabilities. Translating natural language questions into accurate SPARQL queries remains a challenging task, particularly when queries require schema awareness and complex structured reasoning. This research evaluates how different prompt engineering strategies influence the performance of GPT-4 in generating SPARQL queries over knowledge graphs.A domain-specific scholarly knowledge graph was constructed using data from the Wright State University CORE Scholar dataset and stored in Apache Jena Fuseki. The final dataset included approximately 150 publications, 580 agents, and 6,800–7,400 RDF triples. Twenty-two competency questions covering simple and complex query types were designed to evaluate three prompting strategies: zero-shot, few-shot, and chain-of-thought. The generated SPARQL queries were evaluated against manually written gold queries using executability, exact match, result match, precision, recall, F1-score, and qualitative error analysis.The results showed that all prompting strategies achieved 100 percent executable queries, demonstrating strong syntactic reliability. Few-shot prompting achieved the best overall performance, while simple queries produced significantly higher accuracy than complex multi-hop and aggregation queries. Error analysis revealed that most failures were related to schema mismatch, incorrect property selection, entity resolution, and limitations in structured reasoning. The findings suggest that prompt engineering plays a critical role in improving schema-aware SPARQL generation, while complex reasoning over knowledge graphs remains a significant challenge for LLMs.","abstract_html":"Knowledge graphs (KGs) provide structured and semantically meaningful representations of information, while large language models (LLMs) offer strong natural language understanding and generation capabilities. Translating natural language questions into accurate SPARQL queries remains a challenging task, particularly when queries require schema awareness and complex structured reasoning. This research evaluates how different prompt engineering strategies influence the performance of GPT-4 in generating SPARQL queries over knowledge graphs.A domain-specific scholarly knowledge graph was constructed using data from the Wright State University CORE Scholar dataset and stored in Apache Jena Fuseki. The final dataset included approximately 150 publications, 580 agents, and 6,800–7,400 RDF triples. Twenty-two competency questions covering simple and complex query types were designed to evaluate three prompting strategies: zero-shot, few-shot, and chain-of-thought. The generated SPARQL queries were evaluated against manually written gold queries using executability, exact match, result match, precision, recall, F1-score, and qualitative error analysis.The results showed that all prompting strategies achieved 100 percent executable queries, demonstrating strong syntactic reliability. Few-shot prompting achieved the best overall performance, while simple queries produced significantly higher accuracy than complex multi-hop and aggregation queries. Error analysis revealed that most failures were related to schema mismatch, incorrect property selection, entity resolution, and limitations in structured reasoning. The findings suggest that prompt engineering plays a critical role in improving schema-aware SPARQL generation, while complex reasoning over knowledge graphs remains a significant challenge for LLMs.","abstract_has_math":false,"creators":["Ghiasi, Elham"],"institution":"Wright State University","degree_name":"Master of Science (MS)","degree_level":"masters","degree_discipline":"Computer Science","degree_department":null,"school":null,"contributors":[],"advisors":["Shimizu, Cogan"],"committee_chairs":[],"committee_members":[],"year":2026,"date_issued":"2026-05-27","date_published":"2026-05-27","updated_at":"2026-11-27T05:03:12Z","subjects":["Computer Science","Knowledge graphs","Large language models","Prompt Engineering"],"languages":["English"],"rights":["unrestricted","This thesis or dissertation is protected by copyright: all rights reserved. It may not be copied or redistributed beyond the terms of applicable copyright laws."],"rights_urls":[],"identifier_entries":[],"person_identifier_entries":[]},"links":{"outbound_url":"http://rave.ohiolink.edu/etdc/view?acc_num=wright1779816646291536","outbound_label":"Repository record","outbound_source":"dc:identifier","record_url":"http://rave.ohiolink.edu/etdc/view?acc_num=wright1779816646291536","record_label":"Repository record","record_kind":"record","record_source":"dc:identifier","access_status":null,"embargo_until":null,"access_note":null},"oai_pmh_record":{"url":"https://union.ndltd.org/oai-pmh/?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai%3Aunion.ndltd.org%3Arepo%3Aohiolink%3Aoai%3Aetd.ohiolink.edu%3Awright1779816646291536","prefix":"oai_dc"},"source_record":{"url":"https://etd.ohiolink.edu/acprod/odb_etd/ws/oai/oai?verb=GetRecord&metadataPrefix=oai_etdms&identifier=oai%3Aetd.ohiolink.edu%3Awright1779816646291536","prefix":"oai_etdms"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor.advisor","label":"Advisor","values":["Shimizu, Cogan"]},{"key":"dc:creator","label":"Author","values":["Ghiasi, Elham"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date","label":"Dc Date","values":["2026-05-27"]},{"key":"dc:publisher","label":"Institution","values":["Wright State University / OhioLINK"]},{"key":"dc:type","label":"Dc Type","values":["Electronic Thesis or Dissertation"]},{"key":"thesis:degree_discipline","label":"Discipline","values":["Computer Science"]},{"key":"thesis:degree_level","label":"Degree Level","values":["masters"]},{"key":"thesis:degree_name","label":"Degree Name","values":["Master of Science (MS)"]},{"key":"thesis:institution_name","label":"Thesis Institution Name","values":["Wright State University"]}]},{"id":"subjects_keywords","label":"Subjects and Keywords","entries":[{"key":"dc:subject","label":"Dc Subject","values":["Computer Science","Knowledge graphs","Large language models","Prompt Engineering"]}]},{"id":"language_rights","label":"Language and Rights","entries":[{"key":"dc:language","label":"Dc Language","values":["English"]},{"key":"dc:rights","label":"Dc Rights","values":["unrestricted","This thesis or dissertation is protected by copyright: all rights reserved. It may not be copied or redistributed beyond the terms of applicable copyright laws."]}]},{"id":"identifiers","label":"Identifiers","entries":[{"key":"dc:identifier","label":"Identifier","values":["http://rave.ohiolink.edu/etdc/view?acc_num=wright1779816646291536"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description","label":"Description","values":["Knowledge graphs (KGs) provide structured and semantically meaningful representations of information, while large language models (LLMs) offer strong natural language understanding and generation capabilities. Translating natural language questions into accurate SPARQL queries remains a challenging task, particularly when queries require schema awareness and complex structured reasoning. This research evaluates how different prompt engineering strategies influence the performance of GPT-4 in generating SPARQL queries over knowledge graphs.A domain-specific scholarly knowledge graph was constructed using data from the Wright State University CORE Scholar dataset and stored in Apache Jena Fuseki. The final dataset included approximately 150 publications, 580 agents, and 6,800–7,400 RDF triples. Twenty-two competency questions covering simple and complex query types were designed to evaluate three prompting strategies: zero-shot, few-shot, and chain-of-thought. The generated SPARQL queries were evaluated against manually written gold queries using executability, exact match, result match, precision, recall, F1-score, and qualitative error analysis.The results showed that all prompting strategies achieved 100 percent executable queries, demonstrating strong syntactic reliability. Few-shot prompting achieved the best overall performance, while simple queries produced significantly higher accuracy than complex multi-hop and aggregation queries. Error analysis revealed that most failures were related to schema mismatch, incorrect property selection, entity resolution, and limitations in structured reasoning. The findings suggest that prompt engineering plays a critical role in improving schema-aware SPARQL generation, while complex reasoning over knowledge graphs remains a significant challenge for LLMs."]},{"key":"dc:format","label":"Dc Format","values":["application/pdf","p.81","6.74 MB"]},{"key":"dc:title","label":"Title","values":["Assessing Prompt Engineering Strategies for Natural Language to SPARQL Query Generation over Knowledge Graphs"]}]}],"canonical_facts":{"dc:contributor.advisor":["Shimizu, Cogan"],"dc:creator":["Ghiasi, Elham"],"dc:date":["2026-05-27"],"dc:description":["Knowledge graphs (KGs) provide structured and semantically meaningful representations of information, while large language models (LLMs) offer strong natural language understanding and generation capabilities. Translating natural language questions into accurate SPARQL queries remains a challenging task, particularly when queries require schema awareness and complex structured reasoning. This research evaluates how different prompt engineering strategies influence the performance of GPT-4 in generating SPARQL queries over knowledge graphs.A domain-specific scholarly knowledge graph was constructed using data from the Wright State University CORE Scholar dataset and stored in Apache Jena Fuseki. The final dataset included approximately 150 publications, 580 agents, and 6,800–7,400 RDF triples. Twenty-two competency questions covering simple and complex query types were designed to evaluate three prompting strategies: zero-shot, few-shot, and chain-of-thought. The generated SPARQL queries were evaluated against manually written gold queries using executability, exact match, result match, precision, recall, F1-score, and qualitative error analysis.The results showed that all prompting strategies achieved 100 percent executable queries, demonstrating strong syntactic reliability. Few-shot prompting achieved the best overall performance, while simple queries produced significantly higher accuracy than complex multi-hop and aggregation queries. Error analysis revealed that most failures were related to schema mismatch, incorrect property selection, entity resolution, and limitations in structured reasoning. The findings suggest that prompt engineering plays a critical role in improving schema-aware SPARQL generation, while complex reasoning over knowledge graphs remains a significant challenge for LLMs."],"dc:format":["application/pdf","p.81","6.74 MB"],"dc:identifier":["http://rave.ohiolink.edu/etdc/view?acc_num=wright1779816646291536"],"dc:language":["English"],"dc:publisher":["Wright State University / OhioLINK"],"dc:rights":["unrestricted","This thesis or dissertation is protected by copyright: all rights reserved. It may not be copied or redistributed beyond the terms of applicable copyright laws."],"dc:subject":["Computer Science","Knowledge graphs","Large language models","Prompt Engineering"],"dc:title":["Assessing Prompt Engineering Strategies for Natural Language to SPARQL Query Generation over Knowledge Graphs"],"dc:type":["Electronic Thesis or Dissertation"],"thesis:degree_discipline":["Computer Science"],"thesis:degree_level":["masters"],"thesis:degree_name":["Master of Science (MS)"],"thesis:institution_name":["Wright State University"]},"updated_at":"2026-11-27T05:03:12Z"}