<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>R2[RML]-ChatGPT Framework</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Alex Randles</string-name>
          <email>alex.randles@adaptcentre.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Declan O'Sullivan</string-name>
          <email>declan.osullivan@adaptcentre.ie</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="editor">
          <string-name>Semantic Web, Mapping Quality, Linked data Generation, ChatGPT. 1</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>ADAPT Centre for Digital Content, Trinity College Dublin</institution>
          ,
          <addr-line>Dublin</addr-line>
          ,
          <country country="IE">Ireland</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>KGCW'24: 5th International Workshop on Knowledge Graph Construction</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>The purpose of this paper is to explore the potential of applying Large Language Models (LLMs) in the processes involved in linked data publication, which require a high level of domain knowledge. In particular, we are interested in the semantic and syntactic correctness of data provided by LLMs, which could be used during the development of declarative uplift mappings. The R2[RML]-ChatGPT Framework is proposed, which integrates ChatGPT to gather useful quality insights on uplift mappings required in the publication of linked data. Two system experiments were conducted, which involved inputting mappings to test the correctness of returned knowledge. The semantic correctness of key ontology terms related to 50 distinct concepts were measured. Furthermore, 150 files of relevant code were automatically generated using the framework and measured for syntactic correctness. Moreover, the framework attempted to resolve invalid syntactics, which were then reassessed.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Data quality is often defined as “fitness for use” [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] and is a multidimensional concept, which
