<figure><img src="image_1.png" /></figure>

HAL
open science

# Towards Automating RDF Extraction for Archaeological Knowledge Graphs with LLMs

Ali Hariri, Stéphane Jean, Mickaël Baron

► To cite this version:

Ali Hariri, Stéphane Jean, Mickaël Baron. Towards Automating RDF Extraction for Archaeological Knowledge Graphs with LLMs. International Conference on Database and Expert Systems Applications, Aug 2025, Bangkok, Thailand. pp.83-97, 10.1007/978-3-032-02049-9_6. hal-05237866

HAL Id: hal-05237866

https://hal.science/hal-05237866v1

Submitted on 3 Sep 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

Public Domain
Towards Automating RDF Extraction for
Archaeological Knowledge Graphs with LLMs

Ali Hariri[0009-0004-9380-5138], Stéphane Jean[0000-0002-9434-9320], and Mickaël Baron[0000-0002-3356-0835]

ISAE-ENSMA, Université of Poitiers, LIAS, France
{ali.hariri, stephane.jean, mickael.baron}@ensma.fr

**Abstract.** Archaeological sites pose significant challenges in terms of ac-
cessibility and data integration. The Semantic Web, particularly through
the CIDOC CRM ontology, enables structured data sharing. However,
manually constructing knowledge graphs remains a complex and labor-
intensive task. This study explores semi-automatic methods leveraging
large language models (LLMs) to generate knowledge graphs for archaeo-
logical data. We propose different prompting strategies based on varying
levels of information about CIDOC CRM and experiment with diverse
prompt patterns. Experiments conducted on real datasets demonstrate
that providing LLMs with a carefully selected subset of the CIDOC CRM
ontology, combined with few-shot prompt patterns, enhances RDF ex-
traction and improves performance in answering competency questions.

**Keywords:** Knowledge Extraction · LLMs · Ontology · CIDOC CRM

# 1 Introduction

The *Hypogeeum of the Dunes* in Poitiers, France, is a significant Merovingian
monument that exemplifies the complexity of cultural heritage research. Its study
demands interdisciplinary collaboration across archaeology, geology, epigraphy,
and other related fields. However, research on this site faces challenges, including
developing a shared vocabulary for data integration, aligning discipline-specific
data formats, and addressing restricted physical access due to the monument's
fragility. These challenges are representative of broader issues in managing and
preserving cultural heritage sites. Addressing them is a key objective of the
French ANR project Digitalis (ANR-22-CE38-0011-01), which aims to develop a
collaborative digital infrastructure to support interdisciplinary research through
advanced data integration, semantic interoperability, and remote accessibility.

Semantic Web technologies, particularly the CIDOC Conceptual Reference
Model (CIDOC CRM) ontology [3], offer a promising framework for representing
and integrating heterogeneous data in a consistent and meaningful way. CIDOC
CRM is designed to capture the complex relationships between cultural heritage
objects, actors, and events, enabling researchers to map their data into a shared
conceptual space and support remote collaboration. Moreover, CIDOC CRM
supports the development of domain-specific extensions, enabling researchers to
tailor the model to diverse research needs. A prominent example is CRMArcheo, an extension designed to represent archaeological excavation processes, stratigraphic information, and artifact management. This makes it particularly well-suited for documenting complex sites such as the Hypogeum of the Dunes. However, manually constructing knowledge graphs (KGs) that adhere to CIDOC CRM (and its extensions) remains a demanding task, requiring both deep domain knowledge and technical skills in data modeling and Semantic Web technologies. This challenge often limits the widespread adoption of semantic approaches in cultural heritage research.

In this paper, we investigate the potential of Large Language Models (LLMs) to assist researchers in automatically generating RDF triples that conform to the CIDOC CRM ontology. Given their training on extensive web data, including references to CIDOC CRM documentation and examples, we assume that LLMs are capable of generating relevant RDF triples from textual descriptions provided by experts. These automatically generated triples can subsequently be reviewed and refined by domain specialists to build high-quality knowledge graphs (KGs) that support advanced research tasks. We propose and evaluate three prompting strategies that vary in the level of guidance they provide to the LLM, using real archaeological datasets from the Hypogeum of the Dunes. Our results emphasize the importance of carefully selecting relevant CIDOC CRM classes and properties, designing effective prompts, and integrating expert validation to achieve accurate and meaningful RDF extraction.

## 2 Related Work