is determined by the stakeholders and factors involved in the creation of the data [2]. The
quality of the data will influence the usefulness of data for use cases of consumers [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
Currently, quality assessment within the linked data domain is commonly performed on the
published data and is the responsibility of data consumers rather than the producers [3].
‘Uplift’ mapping artefacts typically are responsible for the generation of Resource
Description Framework (RDF) data published on the web [4]. Uplift declarative mappings
are used to define transformation rules for converting non-RDF data (e.g. excel or relational
data) into RDF representation. Common languages include the World
Wide Web
Consortium (W3C) recommendation named the RDB to RDF Mapping Language (R2RML)
[5]. R2RML was designed to express customized transformation rules for converting
relational databases to RDF data. Another prominent language is the RDF Mapping
Language (RML) [6], which extends the R2RML vocabulary to support source data
represented in heterogenous formats, such as CSV, JSON and XML. These two languages are
commonly used in the linked data publication process in the semantic web domain [4] and
inherently impact the quality of the resulting linked data [
        <xref ref-type="bibr" rid="ref1">1,2</xref>
        ]. Creating these mappings is
0000-0001-6231-3801 (A. Randles); 0000-0003-1090-3548 (D. O’Sullivan)
      </p>
      <p>
        © 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
a complex, time-consuming task, which is frequently error prone [2]. Often quality issues
within these mappings are not detected until the dataset has been published [
        <xref ref-type="bibr" rid="ref1">1,2</xref>
        ]. In
addition, creating high quality mappings requires a high level of relevant background
knowledge [4]. Background knowledge in this context is described as information which
informs design decisions involved in declarative mappings, such as knowledge on
ontologies, RDF data querying and validation.
      </p>
      <p>
        The research described in this paper makes a connection between LLMs [7] and
semantically represented knowledge graphs, which are generated by declarative uplift
mappings. The recent increasing uptake of ChatGPT [
        <xref ref-type="bibr" rid="ref10">8</xref>
        ] has demonstrated its ability to
provide semantically correct natural language, however, can it provide semantically correct
RDF concepts? In addition, can it syntactically correct RDF related code, such as Terse RDF
Triple Language (Turtle) [
        <xref ref-type="bibr" rid="ref11">9</xref>
        ] and SPARQL Protocol and RDF Query Language (SPARQL)
[
        <xref ref-type="bibr" rid="ref12">10</xref>
        ]?. Previous research [
        <xref ref-type="bibr" rid="ref13">11</xref>
        ] has applied the ChatGPT LLM to enrich data contained in
resulting linked data and states that “One of the aspects which have not yet taken over the
spotlight is the combined application of these models with semantic technologies to enable
reasoning and inference.”. Thus, additional exploration is warranted to discover the possible
benefits of the application of LLMs in the publication of linked data. The intuition is that
applying LLMs early in the publication process of linked data could result in improved
quality, by informing agents while completing important uplift mapping design decisions.
In order to explore the use case, we propose the R2[RML]-ChatGPT Framework, which
was designed to provide insights from ChatGPT 3.5 turbo2 on aspects of uplift mappings
defined in R2RML and RML.
      </p>
      <p>This paper is structured as follows: Section 2 presents the design and implementation of
the framework. Section 3 presents the experiments completed on the framework. Section 4
describes related work. Section 5 outlines future work and concludes the paper.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Design and Implementation of R2[RML]-ChatGPT Framework</title>
      <p>This section presents the design and implementation of the R2[RML]-ChatGPT Framework3.</p>
      <sec id="sec-2-1">
        <title>2.1. Design</title>
        <p>2 https://platform.openai.com/docs/models/gpt-3-5-turbo
3 Video demo at https://drive.google.com/file/d/1_f_bssrOL5e6ATD0Ee1NCkuql8GYy2OE</p>
        <p>Pre-Processing. Figure 2 presents an overview of the activities involved in
preprocessing of the framework.</p>
        <p>
          Pre-processing involves retrieving necessary information from the input uplift mapping
and generating prompts for ChatGPT. First, an uplift mapping is input into the framework
using the GUI. Thereafter, a SPARQL [
          <xref ref-type="bibr" rid="ref12">10</xref>
          ] query4 is executed on the mapping to retrieve
distinct concepts (classes and properties). Each of the concepts are fed into prompt
templates, which are designed to provide initial useful insights related to each concept.
Initially, the framework executed a new request to ChatGPT [
          <xref ref-type="bibr" rid="ref10">8</xref>
          ] for each concept in order to
retrieve the initial response. However, the observed processing time was longer than
expected as multiple requests were being executed at once. In particular, those mappings
with large numbers of concepts were observed to be performance intensive. Threading5
4 https://github.com/alex-randles/R2RML-ChatGPT-Experiments/tree/main/retrieve_concepts.rq
5 https://docs.python.org/3/library/threading.html
was experimented with to improve the performance, however, the results varied depending
on the current load of the ChatGPT model. Thus, it was decided to include a relational
database to store previously retrieved prompts, in order to improve the performance of the
framework (acting as a cache). The database is queried to find if the initial generated
prompt has been previously requested. Thereafter, the cached response retrieved from the
database is output to users. Otherwise, ChatGPT is queried and the response cached for later
reuse. It was decided not to use a triple store for storing responses as these are represented
in natural language rather than semantic data. Values which could be later used for
additional prompts are stored in specific chat threads (&lt;chat_id&gt;). For instance, the value
retrieved for the range (rdfs:range) of a property (&lt;property&gt;), which was requested can
be extracted from the response using a regular expression ("’rdfs:range’ is ‘(.*)’ ").
Thereafter, the value is stored in a dictionary default mapping
(&lt;chat_id&gt;:{‘rdfs:range’:&lt;regex_result&gt;}). The dictionary can be queried when additional
prompt buttons available on the framework are pressed, such as the “SHACL Shape #1”
button, which creates a constraint in the Shapes Constraint Language (SHACL) [
          <xref ref-type="bibr" rid="ref14">12</xref>
          ]. SHACL
is a W3C recommendation designed to allow the definition of constraints in RDF format
using the provided ontology terms.
        </p>
        <p>Post-Processing. Figure 3 presents an overview of the activities involved in
postprocessing of the framework.</p>
        <p>
          Post-processing involves retrieving necessary information from responses to feed into
other prompts or extraction and validation of sample data. The response from ChatGPT is
either processed to extract relevant values, which can be used in additional queries or to
extract requested code. A regular expression ("(.*?)") is used to extract concepts from
responses, which can be inserted into additional prompt templates. For instance, the range
of a property which was requested can be inserted into another prompt in order to create a
SHACL [
          <xref ref-type="bibr" rid="ref14">12</xref>
          ] constraint to validate the resulting dataset. However, it was observed that some
of the data returned was missing required prefix definitions. Regular expressions
(‘Undefined prefix "(.*)"’, ‘Prefix "(.*)"’) are used to extract information from the output of
the syntax parser if the code was unsuccessfully parsed. The extracted information can be
used to improve the quality of the code by inserting prefixes stored in a CSV file6. The
resulting data can be exported into a file using the framework, with a visual indication of
syntactic correctness provided to users.
        </p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Implementation</title>
        <p>The framework was implemented using several Python libraries7. Flask was used to develop
the web framework. SPARQLWrapper is used to execute SPARQL queries. RDFLib is used to
parse RDF data. The Open-AI library is used to communicate with ChatGPT. Figure 4
presents a screenshot of the implementation information that is displayed by the
framework related to prov:generatedAtTime8.</p>
        <p>The framework allows users to interact with chats related to the various concepts using
the side bar shown. The initial prompt response shown is created using the following
prompt templates: “Can you provide me with key information related to the ‘&lt;concept_name&gt;
used in RDF/OWL Technology?”, which inserts concepts retrieved from the input mapping.
It is hoped this initial information can provide useful insights on each concept in the
uploaded mapping. The blue buttons above the input text area are designed to input further
prompts based on the current concept. For instance, the “Range” button, inserts the
respective concept into the following prompt: “Can you tell me the ‘rdfs:range’ value for the
RDF concept named ‘&lt;concept_name&gt;?”. Thereafter, the term returned for the range can be
6 https://github.com/alex-randles/R2RML-ChatGPT-Experiments/tree/main/prefixes.csv
7 Libraries used at https://github.com/alex-randles/R2RML-ChatGPT-Experiments/tree/main/libraries.pdf
8 http://www.w3.org/ns/prov#generatedAtTime
compared with the mapping to ensure consistent use of the respective ontology. Hover text
is provided on the framework for each prompt button to further clarify their intended usage.
Certain buttons are designed to output SPARQL (“SPARQL Query #1”), Turtle (“Sample
Graph #1”) and SHACL (“SHACL Code #1”) code.</p>
        <p>
          Figure 5 presents the functionality used to export and validate RDF related code from
the framework.
First, the code can be extracted (“Extract Code”) from raw the response received from
ChatGPT. The processed code can be export (“Export Code”) into a file for reuse later. A
green export button (as shown) indicates the code was successfully parsed. A red button
indicates to users that the syntax parsing was unsuccessful, and the framework could not
repair the code. The sample shown includes a SPARQL query for checking if a resource is
defined as a type of rdfs:Class [
          <xref ref-type="bibr" rid="ref15">13</xref>
          ]. As can be seen, the initial response from ChatGPT
was missing prefix definitions, which were added by the framework.
        </p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Experimentation</title>
      <p>A system experimentation9 was conducted in order to validate two key aspects related to
the application of ChatGPT for supporting the mapping quality improvement use case.
These aspects related to the semantic and syntactic correctness of RDF concepts and code
output by the developed R2[RML]-ChatGPT framework. “Code” in this experiment, refers to
Turtle data and SPARQL queries. Two research questions (RQ) were posed in order to
explore these aspects:
9 Experiment Results at https://github.com/alex-randles/R2RML-ChatGPT-Experiments</p>
      <p>RQ1: To what extent will ChatGPT produce semantically correct data for certain values
in a declarative uplift mapping (e.g. type, domain, range and label)?</p>
      <p>RQ2: To what extent will ChatGPT produce syntactically correct RDF data and SPARQL
queries?</p>
      <p>
        RQ1 was tested by retrieving ontology terms for concepts using ChatGPT and then
comparing it with the term definition from the respective ontology. Matching terms would
indicate that ChatGPT has output a semantically correct concept. For instance, the range
(rdfs:domain) of the foaf:based_near property in the FOAF ontology [
        <xref ref-type="bibr" rid="ref16">14</xref>
        ] is defined
as geo:SpatialThing10, which would be compared to the domain that is output by
ChatGPT when provided with a respective prompt. The comparison takes into account
subclasses of the concept output. The foaf:Person concept is a valid domain for this case
as it is a subclass of geo:SpatialThing. RQ2 was tested by validating the syntax of the
RDF and SPARQL code output by ChatGPT. The framework attempted to resolve issues in
incorrect syntax using the post-processing described in Section 2.1. Thereafter, the updated
syntax was assessed similarly. Figure 6 presents an overview of the activities involved in
the experimentation.
      </p>
      <p>
        Initially, the 50 distinct common RDF concepts (25 classes and 25 properties) in 5
R2RML [5] mappings11 were input into the framework. 10 concepts (5 classes and 5
properties) were retrieved from the following five well-known ontologies: RDF [
        <xref ref-type="bibr" rid="ref17">15</xref>
        ], RDFS
[
        <xref ref-type="bibr" rid="ref15">13</xref>
        ], FOAF [
        <xref ref-type="bibr" rid="ref16">14</xref>
        ], SKOS [
        <xref ref-type="bibr" rid="ref18">16</xref>
        ] and PROV-O [
        <xref ref-type="bibr" rid="ref19">17</xref>
        ]. It was decided to use these ontologies as they
are designed to represent diverse information such as provenance (PROV-O), social
networks (FOAF) and taxonomies (SKOS). Only concepts with the respective related
properties were chosen to ensure that a value for comparison existed. For instance, only
properties with an associated range were tested for range correctness. Ontology terms and
RDF related code related to these concepts were retrieved from ChatGPT using prompt
templates, where each respective concept name was inserted. Thereafter, relevant values
were extracted from the response and stored for comparison. The comparison was
completed by inserting respective values into an ASK SPARQL [
        <xref ref-type="bibr" rid="ref12">10</xref>
        ] query. Thereafter, the
query was executed on the respective ontology which was stored in the local Apache Jena
10 http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing
11 https://github.com/alex-randles/R2RML-ChatGPT-Experiments/tree/main/mappings
Fueski Triple Store12. The queries when executed resulted in boolean (True or False) values,
which represented the result of comparison. In addition, 150 files containing SPARQL,
SHACL and Sample instances were generated using the framework, by asking ChatGPT to
produce sample data related to each ontology term in the sample mappings. Relevant
information for testing RQ1 was the concept name returned for each requested ontology
term. Relevant information for testing RQ2 was associated RDF graphs and SPARQL
queries.
      </p>
      <sec id="sec-3-1">
        <title>3.1. Experiment 1: Semantic Correctness of RDF terms</title>
        <p>Testing of semantic correctness (RQ1) involved retrieving the type (rdf:type), range
(rdfs:range), domain (rdfs:domain) and human readable label (rdfs:label)
associated with the 50 concepts. The results from ChatGPT were compared to the
corresponding term defined in the ontology using an ASK SPARQL query template. For
instance, the type of prov:atLocation was tested. ChatGPT was provided with the
following prompt: “Can you provide the ‘rdf:type’ value for the ‘prov:atLocation’ concept
defined in an ontology used in RDF/OWL Technology?”. The type returned was extracted from
the response and inserted into a SPARQL query template13, which queries the namespace
ontology. The results of the comparison were manually validated to ensure consistent
results. Table 1 presents the results of the comparison of the output for each of the ontology
terms. The ASK query returning True (“True Count”) indicate the ontology term returned
by ChatGPT was the same as the ontology. The query returning False (“False Count”)
indicates the concept output does not match the ontology. In addition, no respective value
(“No Response”) could be returned from ChatGPT. The label and type term related to all 50
concepts. However, the domain and range only related to properties as classes do not have
these restrictions.</p>
        <p>Ontology Term</p>
        <p>rdf:type
rdfs:domain
rdfs:range
rdfs:label</p>
        <p>Figure 7 presents an overview of the results shown. Each pie chart shown relates to the
correctness of each ontology term tested.
12 https://jena.apache.org/documentation/fuseki2/
13 https://github.com/alex-randles/R2RML-ChatGPT-Experiments/tree/main/ask_query_template.rq</p>
        <p>
          The results indicate that ChatGPT produces correct terms for 118 (78.6%) of the tested
cases, with the correctness influenced by the ontology and requested term. It scored best
for retrieving the correct domain (rdfs:domain) of properties with 88% semantically
correct terms retrieved. Slightly worse scores were identified for the range (rdfs:range)
of properties with 84% correct. While ChatGPT was capable of providing semantically
correct types (rdf:type) of concepts with a slightly worse degree of accuracy (76%). Most
correct cases related to the generalized RDF class (rdfs:Class) or property
(rdf:Property), which all RDF concepts are types of [
          <xref ref-type="bibr" rid="ref15">13</xref>
          ]. In addition, a high proportion
of domain and ranges returned related to the generalized RDF resource (rdfs:Resource)
which all RDF resources are instances [
          <xref ref-type="bibr" rid="ref15">13</xref>
          ]. Most incorrect cases related to ChatGPT
returning a type of the name of the concept itself, such as prov:Agent, which returned a
type of prov:Agent. Labels (rdfs:label) scored worst (74%), which could be a result
of the natural language representation of them. As LLMs [7] are trained using natural
language it could be harder for them to distinguish these values from other text when
compared to RDF concepts. Interestingly, it was observed that ChatGPT made inferences
about certain labels. For instance, the label returned from the rdf:HTML class was
“HTML/XML Syntax for RDF”, however, the value defined in the ontology is “HTML”.
It could have made inferences about the usage for RDF due to the context of the request.
Similarly, the label returned for the rdf:rest property was “rest of list”, whereas
the correct value is “rest”. As ChatGPT knows that the property is related to lists, it could
infer the label based on the background information. In addition, a limitation for labels is
that ChatGPT may not understand the common naming convention (property name in camel
case). Table 2 presents an overview of the results categorized by respective ontology.
        </p>
        <p>
          The results indicate that the ontology where the term was defined influenced the
semantic correctness of values returned. In addition, the high standard deviation (3.4)
indicates that the scores for each ontology were spread around the mean. As can be seen,
RDF [
          <xref ref-type="bibr" rid="ref17">15</xref>
          ], RDFS [
          <xref ref-type="bibr" rid="ref15">13</xref>
          ] and FOAF [
          <xref ref-type="bibr" rid="ref16">14</xref>
          ] scored best, while SKOS [
          <xref ref-type="bibr" rid="ref18">16</xref>
          ] and PROV-O [
          <xref ref-type="bibr" rid="ref19">17</xref>
          ] scored
worse. Thus, these results indicate that the ontology where the tested concept originates
influences the semantic correctness of ChatGPT. However, all ontologies scored between
63% (SKOS) and 93% (RDFS) correctness for each of the 30 tests completed on them. The
worse scores could be as a result of the amount and quality of documentation published by
the ontology, which was used to the train the LLM [7]. Table 3 presents a sample of results
from this experiment. The tested (“Concept”) is shown, along with the term returned from
ChatGPT (“ChatGPT Output”) and the semantically correct corresponding term (“Ontology
Term”) from the respective ontology.
        </p>
        <p>The overall results show that ChatGPT can provide semantically correct concepts with
118 (78.6%) correct for this use case. Overall, it can be concluded from RQ1 that the
framework could be beneficial for agents involved in quality assessment of the publication
process of linked data. The information related to ontology reuse could be used by agents
to inform crucial design decisions which will impact overall quality.</p>
      </sec>
      <sec id="sec-3-2">
        <title>3.2. Experiment 2: Syntactic Correctness of RDF-related code</title>
        <p>
          Testing of RQ2 involved retrieving a sample instance Turtle [
          <xref ref-type="bibr" rid="ref11">9</xref>
          ] graph, sample SHACL [
          <xref ref-type="bibr" rid="ref14">12</xref>
          ]
shape and sample SPARQL [
          <xref ref-type="bibr" rid="ref12">10</xref>
          ] queries related to the 50 ontology concepts. In total, 150
files (3 for each concept) of code were generated. Table 4 presents the results of inputting
these 150 files into the RDFLib parser14 in order to validate syntactic correctness. Each
tested category consisted of a total of 50 files. Files which were tested and contained initially
correct code syntax required no further actions. Incorrect code was post-processed by the
framework as described in Section 2.1, resulting in the final syntax of the code.
        </p>
        <p>Category</p>
        <p>SPARQL Query
SHACL Constraints
Sample Instances</p>
        <p>Figure 8 presents an overview of the results shown. The percentage of each category
correct before (left) and after (right) post-processing.
The results show that ChatGPT can produce RDF related code with a high degree of
accuracy. Initially, all categories scored better than 42 (84%) syntactically correct. The
postprocessing of the incorrect files resulted in an improvement to a mean of 48 (96%) for all
categories. The results show SHACL constraints scored slightly better than the other
categories, which could be due to less prefixes being needed in most cases. SPARQL queries
and Sample instance graphs scored similar. Majority (14 out of 18) of the syntax problems
were due to missing prefixes in the initial response from ChatGPT. Only 1 out of the 11
initially incorrect Turtle graphs could not be repaired using the post processing, which
indicates that ChatGPT has a good understanding of the overall structure of these graphs.
SPARQL queries accounted for the most (3) files where syntax could not be repaired. These
results provide an indication that ChatGPT has the least understanding of them.
14 Parser used to validate syntax at https://rdflib.readthedocs.io/en/stable/plugin_parsers.html</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>4. Related Work</title>
      <p>
        In recent years, research into frameworks to support the generation of high-quality
mappings have been conducted. The Mapping Quality Improvement (MQI) Framework [
        <xref ref-type="bibr" rid="ref20">18</xref>
        ]
to improve and maintain the quality of R2[RML] [5,6] uplift mappings has been proposed
and evaluated. The framework consists of two core components. The mapping quality
assessment and refinement component is designed to detect quality issues and suggest
semi-automatic refinements to resolve them. The change detection component detects
changes in respective source data and provides suggestions on how to maintain alignment
between them. An approach [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] exists which was designed to assess and refine the quality
of R2[RML] mappings using rule-based reasoning, which involves executing various test
cases on them. Some of the related approaches [2,3] extend existing linked data quality
assessment frameworks. These approaches are designed to target mappings represented in
RDF format, such as R2RML [5] and RML [6]. EvaMap is an approach [
        <xref ref-type="bibr" rid="ref21">19</xref>
        ] which was
designed with the requirements in mind and uses information contained in respective
ontologies to assess the quality of YARRRML15 mappings. The assessment involves quality
metrics in 7 dimensions, which are used to calculate a weighted mean score. However, these
approaches are limited to information contained in ontologies used by respective mappings,
which are queried in order to assess quality. Thus, mapping engineers who use these
approaches are required to search other forms of data on the web to resolve issues out of
scope of the used ontologies, such as alternative ontologies to reuse.
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Future Work and Conclusion</title>
      <p>
        Future work includes expanding the test cases applied during the experimentation outlined
in this paper. It is hoped expanded test cases will provide further indications of the accuracy
of the relevant knowledge supplied. In addition, conducting a usability experiment on the
framework will help to identify limitations for respective end users. A standardized
questionnaire, such as the Post-Study System Usability Questionnaire (PSSUQ) [
        <xref ref-type="bibr" rid="ref22">20</xref>
        ], which
was designed by IBM could be used. The PSSUQ measures user satisfaction from a software
system, which involves rating various key aspects using a Likert scale. Furthermore, the
semantic correctness of generated SPARQL queries and SHACL shapes could be tested, by
executing them on respective input and comparing the output with expected results.
Moreover, knowledge from the generation of SHACL [
        <xref ref-type="bibr" rid="ref23">21</xref>
        ] shapes using Ontology Design
Patterns [22] could be integrated into the framework to generate ontology specific
constraints. Finally, the framework could be extended to support other mappings
represented in RDF format, such as the Database to RDF Mapping Language (D2RQ) [23].
      </p>
      <p>The R2[RML]-ChatGPT framework proposed in this paper provides possible direction
for future applications of LLMs in the publication process of linked data. It is hoped the
approach can be used to provide accurate quality insights on various aspects of associated
artefacts to alleviate the high requirement of background knowledge from domain experts.
In addition, it is hoped that the availability of diverse prompt templates will result in a more
15 https://rml.io/yarrrml/
straightforward knowledge discovery process using the framework. The results of the
experiments demonstrated that ChatGPT is capable of providing syntactically and
semantically correct data. 118 (78.6%) of the 150 tested ontology terms were semantically
correct and a mean of 48 (96%) of the 50 code files for the tested categories (after
postprocessing) were syntactically correct, which indicates a high level of accuracy. These
results indicate that the information could be beneficial to mapping engineers when making
crucial design decisions within the linked data publication process. It is hoped the easily
accessible information covering various knowledge domains could be used to support
domain experts when retrieving required knowledge during the publication process. In
addition, it is hoped the automation of syntactically correct RDF related code will reduce
workload for involved agents.</p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgements</title>
      <p>This research was conducted with the financial support of the ADAPT SFI Research Centre
(Grant No. 13/RC/2106_P2) at Trinity College Dublin.
[22] H.J. Pandit, D. O’Sullivan, D. Lewis, An Argument for Generating SHACL Shapes from
ODPs, in: Advances in Pattern-Based Ontology Engineering, IOS Press, 2021: pp. 134–
141. https://doi.org/10.3233/SSW210011.
[23] C. Bizer, A. Seaborne, D2RQ – Treating Non-RDF Databases as Virtual RDF Graphs, in:
Proceedings of the 3rd International Semantic Web Conference (ISWC2004), 2004:
pp. 125–127.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <source>[1] [2] [3] [4] [5] [6]</source>
          [7]
          <string-name>
            <given-names>A.</given-names>
            <surname>Dimou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kontokostas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Freudenberg</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Verborgh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lehmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Mannens</surname>
          </string-name>
          , S.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Hellmann</surname>
          </string-name>
          , R. Van de Walle,
          <article-title>Assessing and refining mappings to RDF to improve dataset quality</article-title>
          ,
          <source>in: 14th International Semantic Web Conference (ISWC</source>
          <year>2015</year>
          ),
          <year>2015</year>
          : pp.
          <fpage>133</fpage>
          -
          <lpage>149</lpage>
          . https://doi.org/10.1007/978-3-
          <fpage>319</fpage>
          -25010-
          <issue>6</issue>
          _
          <fpage>8</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <given-names>A.C.</given-names>
            <surname>Junior</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Debattista</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          <article-title>O'Sullivan, Assessing the Quality of R2RML Mappings</article-title>
          , in:
          <source>Joint Proceedings of the International Workshop On Semantics For Transport and on Approaches for Making Data Interoperable Co-Located with 15th Semantics Conference</source>
          ,
          <year>2019</year>
          : pp.
          <fpage>12</fpage>
          -
          <lpage>24</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <given-names>P.</given-names>
            <surname>Heyvaert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>De Meester</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Dimou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Verborgh</surname>
          </string-name>
          ,
          <article-title>Rule-driven inconsistency resolution for knowledge graph generation rules</article-title>
          ,
          <source>Semant Web</source>
          <volume>10</volume>
          (
          <year>2019</year>
          )
          <fpage>1071</fpage>
          -
          <lpage>1086</lpage>
          . https://doi.org/10.3233/SW-190358.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <given-names>A.</given-names>
            <surname>Crotti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Debruyne</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Brennan</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          <article-title>O'Sullivan, An evaluation of uplift mapping languages</article-title>
          ,
          <source>International Journal of Web Information Systems</source>
          <volume>13</volume>
          (
          <year>2017</year>
          )
          <fpage>405</fpage>
          -
          <lpage>424</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>https://doi.org/10.1108/IJWIS-04-2017-0036.</mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>S. Das</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Sundara</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Cyganiak</surname>
          </string-name>
          ,
          <article-title>R2RML: RDB to RDF Mapping Language</article-title>
          , World Wide Web
          <string-name>
            <surname>Consortium (W3C) Recommendation</surname>
          </string-name>
          (
          <year>2012</year>
          ). http://www.w3.org/TR/r2rml/ (
          <issue>accessed April 1</issue>
          ,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <given-names>A.</given-names>
            <surname>Dimou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. Vander</given-names>
            <surname>Sande</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Colpaert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Verborgh</surname>
          </string-name>
          , E. Mannens, R. Van de Walle,
          <article-title>RML: A Generic Language for Integrated RDF Mappings of Heterogeneous Data</article-title>
          ,
          <source>in: Proceedings of the Workshop on Linked Data on the Web Co-Located Withthe 23rd International World Wide Web Conference (WWW</source>
          <year>2014</year>
          ),
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <given-names>T.</given-names>
            <surname>Brants</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.C.</given-names>
            <surname>Popat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Xu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.J.</given-names>
            <surname>Och</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Dean</surname>
          </string-name>
          ,
          <source>Large Language Models in Machine Translation, in: Proceedings of the 2007 Joint Conference on Empirical Methods in Natural Language Processing</source>
          and
          <string-name>
            <surname>Computational Natural Language Learning (EMNLP-CoNLL</surname>
            <given-names>)</given-names>
          </string-name>
          ,
          <source>Association for Computational Linguistics</source>
          , Prague, Czech Republic,
          <year>2007</year>
          : pp.
          <fpage>858</fpage>
          -
          <lpage>867</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>T.</given-names>
            <surname>Wu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>He</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sun</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Liu</surname>
          </string-name>
          , Q.-L. Han,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Tang</surname>
          </string-name>
          ,
          <article-title>A brief overview of ChatGPT: The history, status quo and potential future development</article-title>
          ,
          <source>IEEE/CAA Journal of Automatica Sinica</source>
          <volume>10</volume>
          (
          <year>2023</year>
          )
          <fpage>1122</fpage>
          -
          <lpage>1136</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>World</given-names>
            <surname>Wide Web Consortium (W3C) Recommendation</surname>
          </string-name>
          , RDF
          <volume>1</volume>
          .1 Turtle, (
          <year>2014</year>
          ). https://www.w3.org/TR/turtle/ (accessed May 15,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>S.</given-names>
            <surname>Harris</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Seaborne</surname>
          </string-name>
          ,
          <string-name>
            <surname>E.</surname>
          </string-name>
          <article-title>Prud'hommeaux, SPARQL 1.1 Query Language</article-title>
          ,
          <source>World Wide Web Consortium (W3C) Recommendation</source>
          <volume>21</volume>
          (
          <year>2013</year>
          )
          <article-title>778</article-title>
          . https://www.w3.org/TR/sparql11-query
          <source>/ (accessed April 1</source>
          ,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>M.</given-names>
            <surname>Trajanoska</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Stojanov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Trajanov</surname>
          </string-name>
          ,
          <article-title>Enhancing Knowledge Graph Construction Using Large Language Models</article-title>
          .
          <source>arXiv preprint arXiv:2305</source>
          .
          <fpage>04676</fpage>
          . (
          <year>2023</year>
          ). https://doi.org/10.48550/arXiv.2305.04676.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>H.</given-names>
            <surname>Knublauch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kontokostas</surname>
          </string-name>
          ,
          <article-title>Shapes Constraint Language (SHACL), World Wide Web Consortium (W3C) Recommendation (</article-title>
          <year>2017</year>
          ). https://www.w3.org/TR/shacl/ (accessed April 1,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>D.</given-names>
            <surname>Brickley</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. V</given-names>
            <surname>Guha</surname>
          </string-name>
          ,
          <string-name>
            <surname>B. McBride</surname>
          </string-name>
          ,
          <source>RDF Schema 1</source>
          .1,
          <string-name>
            <given-names>World</given-names>
            <surname>Wide Web Consortium (W3C) Recommendation</surname>
          </string-name>
          (
          <year>2014</year>
          ). https://www.w3.org/TR/rdf-schema
          <source>/ (accessed April 1</source>
          ,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>J.</given-names>
            <surname>Golbeck</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Rothstein</surname>
          </string-name>
          ,
          <article-title>Linking Social Networks on the Web with FOAF: A Semantic Web Case Study</article-title>
          .,
          <source>in: 23rd AAAI Conference on Artificial Intelligence (AAAI)</source>
          ,
          <year>2008</year>
          : pp.
          <fpage>1138</fpage>
          -
          <lpage>1143</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [15]
          <string-name>
            <given-names>R.</given-names>
            <surname>Cyganiak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Wood</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lanthaler</surname>
          </string-name>
          , G. Klyne,
          <string-name>
            <given-names>J.J.</given-names>
            <surname>Carroll</surname>
          </string-name>
          , B.
          <source>McBride, RDF 1.1 Concepts</source>
          and
          <string-name>
            <given-names>Abstract</given-names>
            <surname>Syntax</surname>
          </string-name>
          ,
          <source>World Wide Web Consortium (W3C) Recommendation</source>
          <volume>25</volume>
          (
          <year>2014</year>
          ). https://www.w3.org/TR/rdf11-concepts/
          <source>(accessed April 1</source>
          ,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>W3C</given-names>
            <surname>Working</surname>
          </string-name>
          <string-name>
            <surname>Draft</surname>
          </string-name>
          ,
          <string-name>
            <given-names>SKOS Core</given-names>
            <surname>Vocabulary</surname>
          </string-name>
          <string-name>
            <surname>Specification</surname>
          </string-name>
          , (
          <year>2005</year>
          ). https://www.w3.org/TR/swbp
          <article-title>-skos-core-spec/ (accessed May 15,</article-title>
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [17]
          <string-name>
            <given-names>T.</given-names>
            <surname>Lebo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sahoo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>McGuinness</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Belhajjame</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Cheney</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Corsar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Garijo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Soiland-Reyes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Zednik</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Zhao</surname>
          </string-name>
          ,
          <string-name>
            <surname>The PROV Ontology (PROV-O)</surname>
          </string-name>
          ,
          <source>World Wide Web Consortium (W3C) Recommendation</source>
          (
          <year>2013</year>
          ). https://www.w3.org/TR/prov-o
          <source>/ (accessed April 1</source>
          ,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>A.</given-names>
            <surname>Randles</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          <article-title>O'Sullivan, Preserving the Alignment of LD with Source Data</article-title>
          ,
          <source>in: Proceedings of the 4th International Workshop on Knowledge Graph Construction (KGCW) Co-Located with the 20th Extended Semantic Web Conference</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>B.</given-names>
            <surname>Moreau</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Serrano-Alvarado</surname>
          </string-name>
          ,
          <article-title>Assessing the Quality of RDF Mappings with EvaMap</article-title>
          ,
          <source>in: 17th Extended Semantic Web Conference (ESWC2020)</source>
          ,
          <year>2020</year>
          : pp.
          <fpage>164</fpage>
          -
          <lpage>167</lpage>
          . https://doi.org/10.1007/978-3-
          <fpage>030</fpage>
          -62327-2_
          <fpage>28</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [20]
          <string-name>
            <given-names>J.R.</given-names>
            <surname>Lewis</surname>
          </string-name>
          ,
          <article-title>Psychometric Evaluation of the PSSUQ Using Data from Five Years of Usability Studies</article-title>
          ,
          <source>Int J Hum Comput Interact</source>
          <volume>14</volume>
          (
          <year>2002</year>
          )
          <fpage>463</fpage>
          -
          <lpage>488</lpage>
          . https://doi.org/10.1080/10447318.
          <year>2002</year>
          .
          <volume>9669130</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>H.</given-names>
            <surname>Knublauch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Kontokostas</surname>
          </string-name>
          ,
          <article-title>Shapes Constraint Language (SHACL), World Wide Web Consortium (W3C) Recommendation (</article-title>
          <year>2017</year>
          ). https://www.w3.org/TR/shacl/ (accessed April 1,
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>