Ontology population has been extensively studied in various domains, with multiple approaches leveraging Natural Language Processing (NLP) [10] techniques, Machine Learning (ML) and Deep Learning (DL) algorithms. Several works [1,11] have explored methods for extracting entities and relationships from text, utilizing rule-based, statistical, and hybrid approaches. ML-based ontology population techniques have improved the automation of knowledge extraction [7], while deep learning models offer more advanced methods for semantic understanding [12]. However, these methods often require extensive human supervision, substantial annotated training data, and domain-specific adaptations, which limit their scalability and applicability in certain contexts [14]. In particular, the availability of high-quality training datasets remains a challenge for supervised ontology population approaches, especially in specialized domains where labeled data is scarce. In the context of our study on the *Hypogeum of the Dunes*, constructing such a training dataset is not feasible.

Recent advancements in LLMs have opened new possibilities for semantic knowledge representation and ontology population [15], particularly through tasks like entity recognition [4] and RDF triples generation [13]. Despite promising results in general-purpose domains, their use in cultural heritage is still in its early stages. Loffredo and De Santo [9] recently proposed a methodology that enhances LLM performance for cultural heritage tasks by combining ontologies
with a Retrieval-Augmented Generation (RAG) framework. Yet research on automating the population of CIDOC CRM-based ontologies remains limited. To the best of our knowledge, the work by Ding et al. [2] is the closest to ours, proposing Knowledge Prompt Chaining, a framework that leverages prompt chaining to inject graph-structured knowledge into LLMs. However, their study primarily focuses on prompt design, rather than examining the level of CIDOC CRM information to include in the prompt for optimal results in a real-world setting. This is the gap we address in this paper.

# 3 Problem Statement

Let $\Omega$ be a set of ontologies, and $D = \{(X^i, S^i)\}_{i=1}^n$ be a set of structured data sources where $S^i \in \Omega$, and each structured data source is defined as:

$$X^i = \{(x_{r,a_j})_{j=1}^{J_i}\}_{i=1}^{R_i}$$

where $n$ is the number of structured data sources in $D$. Here, $x_{r,a_j}$ represents the value of attribute $a_j$ in row $r$, $J_i$ is the number of attributes in the $i$-th data source, and $R_i$ is the number of rows. The semantic modeling task consists of mapping structured data $X$ to a semantic model $S$ within the ontology $\Omega$. This process involves two main components:

1. **Semantic Labeling**: Assigning ontology classes and properties to attributes of the structured data.

2. **Semantic Graph Construction**: Defining relationships between identified entities and attributes to build a semantic graph.

## 3.1 Semantic Modeling

*Semantic Labeling* is a function $F$ that maps attributes of the structured data source $X$ to ontology nodes in $\Omega$. This process can be represented as a set of triples:

$$N^i = \{(a_j, p_j, n_j)\}_{j=1}^{J_i}$$

where each attribute $a_j$ is associated with a property $p_j$ and a node $n_j$ in the ontology. The function $F$ is defined as:

$$F: N^i = f(X^i, \Omega)$$

*Semantic Graph Construction* aims to establish meaningful links between semantic entities by defining relationships in accordance with a target ontology. This process results in a set of triples:

$$S^i = \{(e_g, p_g, e'_g)\}_{g=1}^{G_i}$$

where $e_g$ and $e'_g$ represent semantic entities, and $p_g$ is the relationship connecting them.
In summary, the extraction process can be conceptualized as a two-step mapping:

$$X \xrightarrow{F} N \xrightarrow{G} S.$$

where, *F* performs the semantic labeling, while *G* constructs the semantic graph.

However, applying these functions to real-world archaeological tables presents significant challenges, as the effectiveness of *F* and *G* depends primarily on two factors: (i) the scope and specificity of CIDOC CRM, and (ii) the formulation of the prompt provided to the LLM. These practical constraints motivate the research questions considered in the following section.

However, applying these functions to real archaeological tables is challenging because the effectiveness of *F* and *G* depends on two main factors: (i) the extent of CIDOC CRM context, and (ii) the way the prompt is formulated for the LLM. These practical considerations motivate the research questions presented in the following section.

# 4 Our Approach to Automating RDF Extraction Aligned with CIDOC CRM

While LLMs demonstrate remarkable capabilities in generating structured RDF data from textual sources, their performance can be highly sensitive to two key factors: the explicit inclusion of ontology descriptions and the formulation of the prompt. Ontologies such as CIDOC CRM encode essential domain knowledge, but it remains an open question whether incorporating them directly into prompts improves extraction quality. Moreover, prompt engineering decisions may affect the model's ability to generalize from examples and correctly apply ontological structures. Gaining insight into these factors is critical for designing effective LLM-based knowledge extraction pipelines. To address these concerns, we formulate the following two research questions:

**Ontology scope:** *how does providing ontology description (O) impact the quality of RDF extraction?*

**Prompt Pattern:** *which prompt configuration (P) maximizes extraction accuracy and generalization?*

## 4.1 Ontology Scope

Our goal was to develop several Knowledge Extraction strategies, each varying in the level of information about CIDOC CRM provided in the prompt. To facilitate comparison, we ensured a consistent prompt template, based on the well-established role-based prompting method. This approach led to the definition of the following three strategies.
***Unguided LLM Extraction.*** Since LLMs are trained on web data that includes the entire CIDOC CRM documentation, this approach evaluates whether prior knowledge is sufficient to extract meaningful RDF data. The first strategy, therefore, uses an LLM without any ontological guidance, relying solely on a generic instruction to extract RDF triples. The prompt used is presented in Figure 1 (excluding "With Ontology Description" part for this strategy). It consists of the basic directives, i.e., the model's role, task definition and input/output format.

***Full Ontology Prompting.*** Even if the LLM has prior knowledge of CIDOC CRM, including the description of the CIDOC CRM ontology in the prompt may help the model focus specifically on this ontology, leading to better RDF data extraction. Therefore, our second strategy injects the complete textual description of the CIDOC CRM ontology into the prompt. As shown in Figure 1, the prompt includes both the model's role and task directive, along with the full set of ontology classes and properties. In addition to the ontology, the prompt contains an example transformation and the data chunk. This structure enables the LLM to map input content to the appropriate CIDOC CRM elements and generate syntactically valid RDF triples.

***Ontology Subset Prompting.*** CIDOC CRM is a large ontology with hundreds of classes and properties, which introduces two potential challenges for the previously devised strategy. First, the prompt becomes excessively long due to the extensive nature of the ontology, potentially exceeding the model's context window limit. Second, the ontology includes class hierarchies with multiple levels, which may prevent the LLM from accurately identifying the specific class or subclass that needs to be instantiated.

To mitigate this, we introduce a third strategy that retains the original prompt structure but uses a curated ontology subset tailored to archaeology. It emphasizes precise and relevant classes, "E22 Human-Made Object" over the broader "E19 Physical Object", while excluding less relevant ones from biology or law. Leveraging the increased prompt space, we add detailed class and property descriptions to reduce model hallucinations. This approach aims to improve RDF granularity for tasks like artifact classification and provenance tracking. The experiments conducted to evaluate which strategy yields the best results are presented in the next section.

## 4.2 Prompt Pattern

Even when a suitable ontology is provided, the structure of the prompt plays a major role in shaping the model's interpretation of the task, its ability to generalize, and the consistency of its output. To investigate this, we complemented variations in ontology context with a systematic exploration of example-based prompt patterns, aiming to assess how different forms of exemplification influence the model's capacity to generate high-quality RDF triples.

Alternative approaches such as chain-of-thought prompting or full supervised fine-tuning are less suitable for our use case. These methods either require substantial amounts of training data or deviate from our focus on prompt-based
<figure><img src="image_2.png" /><figcaption>**Fig. 1.** Prompt Template Representation</figcaption></figure>

knowledge extraction. Furthermore, techniques like chain-of-thought can introduce confounding variables (e.g., inconsistent reasoning paths), complicating controlled evaluations. By limiting our analysis to three well-established and directly comparable example-based prompt patterns, we aim to ensure that our findings remain interpretable and practically relevant for ontology-driven RDF extraction tasks.

*Zero-shot Prompting.* In this setting, the prompt follows the template illustrated in Figure 1, but excludes any input-output examples. It includes only the essential role-based components: the model’s assigned role, a definition of the task, specifications of the input and output formats, and, when applicable, the ontology description. Without explicit examples, the model relies solely on its pre-trained knowledge and its interpretation of the task description to generate RDF triples.

*One-shot Prompting.* This strategy extends the zero-shot prompt by incorporating a single, concrete example that illustrates the transformation of an input text into RDF triples compliant with CIDOC CRM. The goal is to guide the model by demonstrating the expected mapping process without overloading it with numerous examples. While this one-shot approach can improve performance, it still exhibits limitations when applied to real-world data. For instance, in cases involving incomplete information—such as “A fragmentary ceramic vessel with no discernible decoration, possibly from Chamber II, dating uncertain”—the model may struggle to appropriately handle missing or ambiguous attributes. Similarly,
when multiple instantiations are required, such as varying representations of locations ("Chamber I, south wall" versus "coordinates: 43.1234°N, 1.2345°E"), the model may find it difficult to select the correct CIDOC CRM classes, such as E53 Place or E47 Spatial Coordinates. These challenges motivated the adoption of a few-shot strategy, which introduces more diverse examples to support the model's ability to generalize across heterogeneous data inputs.

*Few-shot Prompting.* To further enhance the model's ability to generalize and handle diverse data scenarios, the few-shot prompt includes multiple examples (three in our case), all drawn from the Hypogée des Dunes dataset. These examples are deliberately varied in terms of data source, the presence or absence of specific information, and the classification requirements imposed by different data types. Each example illustrates the transformation from raw text to RDF triples, showcasing a range of CIDOC CRM classes and properties relevant to the archaeological context of the Hypogée des Dunes. By exposing the model to these nuanced variations, the few-shot strategy aims to improve generalization, minimize hallucinations, and ensure consistent RDF generation across heterogeneous real-world inputs.

*Example Format.* For both one-shot and few-shot prompts, we employ a consistent and formalized example format that explicitly illustrates the transformation from unstructured text to structured RDF triples. Each example typically comprises an identifier, a class assignment, and a set of RDF properties linking the subject to relevant concepts or entities. The RDF data is represented using the machine-readable JSON-LD serialization, which ensures the output is both human-interpretable and compatible with downstream semantic web tools. This standardized format distinctly separates the original textual description from its corresponding RDF representation, facilitating the model's ability to learn the mapping between the two. By applying this format uniformly across all examples, regardless of dataset origin, we enhance reproducibility, support systematic evaluation, and enable seamless integration into diverse archaeological knowledge extraction workflows.

To clarify the propositions presented informally above, we introduce in the next section a formalization of these methods.

## 4.3 Formal Framework for our Propositions

We define the prompt-based knowledge extraction task as a function:

$$f : (T, P, O) \to R$$

where:

* T is the textual input chunk to be processed.

* P denotes the prompt configuration (zero-shot, one-shot, few-shot).

* O the ontology context, indicating the degree of ontological information in the prompt.
* R is the resulting RDF representation.

**Prompt Pattern.** We formalise the prompt pattern P as:

$$P \in \{P_0, P_1, P_n\}$$

where:

* $P_0$: zero-shot (prompt includes only task instructions and structure).

* $P_1$: one-shot (prompt includes one example transformation).

* $P_n$: few-shot (prompt includes n examples, with $n \ge 2$).

**Ontology Context.** We formalise the ontology context O as:

$$O \in \{O_\emptyset, O_{full}, O_{subset}\}$$

where:

* $O_\emptyset$: no ontology description provided in the prompt (unguided extraction).

* $O_{full}$: complete textual description of the CIDOC CRM ontology provided.

* $O_{subset}$: curated subset of the ontology tailored to archaeology.

**Prompt Composition.** Each prompt $\pi$ is defined as the concatenation:

$$\pi = [\text{Task Instructions}] + O + P + T$$

where:

* [Task Instructions]: A role-based instruction describing the model's role (e.g., "You are an expert in RDF extraction...").

* O: the ontology context.

* P: one or more example transformations (for one-shot and few-shot).

* T: the textual input chunk.

We present our evaluation of the different prompts designed according to this formal framework in the next section.

# 5 Experimental Setup

## 5.1 Datasets

This study uses structured CSV data provided by archaeologists who researched the *Hypogeum of the Dunes*, including stratigraphic units, a lapidary inventory, and geological data. The dataset was converted into RDF triples for semantic representation. To ensure methodological reliability, unstructured textual data was excluded due to the absence of a validated reference RDF dataset. For consistency with other sections of this paper, we refer to the lapidary inventory dataset as "Inv. lapidary". Key dataset statistics are presented in Table 1.
<table><caption>**Table 1.** Statistics of the datasets used for RDF extraction.</caption><thead><tr><th>Dataset</th><th>Nb. Rows</th><th>Nb. Columns</th><th>Nb. Annotations</th></tr></thead><tbody><tr><td>Stratigraphic unit list</td><td>182</td><td>8</td><td>2,304</td></tr><tr><td>Facts list</td><td>80</td><td>10</td><td>1,186</td></tr><tr><td>Inv. lapidary</td><td>68</td><td>12</td><td>1,740</td></tr><tr><td>Stone and geology corresponding list</td><td>68</td><td>9</td><td>1,237</td></tr></tbody></table>

## 5.2 Models

To examine the influence of deployment strategy and model architecture on RDF extraction performance, we selected three representative LLMs spanning two deployment categories: online (cloud-based) and local (self-hosted). For the online model, we selected GPT-4o [6] (OpenAI), a state-of-the-art commercial language model recognized for its advanced reasoning capabilities, broad coverage of diverse training corpora, and widespread adoption in both academic research and industrial applications. For the local models, we selected Llama 3.1 [5] (Meta) and Mistral 7B [8] (Mistral AI), representing high-performance open-source models that can be hosted on local infrastructure, offering enhanced control, data privacy, and customization. These models differ in parameter size, context window, and training corpus composition, allowing us to systematically investigate how deployment strategy and model design influence the generation of CIDOC CRM-compliant RDF data. Table 2 summarises the key technical specifications of the selected models.

<table><caption>**Table 2.** Technical description of the selected LLMs.</caption><thead><tr><th>Model</th><th>Provider</th><th>Parameter</th><th>Context</th><th>Window</th><th>Deployment</th></tr></thead><tbody><tr><td>GPT-4o<sup>1</sup></td><td>OpenAI</td><td>~1.5T</td><td>128k tokens</td><td>Cloud</td><td></td></tr><tr><td>Llama 3.1<sup>2</sup></td><td>Meta</td><td>8B</td><td>128k tokens</td><td>Local</td><td></td></tr><tr><td>Mistral<sup>3</sup></td><td>Mistral AI</td><td>7B</td><td>32k tokens</td><td>Local</td><td></td></tr></tbody></table>

For the local deployment of Llama 3.1 and Mistral 7B, we utilized a high-performance local server to ensure efficient model inference and to enable precise performance measurements. The server specifications are as follows:

- RAM: 756 GB

- CPU: AMD EPYC 7543P, 32 cores, 64 threads

- GPU: 2 x NVIDIA A10 (24GB)

<footnote n="1">¹ https://openai.com/index/hello-gpt-4o/</footnote>

<footnote n="2">² https://ai.meta.com/blog/meta-llama-3-1/</footnote>

<footnote n="3">³ https://mistral.ai/news/announcing-mistral-7b</footnote>
## 5.3 Experimental Design

To facilitate the extraction of RDF triples from archaeological datasets, we developed a modular and scalable pipeline tailored to the challenges of processing structured CSV data with LLMs. Recognizing that LLMs often struggle with long inputs and that output truncation can degrade result quality, we divided the input CSV files into manageable 20-row chunks. This chunking strategy ensures that each prompt remains within the model's context window, while also preserving semantic coherence across rows.

Each chunk is then integrated into a carefully constructed prompt that includes: (1) the relevant CIDOC CRM ontology description (either the full ontology or a domain-specific subset selected by an expert); (2) a dataset-specific example that demonstrates how to map real archaeological data to ontology-aligned RDF triples; and (3) a prompt pattern (zero-shot, one-shot, or few-shot) that guides the model's reasoning process.

The output generated by the LLM is expected to be a structured list of RDF triples, which we serialize in JSON-LD format to enable seamless integration into knowledge bases. To enhance interoperability and facilitate downstream analysis, we also apply post-processing steps to ensure consistent syntax and alignment with CIDOC CRM standards.

The entire pipeline is implemented in Python using the LangChain framework, which provides flexible modules for prompt engineering, LLM interaction, and output handling. Figure 2 illustrates the complete architecture, highlighting how each component contributes to transforming raw archaeological data into structured knowledge graphs.

Code is available at https://forge.lias-lab.fr/cidoccrm-llm-extractor.

<figure><img src="image_3.png" /><figcaption>Fig. 2. Ontology-guided RDF extraction pipeline using LLMs</figcaption></figure>

## 5.4 Evaluation Metrics

We evaluate ontology population using precision and recall, comparing extracted triples to an expert-curated gold standard. Precision measures the proportion of correct triples, while recall assesses how comprehensively relevant semantic relations are captured. The evaluation also uses domain-specific competency
questions to test the relevance of the extracted triples, focusing on capturing interdisciplinary links (e.g., archaeology and geology) and identifying key domain concepts. For example, the question "Which stratigraphic units contain mortar, and where are they located within the site?" evaluates the model's ability to link material use with spatial and contextual information.

# 6 Results

In this section, we present the results of our experiments. Our analysis addresses the following key questions:

1. *Ontology scope:* how does the inclusion of an explicit ontology description affect the quality of RDF extraction?

2. *Prompt Pattern:* which prompt configuration (zero-shot, one-shot or few-shot) maximizes extraction accuracy and generalization?

3. *Environmental Impact:* what is the carbon footprint associated with using these LLMs, considering their deployment type and configuration?

## 6.1 Ontology Scope

The *Unguided LLM Extraction* strategy led to unsatisfactory results: the LLM, trained for general-purpose tasks, often failed to align with the CIDOC CRM ontology. It frequently used overly generic labels (e.g., "object" instead of "E22 Human-Made Object" or "E78 Collection"), causing semantic errors.

The other two strategies yielded better results, highlighting the importance of including the CIDOC CRM description in the prompt. Table 3 presents precision and recall results on the most representative datasets, selected due to space constraints, while Table 4 shows the CQ Scores.

Our results show that using a subset of the CIDOC CRM leads to improved precision and recall compared to the full ontology (see Table 3). In the *Full Ontology Prompting* strategy, the model occasionally defaulted to overly general classes, for example labeling artifacts as "E19 Physical Object" instead of the more specific "E22 Human-Made Object," which limited the granularity and precision of the extracted knowledge.

By restricting the ontology to archaeology-specific entities, the *Ontology Subset Prompting* strategy produced more accurate RDF triples and fewer errors from ambiguity or irrelevant mappings. It favors precise classes like "E22 Human-Made Object" over generic ones like "E19 Physical Object," aligning better with expert expectations. This also improved competency question success, as shown in Table 4, since the model was guided toward relevant semantic structures.

Analyzing the results from our best strategy, *Ontology Subset Prompting*, revealed that some errors were not due to the extracted triples but stemmed from inconsistencies in the source data. Since our datasets were derived from working study documents, they often included heterogeneous formatting, such as inconsistent delimiters, irregular punctuation, or ambiguous notations. In these cases,
<table><caption>**Table 3.** Precision and recall by prompting strategy, model, and dataset</caption><thead><tr><th rowspan="2">Strategy</th><th rowspan="2">Dataset</th><th rowspan="2">Model</th><th colspan="3">Precision (%)</th><th colspan="3">Recall (%)</th></tr><tr><th>Zero</th><th>One</th><th>Few</th><th>Zero</th><th>One</th><th>Few</th></tr></thead><tbody><tr><td rowspan="5">Full Ontology<br>Prompting</td><td rowspan="3">Facts List</td><td>GPT-4o</td><td>17.0</td><td>76.3</td><td>88.1</td><td>11.5</td><td>63.2</td><td>76.8</td></tr><tr><td>Llama 3</td><td>14.0</td><td>60.2</td><td>68.4</td><td>9.0</td><td>49.5</td><td>58.2</td></tr><tr><td>Mistral</td><td>11.5</td><td>55.8</td><td>63.1</td><td>7.0</td><td>45.3</td><td>52.0</td></tr><tr><td rowspan="2">Inv. Lapidary</td><td>GPT-4o</td><td>16.5</td><td>77.2</td><td>89.3</td><td>10.8</td><td>64.0</td><td>78.0</td></tr><tr><td>Llama 3</td><td>13.2</td><td>61.7</td><td>70.0</td><td>8.7</td><td>50.4</td><td>59.3</td></tr><tr><td rowspan="5">Ontology Subset<br>Prompting</td><td rowspan="3">Facts List</td><td>Mistral</td><td>11.0</td><td>57.3</td><td>64.5</td><td>7.5</td><td>46.1</td><td>53.2</td></tr><tr><td>GPT-4o</td><td>19.0</td><td>85.0</td><td>90.2</td><td>12.5</td><td>71.5</td><td>79.1</td></tr><tr><td>Llama 3</td><td>15.5</td><td>66.5</td><td>74.2</td><td>10.0</td><td>55.7</td><td>63.0</td></tr><tr><td rowspan="2">Inv. Lapidary</td><td>Mistral</td><td>13.0</td><td>61.9</td><td>68.3</td><td>8.2</td><td>51.0</td><td>58.6</td></tr><tr><td>GPT-4o</td><td>18.0</td><td>84.8</td><td>91.0</td><td>11.8</td><td>70.7</td><td>80.5</td></tr><tr><td rowspan="2">Ontology Subset Prompting</td><td rowspan="2"></td><td>Llama 3</td><td>14.5</td><td>65.1</td><td>73.0</td><td>9.5</td><td>54.4</td><td>61.5</td></tr><tr><td>Mistral</td><td>12.0</td><td>60.0</td><td>66.1</td><td>7.8</td><td>49.3</td><td>56.0</td></tr></tbody></table>

<table><caption>**Table 4.** CQ score by prompting strategy, model, and prompt type</caption><thead><tr><th rowspan="2">Strategy</th><th rowspan="2">Model</th><th colspan="3">CQ Score (%)</th></tr><tr><th>Zero-shot</th><th>One-shot</th><th>Few-shot</th></tr></thead><tbody><tr><td rowspan="3">Full Ontology Prompting</td><td>GPT-4o</td><td>18.0</td><td>72.4</td><td>79.3</td></tr><tr><td>Llama 3</td><td>15.3</td><td>45.8</td><td>52.6</td></tr><tr><td>Mistral</td><td>13.4</td><td>41.3</td><td>47.0</td></tr><tr><td rowspan="3">Ontology Subset Prompting</td><td>GPT-4o</td><td>21.1</td><td>85.2</td><td>88.5</td></tr><tr><td>Llama 3</td><td>17.4</td><td>54.6</td><td>60.1</td></tr><tr><td>Mistral</td><td>14.8</td><td>49.2</td><td>53.5</td></tr></tbody></table>

the model attempted to correct the issues, leading to semantic confusion. For example, hyphenated entries like “US12-US14” were sometimes misinterpreted as a single unit rather than distinct ones.

The analysis also showed that further work is needed to define the optimal CIDOC CRM subset to include in the prompt. In the *Ontology Subset Prompting* strategy, we observed that the model might miss useful information if their corresponding classes were excluded from the subset. While this improves overall precision, it limits the breadth of the extracted knowledge. Among all tested models, GPT-4o achieved the best results across all configurations.

## 6.2 Prompt Pattern

The *Zero-shot Prompting* configuration yielded the lowest performance, with the model often producing incomplete or inconsistent triples. Without any guidance from examples, the LLM relied solely on its pre-trained knowledge, leading
to variability in both structure and content. This often manifested as missing relationships or inconsistent application of CIDOC CRM classes.

In contrast, the *One-shot Prompting* configuration showed noticeable improvements in both precision and recall. The inclusion of a single example provided a concrete template for the LLM to emulate, leading to a more consistent output structure and a moderate reduction in semantic errors.

The *Few-shot Prompting* configuration outperformed both zero-shot and one-shot configurations. By providing multiple, diverse examples, the LLM was better able to generalize across different archaeological contexts and handle variations in data presentation. This configuration produced the highest precision and recall scores (see Table 3), as well as the most consistent CQ score structure across different models (see Table 4).

Interestingly, we observed a trade-off between example diversity and extraction flexibility. One-shot prompting, despite providing only a single transformation case, allowed the model to generalize more freely and propose novel RDF structures not explicitly shown in the example. In contrast, few-shot prompting exposed the model to a wider range of typical cases, improving consistency and alignment with expected outputs but also reducing its ability to generate original or unexpected triples.

## 6.3 Environmental Impact

Beyond extraction performance, Table 5 presents the estimated carbon footprint (in gCO2eq) for each prompting strategy across all evaluated models and prompt configurations. Emissions were computed using CodeCarbon<fnref n="4" /> for local inference and EcoLogits<fnref n="5" /> for cloud-based API calls, ensuring consistent measurement across deployment environments.

The results show that GPT-4o produces substantially higher emissions particularly under few-shot settings that involve longer prompts and more extensive inference. In contrast, local models such as Llama 3.1 and Mistral 7B exhibit significantly lower carbon footprints.

This difference stems from several contributing factors, notably the number of model parameters, the length of prompts, and the size of the generated output. Larger models inherently require more computational power, and their energy consumption increases further with complex prompting schemes. While few-shot prompting consistently improves RDF extraction quality, it also demands greater resources, resulting in higher environmental impact. These observations highlight the importance of smaller, task-oriented models as a more sustainable alternative to large, general-purpose systems, whose broad capabilities often come at the cost of significant and sometimes unnecessary computational overhead in domain-specific scenarios.

<footnote n="4">⁴ https://codecarbon.io/</footnote>

<footnote n="5">⁵ https://ecologits.ai/</footnote>
<table><caption>**Table 5.** Carbon Footprint (gCO₂eq) by Model, Prompting Strategy, and Prompt Type</caption><thead><tr><th rowspan="2">Strategy</th><th rowspan="2">Model</th><th colspan="3">Prompt Type</th></tr><tr><th>Zero-shot</th><th>One-shot</th><th>Few-shot</th></tr></thead><tbody><tr><td rowspan="3">Unguided Prompt</td><td>GPT-4o</td><td>13.72</td><td>17.94</td><td>20.44</td></tr><tr><td>Llama 3.1</td><td>0.16</td><td>0.22</td><td>0.25</td></tr><tr><td>Mistral</td><td>0.06</td><td>0.08</td><td>0.13</td></tr><tr><td rowspan="3">Full Ontology Prompt</td><td>GPT-4o</td><td>23.76</td><td>23.85</td><td>27.18</td></tr><tr><td>Llama 3.1</td><td>0.12</td><td>0.11</td><td>0.15</td></tr><tr><td>Mistral</td><td>0.06</td><td>0.08</td><td>0.09</td></tr><tr><td rowspan="3">Ontology Subset Prompt</td><td>GPT-4o</td><td>26.03</td><td>26.67</td><td>27.63</td></tr><tr><td>Llama 3.1</td><td>0.13</td><td>0.18</td><td>0.19</td></tr><tr><td>Mistral</td><td>0.06</td><td>0.07</td><td>0.10</td></tr></tbody></table>

# 7 Conclusion and Future Work

In this paper, we examined the ability of LLMs to extract CIDOC CRM compliant RDF triples from real-world archaeological datasets. Our results indicate that although LLMs are trained on web data that includes the CIDOC CRM documentation, this prior knowledge alone is insufficient to achieve accurate and consistent RDF extraction. Simply providing the full CIDOC CRM description in the prompt also has drawbacks: it leads to long prompts that may exceed some LLMs' context window limitations, and it often causes the models to default to overly general classes due to the extensive class hierarchies within CIDOC CRM.

To address these challenges, we introduced a new approach based on a carefully selected subset of CIDOC CRM classes and properties, curated by a domain expert and embedded in the prompt. This focused approach improved performance, yielding precision and competency question success rates exceeding 80%. Additionally, our experiments highlighted the significant impact of prompt patterning (zero-shot, one-shot, and few-shot configurations) on RDF extraction quality. For example, in the *Ontology Subset Prompting* configuration, the best-performing model, GPT-4o, achieved a precision of 90.6% and a CQ Score of 88.5% in the few-shot setting. These results demonstrate that few-shot prompting consistently produced the most accurate and consistent outputs, thanks to its inclusion of multiple, diverse examples that improved generalization across different archaeological contexts.

However, the subset approach also restricts the scope of the extracted knowledge, occasionally omitting relevant triples outside the selected classes. This limitation highlights the need for more adaptable ontology integration to balance precision with broader coverage.

Future work should explore both the automatic selection of relevant classes and properties, reducing the manual effort required to curate ontology subsets, and the use of smaller, locally deployed models as a viable alternative to large
scale cloud based systems. Fine-tuning these models with domain specific exam-
ples and structured RDF knowledge can significantly enhance their extraction
capabilities, enabling them to handle a broader range of archaeological data
while maintaining high-quality output. This approach not only improves preci-
sion but also addresses key concerns related to data security and environmental
sustainability, as smaller models typically require fewer resources and produce
lower carbon emissions than large, general-purpose systems.

References

1. Biemann, C.: Ontology learning from text: A survey of methods. Journal for Language Technology and Computational Linguistics **20**(2), 75–93 (2005)

2. Ding, N.P., Du, J., Feng, Z.: Knowledge prompt chaining for semantic modeling. arXiv preprint arXiv:2501.08540 (2025)

3. Doerr, M.: The cidoc conceptual reference module: an ontological approach to semantic interoperability of metadata. AI magazine **24**(3), 75–75 (2003)

4. Freund, M., Dorsch, R., Schmid, S., Wehr, T., Harth, A.: Enriching rdf data with llm based named entity recognition and linking on embedded natural language annotations. In: International Knowledge Graph and Semantic Web Conference. pp. 109–122. Springer (2024)

5. Grattafiori, A., Dubey, A., Jauhri, A., Pandey, A., Kadian, A., Al-Dahle, A., Letman, A., Mathur, A., Schelten, A., Vaughan, A., et al.: The llama 3 herd of models. arXiv preprint arXiv:2407.21783 (2024)

6. Hurst, A., Lerer, A., Goucher, A.P., Perelman, A., Ramesh, A., Clark, A., Os-
trow, A., Welihinda, A., Hayes, A., Radford, A., et al.: Gpt-4o system card. arXiv
preprint arXiv:2410.21276 (2024)

7. Imsombut, A., Sirikayon, C.: An alternative technique for populating thai tourism ontology from texts based on machine learning. In: 2016 IEEE/ACIS 15th International Conference on Computer and Information Science. pp. 1–4. IEEE (2016)

8. Jiang, F.: Identifying and mitigating vulnerabilities in llm-integrated applications. Master's thesis, University of Washington (2024)

9. Loffredo, R., De Santo, M.: Using ontologies for llm applications in cultural heritage (2024)

10. Maynard, D., Li, Y., Peters, W.: Nlp techniques for term extraction and ontology population. (2008)

11. Petasis, G., Karkaletsis, V., Paliouras, G., Krithara, A., Zavitsanos, E.: Ontology population and enrichment: State of the art. Knowledge-driven multimedia information extraction and ontology evolution: Bridging the semantic gap pp. 134–166 (2011)

12. Sambandam, P., Yuvaraj, D., Padmakumari, P., Swaminathan, S.: Spiking equilibrium convolutional neural network for spatial urban ontology. Neural Processing Letters **55**(6), 7583–7602 (2023)

13. de Souza, R.R., Pinheiro, T.L., Oliveira, J.C.B., dos Reis, J.C.: Knowledge graphs extracted from medical appointment transcriptions: Results generating triples relating on llms. In: KEOD. pp. 129–139 (2023)

14. Suchanek, F., Ifrim, G., Weikum, G.: Leila: Learning to extract information by linguistic analysis. In: Proceedings of the 2nd Workshop on Ontology Learning and Population: Bridging the Gap between Text and Knowledge. pp. 18–25 (2006)

15. Trajanoska, M., Stojanov, R., Trajanov, D.: Enhancing knowledge graph construc-
tion using large language models. arXiv preprint arXiv:2305.04676 (2023)