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

HAL
open science

# LP4P: Link Prediction over Annotated Knowledge Graphs with Four Patterns

Manoé Kieffer, Hugo Chabane, Patricia Serrano-Alvarado, Khalid Belhajjame

► To cite this version:

Manoé Kieffer, Hugo Chabane, Patricia Serrano-Alvarado, Khalid Belhajjame. LP4P: Link Prediction over Annotated Knowledge Graphs with Four Patterns. International Conference on Knowledge Capture (K-CAP), Dec 2025, Dayton, OH, USA, United States. 10.1145/3731443. hal-05307387

HAL Id: hal-05307387

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

Submitted on 15 Dec 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.

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

Distributed under a Creative Commons Attribution 4.0 International License
# LP4P: Link Prediction over Annotated Knowledge Graphs with Four Patterns

Manoé Kieffer

manoe.kieffer@univ-nantes.fr

Nantes University, LS2N, CNRS, UMR6004

44000 Nantes, France

Patricia Serrano-Alvarado

patricia.serrano-alvarado@univ-nantes.fr

Nantes University, LS2N, CNRS, UMR6004

44000 Nantes, France

Hugo Chabane

hugo.chabane@univ-nantes.fr

Nantes University, LS2N, CNRS, UMR6004

44000 Nantes, France

Khalid Belhajjame

Khalid.Belhajjame@dauphine.fr

PSL, Université Paris Dauphine, LAMSADE

75775 Paris, France

## Abstract

Initially designed for Knowledge Graphs (KG) containing plain (s, p, o) triples, research on link prediction has evolved to address more complex structures such as hypergraphs, hyper-relational graphs, and bi-level graphs. These advancements push link prediction to handle annotation patterns where a triple is annotated with another (t, p, t), or where a triple is annotated with qualifiers (t, p, o). However, each approach focuses on a single annotation pattern, and the case where a triple is annotated with a subject (s, p, t) has never been explored. In this paper, we propose LP4P, the first link prediction model capable of predicting entities in both plain triples and three annotation patterns. LP4P captures the information expressed in annotations through a four-pattern attention layer, and its loss function further leverages the ontological information of KGs. Moreover, we built WD4P, an RDF KG derived from baseline datasets, which includes the four patterns. Extensive empirical evaluations demonstrate that LP4P outperforms relevant state-of-the-art models on knowledge graphs with the four patterns, and achieves comparable performance on standard benchmarks.

## CCS Concepts

* General and reference → General conference proceedings; Experimentation; * Computing methodologies → Machine learning; Neural networks; Learning latent representations.

## Keywords

Link prediction, knowledge graphs, triple annotations

## ACM Reference Format:

Manoé Kieffer, Hugo Chabane, Patricia Serrano-Alvarado, and Khalid Belhajjame. 2025. LP4P: Link Prediction over Annotated Knowledge Graphs with Four Patterns. In *Knowledge Capture Conference 2025 (K-CAP '25), December 10–12, 2025, Dayton, OH, USA*. ACM, New York, NY, USA, 8 pages. https://doi.org/10.1145/3731443.3771353

## 1 Introduction

A popular class of Knowledge Graphs (KG) is encoded using the Resource Description Framework (RDF), where information in a graph is represented as (*subject*, *predicate*, *object*) triples. The need to annotate triples emerged to express complex metadata such as provenance, trustworthiness, quality, versioning, and various contextual information. Large KGs like Wikidata and Yago use annotations. Multiple syntaxes exist to express them including Standard reification [21], Singleton properties [22], N-ary relations [23], Wikidata qualifiers [13], Named graphs [3], and RDF-star [12].

Figure 1 shows triples with annotations describing information about political personalities. Triples that are annotated are represented with a rectangle. For instance, the triple *t1* is annotated using the property *replaces* to specify the predecessor of Barack Obama's tenure. Annotation patterns vary depending on whether the subject and/or the object of a triple includes another. We can define four patterns, with *s* indicating a subject, *p* a predicate, *o* an object, and *t* an annotated triple:

* *s-p-o* pattern, is a base triple,

* *t-p-o* pattern, is an annotation with a base triple as subject (called annotated triple), e.g., (*t1*, *replaces*, George W. Bush),

* *s-p-t* pattern, is an annotation with a annotated triple in the object, e.g., (Barack Obama, *governed with*, *t3*),

* *t-p-t* pattern, is an annotation with a annotated triple in the subject and the object, e.g., (*t1*, *implies*, *t2*).

We consider facts, which contain one triple (not a set of triples) and annotations. A given triple can be annotated in several facts.

KGs are inherently incomplete. Link prediction is used to predict missing links for their completion, correction, or refinement. While most link prediction solutions assume the plain *s-p-o* pattern [2, 29], recent proposals have investigated this problem in the presence of annotations. They can be classified based on the annotation pattern they support. On the one hand, models made for hypergraphs [1, 6, 7, 10, 11, 17, 18, 37] or for hyper-relational graphs [4, 8, 9, 14, 19, 20, 25, 26, 30, 33–36] support the *t-p-o* pattern. They provide the means to predict the elements of the subject triple *t* or of the annotation on *t*. And on the other hand, models made for Bi-level graphs support the *t-p-t* pattern [5, 32]. They enable the prediction of elements of either *t* within a *t-p-t* pattern.

While the above proposals advanced the state of the art in link prediction for KGs with annotations, none simultaneously leverages

Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from permissions@acm.org.

K-CAP '25, Dayton, OH, USA

© 2025 Copyright held by the owner/author(s). Publication rights licensed to ACM.

ACM ISBN 979-8-4007-1867-0/25/12

https://doi.org/10.1145/3731443.3771353
<figure><img src="image_3.png" /><figcaption>Figure 1: Example of an annotated KG where *s* stands for subject, *p* for predicate, *o* for object, and *t* for annotated triple.</figcaption></figure>

all four patterns. We remark that Triple Terms are in the process of integrating RDF 1.2¹, which is evidence that practitioners push for support of all type of annotations. We also note that none of the proposals addresses the *s-p-t* pattern, despite its presence in Triple Terms use cases<fnref n="2" />. In addition, benchmark KGs used in existing works for link prediction do not cover the four patterns. With this in mind, the contributions of this paper are:

(1) LP4P: The first solution for link prediction capable of learning from and predicting within facts containing the four patterns through a four-pattern attention layer — an attention mechanism specifically designed to leverage the structural differences among all patterns (Section 4).

(2) WD4P: A benchmark RDF KG derived from real-world KGs that includes the four patterns (Section 5).

(3) Extensive empirical evaluations that compare LP4P with existing proposals by focusing on each pattern (Section 6).

In the following, Section 2 reviews related work. We define the link prediction task in Section 3, present our model LP4P in Section 4, and describe our benchmark WD4P in Section 5. Experimental results are reported in Section 6, and we conclude in Section 7.

## 2 Related Work

The field of link prediction has seen substantial growth in recent years [2, 29]. While initial efforts focused on basic KGs, where facts are modeled using plain triples. Recent proposals consider KGs with complex structures such as hypergraphs (Section 2.1), hyper-relational KGs (Section 2.2), and bi-level KGs (Section 2.3). Figure 2 shows recent and relevant works from these three domains.

### 2.1 Hypergraphs for *t*-p-o pattern prediction

Hypergraphs have been used as a means to model facts involving more than two entities. The majority of hypergraph models were proposed from 2019 to 2021, as seen in Figure 2. They were proposed for KG containing the *t*-p-o pattern, e.g., Wikidata. We consider them as a first attempt to leverage the *t*-p-o pattern, even if hypergraphs do not perfectly fit that description. Most hypergraph

models adapt existing methods for plain graphs, such as convolutions — in HGNN [7], NaLP [11], HGCN [1], HypE [6], RAM [18], and tNaLP [10] —, attention — in Hyper-SAGNN [37] and HGAT [1] —, or tensor decomposition in GETD [17]. For example, HypE, a representative and recent hypergraph-based model, represents a fact as a sequence of the form $r(e_1, e_2, ..., e_k)$, where *r* denotes a relation, and each $e_i$ represents an entity. HypE utilizes convolution as the core mechanism for link prediction. Its task involves predicting a missing entity in a given fact. Hypergraph models treat all entities within the facts indistinctively, and as such, they are not suitable for an annotated triple and its annotations. [25], that is part of the next section, has demonstrated that such proposals underperform for RDF KG prediction. Hypergraphs models such as RAM assign a role to each different entity of a relation. This allows RAM to fully capture the structure of a fact.

### 2.2 Hyper-relational graphs for *t*-p-o pattern prediction

Proposals in this category — including HINGE [25], NeuInfer [9], StarE [8], GRAN [30], Hyper2 [34], PolygonE [35], HyNT [4], Hyper-Former [14], ShrinkE [33], QUAD [26], HAHE [20], and DHGE [19] — distinguish the annotated triple from its associated annotations, making them more suitable for RDF KGs. As seen in Figure 2, the majority of hyper-relational models were proposed in 2022 and 2023, with preliminary works in 2020. This places hyper-relational models as successors to hypergraph models. Hyper-relational models represent a fact as a base triple (*s*, *p*, *o*) with associated key-value pairs ($k_i, v_i$). The models differ in two aspects: (i) their approach for leveraging information in the graph, (ii) the link prediction task targeted by the model. For instance, HINGE and StarE use message-passing (CNN [16] for HINGE and an extension of CompGCN [27] for StarE) to learn embeddings for the entities in the base triples. They enhance predictions in the base triples by incorporating the key-value pairs. We consider that as a limitation as predicting annotations can be important in domains such as in biomedicine.

Another set of proposals leverage the transformer model [28] to predict missing entities or relations in a hyper-relational fact. The transformer model has proven high efficiency in text-based tasks and is widely used in large language models. It is adapted to KGs

<footnote n="1">¹https://www.w3.org/TR/rdf12-concepts/#section-triple-terms</footnote>

<footnote n="2">²A list of concrete use cases for Triple Terms from the RDF & SPARQL working group: https://github.com/w3c/rdf-ucr/wiki/Summary</footnote>
<figure><img src="image_4.png" /><figcaption>Figure 2: Link prediction models beyond simple *s*-p-o patterns. Publications are represented as squares and are ordered by year. Arrows indicate that a model uses another. Models colored in gray are part of our experiments.</figcaption></figure>

by GRAN using edge-biased attention layers. GRAN represents a given hyper-relational fact as a graph, capturing its shape, each edge of that graph represents a biased attention that allows GRAN to reuse the transformer architecture while still capturing the shape of hyper-relational facts. HAHE reuses GRAN to capture fact-level information, and combines it with global-level information to improve predictions. To leverage semantic information, DHGE applies GRAN on both the facts and the ontology. These proposals are able to predict elements in the annotations as well as in the base triple.

## 2.3 Bi-level graphs for *t*-p-t pattern prediction

A bi-level KG contains base triples and *t*-p-t annotations. Currently, BiVE [5] and NestE [32], are the only models in this category. They operate similarly by generating embeddings for the base triples and using them to create the embeddings for the bi-level triples. Prediction-wise, they address two new tasks. (i) Triple prediction, which predicts complete annotated triple, i.e., (?, *p*, *t*) or (*t*, *p*,?). (ii) Conditional link prediction, which predicts the subject or object of an annotated triple within a bi-level triple.

The solutions we have surveyed address specific annotation patterns. Consequently, their application is limited to specific types of KGs. In addition, even though KGs contain rich semantic information through ontologies, models proposing solutions for prediction beyond plain *s*-p-o triples do not exploit it. DHGE is the only exception to that. Works like [15], show that including semantic validity in link prediction models improves results for rank-based metrics, and leads to more semantic valid predictions. Semantic validity is beneficial when predicting missing information without a ground truth or with the open world assumption, as it filters predictions that do not follow the ontology and therefore cannot be true.

LP4P, the model proposed in this paper, is the first link prediction solution able to predict a missing entity or relation within a fact

that contains the four patterns. For that, our model relies on an attention mechanism fitted for annotated KG with the four patterns. Furthermore, LP4P leverages the ontology present in a KG to boost the validity of its predictions via the use of semantic-enhanced labelling functions.

## 3 The annotation pattern prediction task

We focus on KGs containing not only base triples but also annotations on triples. We take into account three annotation patterns: *t*-p-o, *s*-p-t, and *t*-p-t. We consider facts composed of a based triple and several annotations. We do not consider literals nor nested annotations, i.e., triples with recursive annotations. Our prediction task focuses on predicting a missing entity or relation in a fact. Next we formally define these concepts.

**DEFINITION 1 (BASE TRIPLES T).** Given $\mathcal{E}$ a set of entities, $\mathcal{R}$ a set of relations, we define a set of base triples as $\mathcal{T} = \{(s, p, o) : s, o \in \mathcal{E}, p \in \mathcal{R}\}$. A fact composed of a base triple without annotations corresponds to the *s*-p-o pattern. We call annotated triples, base triples that are annotated at least once

**DEFINITION 2 (ANNOTATION PATTERNS).** Given $\mathcal{T}$, we define a set of annotations as $\mathcal{A} = \{(s, p, o) : s, o \in \mathcal{E} \cup \mathcal{T}, \{s, o\} \cap \mathcal{T} \neq \emptyset, p \in \mathcal{R}\}$, where at least the subject or the object is a base triple. This leads to three annotation patterns: *t*-p-o, *s*-p-t, and *t*-p-t.

**DEFINITION 3 (ANNOTATED KNOWLEDGE GRAPH G).** An annotated Knowledge Graph (annotated KG) is defined as $\mathcal{G} = (\mathcal{E}, \mathcal{R}, \mathcal{T}, \mathcal{A})$. With $\mathcal{E}$ a set of entities, $\mathcal{R}$ a set of relations, $\mathcal{T}$ a set of base triples, and $\mathcal{A}$ a set of annotations.

Therefore, considering an annotated KG, we define the following.

**DEFINITION 4 (ANNOTATION PATTERN PREDICTION).** Given $\mathcal{G}$ an annotated KG, the annotation pattern prediction task is to predict a missing entity or relation in a base triple or in an annotation pattern.
<figure><img src="image_5.png" /><figcaption>Figure 3: Training architecture of LP4P.</figcaption></figure>

For example, given an s-p-t annotation, the task of annotation pattern prediction is to predict a missing entity, (?, p, (s₂, p₂, o₂)), (s, p, (?, p₂, o₂)), or (s, p, (s₂, p₂, ?)), or a missing relation, (s, ?, (s₂, p₂, o₂)), (s, p, (o, ?, o₂)).

## 4 LP4P: Link Prediction for Four Patterns

LP4P builds upon the foundation laid by the attention principles formalized in transformers [28]. We propose an attention mechanism, called four-pattern attention, which allows LP4P to learn and predict over KGs with the four patterns. The global architecture is shown in Figure 3. Our approach extends the edge-biased attention proposed by GRAN. Furthermore, we use the semantic information expressed in ontologies to steer the model towards semantically valid predictions.

**Input embedding.** A 4P-sequence, detailed in Section 4.1, Equation 1, serves as the input for LP4P. It represents a fact and its annotations, with a masked term (marked with a ? in Figure 3). The 4P-sequence is embedded into a sequence of vectors - each relation and entity in the dataset has a different vector.

**Encoder stack.** The embedded sequences are given to a stack of L encoders. Each encoder contains a four-pattern attention layer as described in Section 4.1. This attention relies on the Equations 2 and 3 to bias the attention between pairs of terms. The biased attention is shown on the right-part of the Figure 3. The four-pattern attention is then followed by a post-processing layer, a feed forward neural network, and a second post-processing layer.

**Prediction.** To derive the final predictions, the resulting sequence of vectors is passed through a feed forward layer, a GELU activation function, and a final feed forward layer whose weights are shared with the input embedding layer.

**Loss function.** To train LP4P, we apply the Binary Cross Entropy Loss function (BCEL) between the input of the model and the ground truth labels. The labelling follows the soft labels approach or, if an ontology is available, a semantic labelling function as described in Section 4.2.

## 4.1 Four-pattern attention

To leverage the four patterns, we represent a fact in a 4P-sequence:

$$((s, p, o), (p, o)^i, (p, s)^j, (p, s_2, p_2, o_2)^k, (p, s_1, p_1, o_1)^l) \quad (1)$$

The first element contains a base triple which is the main triple of the fact. The next four elements represent annotations of that main triple. (p, o)^i allows i annotations with the t-p-o pattern. (p, s)^j allows j annotations with the s-p-t pattern. The last two elements express the t-p-t pattern. The second-to-last element uses the main triple as the subject, resulting in (s, p, o) p (s₂, p₂, o₂). The last element uses the main triple as the object, resulting in (s₁, p₁, o₁) p (s, p, o). Padding is used for terms that are not used in a fact, e.g., given a fact without annotation, only the (s, p, o) triple is relevant and the rest of the sequence is padded.

To push LP4P to learn the particular pairwise relation between terms in the 4P-sequence, we bias the model attention as shown in the biased attention matrix of Figure 3. A normal attention is represented by a white square, and four different biased attentions by particular symbols. LP4P learns two weights for each of the four biased attention: $e_{ij}^K$, $e_{ij}^V$.

* subject-relation bias, biases a subject entity and its relation;

* object-relation bias, biases an object entity and its relation;

* triple^s^-relation bias, biases the relation of a subject triple and the relation of its annotations;

* triple^o^-relation bias, biases the relation of an object triple and the relation of its annotations.

LP4P follows the equations for multi-head attention defined in [28]. Specifically, for each head and for each input term $x \in \mathbb{R}^d$, the multi-head attention computes an updated vector $z_l \in \mathbb{R}^{d_z}$, with $l = 1, ..., h$ and $d_z = \frac{d}{h}$, with the vector size $d$ and $h$ heads. For that, the vector $x$ is multiplied to the matrices $W^Q$, $W^K$, and $W^V$ in order to obtain three vectors named query, key, and value. The three vectors are then used as input to the heads. The attention between a given pair of vectors $x_i$ and $x_j$ is computed with:

$$\alpha_{ij} = \frac{(\mathbf{W}^Q x_i)^\top (\mathbf{W}^K x_j + \mathbf{e}_{ij}^K)}{\sqrt{d_z}} \quad (2)$$

Where $\mathbf{e}_{ij}^K$ is the weight learned by LP4P. Then, given all $\alpha_{ij}$, the output vector of a given head is computed as follows:

$$z_{il} = \sum_{j=1}^{|\mathcal{E} \cup \mathbb{R}|} \frac{\exp(\alpha_{ij})}{\sum_{k=1}^{|\mathcal{E} \cup \mathbb{R}|} \exp(\alpha_{ik})} (\mathbf{W}^V \mathbf{x}_j + \mathbf{e}_{ij}^V) \quad (3)$$

Where $\mathbf{e}_{ij}^V$ is the second weight learned by LP4P. The output vectors $z_{il}$ of all h heads are concatenated to obtain the updated vector $x_i$.

## 4.2 Semantic-based labelling functions

The most basic labelling function is the one hot encoding which labels the prediction target as 1, and false predictions as 0. The Soft labels function was proposed to prevent the overfitting that can be produced with one hot encoding. It labels the target as $\alpha$, and false predictions as $\frac{1-\alpha}{|N|-1}$, with $\alpha$ a learned hyperparameter and $N$ the set of predictions. Both labelling functions do not incorporate ontologies and potentially lead to ontologicaly invalid predictions. Thus, inspired by [15], we incorporate ontological information within the labelling function of the BCEL.
<table><caption>Table 1: Knowledge graphs statistics.</caption><thead><tr><th>Dataset</th><th>KG type</th><th>|E|</th><th>|R|</th><th>R in annotations</th><th>% of annotated triple</th><th>Base triple</th><th>s-p-o</th><th>t-p-o</th><th>s-p-t</th><th>t-p-t</th></tr></thead><tbody><tr><td>JF17K [31]</td><td>Hyper-relational</td><td>28,645</td><td>501</td><td>179</td><td>27.19%</td><td>75,026</td><td>54,627</td><td>60,400</td><td>0</td><td>0</td></tr><tr><td>WikiPeople [11]</td><td>Hyper-relational</td><td>34,825</td><td>178</td><td>79</td><td>2.41%</td><td>359,901</td><td>351,242</td><td>11,673</td><td>0</td><td>0</td></tr><tr><td>WD50K [8]</td><td>Hyper-relational</td><td>47,155</td><td>531</td><td>136</td><td>12.76%</td><td>233,711</td><td>204,117</td><td>46,645</td><td>0</td><td>0</td></tr><tr><td>FBH [5]</td><td>Bi-level</td><td>14,541</td><td>243</td><td>6</td><td>10.69%</td><td>310,116</td><td>276,959</td><td>0</td><td>0</td><td>27,062</td></tr><tr><td>FBHE [5]</td><td>Bi-level</td><td>14,541</td><td>247</td><td>10</td><td>10.87%</td><td>310,116</td><td>276,397</td><td>0</td><td>0</td><td><b>34,941</b></td></tr><tr><td>DBHE [5]</td><td>Bi-level</td><td>12,440</td><td>95</td><td>8</td><td>12.02%</td><td>68,296</td><td>60,090</td><td>0</td><td>0</td><td>6,717</td></tr><tr><td>WD4P</td><td>4 patterns</td><td>46,214</td><td>642</td><td>236</td><td>18.42%</td><td>252,550</td><td>206,030</td><td>22,045</td><td>21,878</td><td>12,294</td></tr><tr><td>WD4P-HR</td><td>Hyper-relational</td><td>44,938</td><td>525</td><td>119</td><td>5.86%</td><td>252,550</td><td>237,752</td><td>22,045</td><td>0</td><td>0</td></tr><tr><td>WD4P-BL</td><td>Bi-level</td><td>41,138</td><td>490</td><td>7</td><td>7.37%</td><td>252,550</td><td>233,936</td><td>0</td><td>0</td><td>12,294</td></tr></tbody></table>

We consider that when predicting a subject entity (or object), the prediction is semantically valid if one of the types, or super-types, of the entity corresponds to the domain (or range) of the direct relation. When predicting a relation, the prediction is semantically valid if its domain and range correspond to the types, or super-types, of its subject and object. We also verify ontology rules specifying that a relation should be used only in base triples or in annotations.

To steer LP4P towards semantically valid predictions, we propose two labeling functions that leverage the ontology: Semantic labels and Hybrid labels. They assign labels such that the target prediction label is higher than those of false but valid predictions, which, in turn, are higher than the labels of false but invalid predictions. Their difference is mainly due to the fact that Hybrid labels integrates Soft labels. Considering $\alpha$ and $\beta$ two learnable hyperparameters between 0 and 1, and $0 \le \alpha + \beta \le 1$. With $N$ the set of all entities or relations, and $C$ the set of valid entities or relations, depending on if the masked term is an entity or relation. Semantic labels assigns $\alpha$ to the target prediction, valid or not, $\frac{1-\alpha}{|C|}$ to false but valid predictions, and 0 to false and invalid predictions. Hybrid labels, assigns $\alpha$ to the target prediction, valid or not, $\frac{\beta}{|C|}$ to false but valid predictions, and $\frac{1-\alpha-\beta}{|N|-1}$ to false and invalid predictions.

# 5 Annotated Knowledge Graphs

Existing benchmark KGs made to evaluate link prediction do not contain the four patterns. This is because existing works focus on a single annotation pattern, either $t-p-o$ or $t-p-t$. Therefore we build a new annotated KG named WD4P (Wikidata with 4 Patterns).

Table 1 presents characteristics of annotated KGs. In particular, it provides statistics regarding the number of entities and relations, the proportion of annotated triples w.r.t. base triples, and the amount of each pattern. JF17K [31], WikiPeople [11], and WD50K [8] are hyper-relational KGs. While FBH, FBHE, and DBHE are bi-level KGs proposed by [5]. In the rest of this section, we describe the process to create WD4P and its subsets WD4P-HR and WD4P-BL.

The goal of WD4P is to include the four patterns. To build WD4P, we join WD50K and FBHE as they are both based on FB15K-237. Similar to WD50K, WD4P uses entities and relations from Wikidata.

Table 1 highlights in bold the different cardinalities used to compose WD4P. We also note that in WD4P an annotated triple is the focus an average of 1.7 annotations, with a maximum of 60

annotations. The different patterns were obtained like follows. (1) We obtained the base triples (and $s-p-o$ pattern) from the 233,711 base triples of WD50K and the annotated triples of FBHE. (2) We obtained the $t-p-o$ pattern by reusing half of the 46,645 annotations of WD50K. (3) To obtain the $s-p-t$, we reversed the other half of the annotations of WD50K by incorporating the appropriate symmetric relations. (4) We got the $t-p-t$ pattern by reusing as much of the 34,941 annotations of FBHE as possible. This method has for consequence that WD4P contains at most one annotation pattern per fact. Because WD50K facts contain only the $t-p-o$ pattern, or $s-p-t$ once reversed. While FBHE facts contain only a $t-p-t$ pattern.

For evaluation purposes, we built two subsets of WD4P. WD4P-HR, a hyper-relational KG containing only the $s-p-o$ and $t-p-o$ patterns. WD4P-BL, a bi-level KG containing only the $s-p-o$ and $t-p-t$ patterns. WD4P and its variants are randomly split into the same training set, validation set, and test set, respectively containing 80%, 10%, and 10% of the original information. As in [8] for WD50K, we eliminate test set leakages by removing facts from the train and validation sets that share their annotated triple with a fact of the test set. Then to ensure that every term in the test set has been seen during training, we remove facts from the test set that contain entities and relations not present in the train or validation sets.

# 6 Experimental Evaluation

In this section, we experimentally evaluate LP4P. The goal is three-fold: (i) to demonstrate that LP4P outperforms existing models when it leverages the four annotation patterns (Section 6.1), (ii) to show that LP4P remains competitive over baseline datasets with less patterns (Section 6.2), (iii) to confirm that LP4P can take advantage of semantic knowledge (Section 6.3). To enhance reproducibility and facilitate reuse, we provide a GitHub<fnref n="3" /> repository with LP4P's source code, detailed experimental setup, and supplementary results.

All experiments were conducted using NVIDIA A100 80GB GPUs or V100 32GB GPUs, deployed in a high performance computing environment. We ran the experiments on the KGs presented in Section 5. LP4P's hyperparameters are fine-tuned on each KG using Ray Tune [24]. Our baseline consists of the relevant models grayed out in Figure 2. We use our Pytorch implementation of GRAN<fnref n="4" />.

<footnote n="3">³https://gitlab.univ-nantes.fr/clara/graf</footnote>

<footnote n="4">⁴https://gitlab.univ-nantes.fr/clara/pytorch_gran</footnote>
<table><caption>Table 2: Entity prediction for the four patterns on WD4P, WD4P-HR, and WD4P-BL.</caption><thead><tr><th rowspan="2">KG</th><th rowspan="2">Model</th><th colspan="3">s-p-o entity</th><th colspan="3">t-p-o entity</th><th colspan="3">s-p-t entity</th><th colspan="3">t-p-t entity</th></tr><tr><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th></tr></thead><tbody><tr><td rowspan="8">WD4P-HR</td><td>HypE [6] †</td><td>*0.199</td><td>*0.126</td><td>*0.353</td><td>*0.262</td><td>*0.180</td><td>*0.421</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RAM [18]</td><td>*0.254</td><td>*0.184</td><td>*0.382</td><td>*0.382</td><td>*0.324</td><td>*0.496</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>HINGE [25] †</td><td>*0.195</td><td>*0.133</td><td>*0.318</td><td>*0.302</td><td>*0.206</td><td>*0.492</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>StarE [8]</td><td>*0.199</td><td>*0.120</td><td>*0.366</td><td>*0.326</td><td>*0.257</td><td>*0.455</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>pyGRAN</td><td>0.270</td><td>0.205</td><td>0.396</td><td>0.508</td><td>0.443</td><td>0.628</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ShrinkE [33]</td><td>*0.154</td><td>*0.089</td><td>*0.297</td><td>*0.179</td><td>*0.120</td><td>*0.297</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>HAHE [20]</td><td>*0.290</td><td>*0.211</td><td>*0.442</td><td>*0.561</td><td>*0.480</td><td>*0.711</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LP4P</td><td><strong>0.333</strong></td><td><strong>0.255</strong></td><td><strong>0.481</strong></td><td><strong>0.610</strong></td><td><strong>0.536</strong></td><td><strong>0.749</strong></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LP4P(HL)</td><td><u>0.332</u></td><td><u>0.254</u></td><td><u>0.482</u></td><td><u>0.620</u></td><td><u>0.545</u></td><td><u>0.762</u></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="4">WD4P-BL</td><td>BiVE [5]</td><td>0.239</td><td>0.158</td><td>0.403</td><td></td><td></td><td></td><td></td><td></td><td></td><td>0.218</td><td>0.132</td><td>0.401</td></tr><tr><td>NestE [32]</td><td>0.297</td><td>0.211</td><td>0.459</td><td></td><td></td><td></td><td></td><td></td><td></td><td>0.361</td><td>0.228</td><td><u>0.676</u></td></tr><tr><td>LP4P</td><td><strong>0.324</strong></td><td><strong>0.245</strong></td><td><strong>0.475</strong></td><td></td><td></td><td></td><td></td><td></td><td></td><td><strong>0.775</strong></td><td><strong>0.742</strong></td><td><strong>0.839</strong></td></tr><tr><td>LP4P(HL)</td><td><u>0.319</u></td><td><u>0.244</u></td><td><u>0.464</u></td><td></td><td></td><td></td><td></td><td></td><td></td><td><strong>0.782</strong></td><td><strong>0.754</strong></td><td><strong>0.839</strong></td></tr><tr><td rowspan="2">WD4P</td><td>LP4P</td><td><strong>0.331</strong></td><td><strong>0.251</strong></td><td><strong>0.485</strong></td><td><u>0.668</u></td><td><u>0.596</u></td><td><u>0.801</u></td><td><u>0.670</u></td><td><u>0.602</u></td><td><u>0.792</u></td><td><u>0.771</u></td><td><u>0.735</u></td><td><u>0.843</u></td></tr><tr><td>LP4P(HL)</td><td><u>0.328</u></td><td><u>0.248</u></td><td><u>0.481</u></td><td><u>0.680</u></td><td><u>0.610</u></td><td><u>0.808</u></td><td><u>0.677</u></td><td><u>0.613</u></td><td><u>0.792</u></td><td><u>0.800</u></td><td><u>0.773</u></td><td><u>0.855</u></td></tr></tbody></table>

<table><caption>Table 3: Entities link prediction on Hyper-relational KGs.</caption><thead><tr><th rowspan="3">Model type</th><th rowspan="3">Model</th><th colspan="6">WD50K</th><th colspan="6">WikiPeople</th><th colspan="6">JF17K</th></tr><tr><th colspan="3">Base triple entities</th><th colspan="3">All entities</th><th colspan="3">Base triple entities</th><th colspan="3">All entities</th><th colspan="3">Base triple entities</th><th colspan="3">All entities</th></tr><tr><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th></tr></thead><tbody><tr><td rowspan="2">Hyper-graph</td><td>HypE [6] †</td><td>*0.191</td><td>*0.123</td><td>*0.322</td><td>0.206</td><td>0.137</td><td>0.339</td><td>*0.317</td><td>*0.188</td><td>*0.520</td><td>0.319</td><td>0.190</td><td>0.522</td><td>*0.458</td><td>*0.369</td><td>*0.626</td><td>0.487</td><td>0.400</td><td>0.651</td></tr><tr><td>RAM [18]</td><td>*0.277</td><td>*0.215</td><td>*0.396</td><td>0.287</td><td>0.225</td><td>0.405</td><td>*0.440</td><td>*0.354</td><td>*0.577</td><td>0.441</td><td>0.355</td><td>0.577</td><td>*0.530</td><td>*0.448</td><td>*0.693</td><td>0.554</td><td>0.475</td><td>0.710</td></tr><tr><td rowspan="4">Hyper-relational</td><td>HINGE [25] †</td><td>0.217</td><td>0.155</td><td>0.333</td><td>0.230</td><td>0.166</td><td>0.351</td><td>0.318</td><td>0.243</td><td>0.456</td><td>0.316</td><td>0.241</td><td>0.455</td><td>0.429</td><td>0.350</td><td>0.585</td><td>0.426</td><td>0.353</td><td>0.568</td></tr><tr><td>StarE [8]</td><td>0.255</td><td>0.178</td><td>0.412</td><td>*0.170</td><td>*0.119</td><td>*0.275</td><td>0.247</td><td>0.166</td><td>0.415</td><td>*0.165</td><td>*0.111</td><td>*0.277</td><td>0.345</td><td>0.248</td><td>0.547</td><td>*0.230</td><td>*0.165</td><td>*0.364</td></tr><tr><td>pyGRAN</td><td>0.277</td><td>0.220</td><td>0.386</td><td>0.311</td><td>0.255</td><td>0.418</td><td>0.454</td><td>0.362</td><td>0.596</td><td>0.457</td><td>0.365</td><td>0.600</td><td>0.566</td><td>0.482</td><td>0.727</td><td>0.601</td><td>0.522</td><td>0.751</td></tr><tr><td>ShrinkE [33]</td><td>0.207</td><td>0.131</td><td>0.368</td><td>*0.138</td><td>*0.087</td><td>*0.245</td><td>0.231</td><td>0.149</td><td>0.400</td><td>*0.156</td><td>*0.099</td><td>*0.269</td><td>0.334</td><td>0.238</td><td>0.536</td><td>*0.223</td><td>*0.159</td><td>*0.358</td></tr><tr><td>4 patterns</td><td>HAHE [20]</td><td>0.344</td><td><u>0.270</u></td><td><u>0.484</u></td><td>0.378</td><td>0.307</td><td>0.515</td><td><strong>0.494</strong></td><td><strong>0.425</strong></td><td><strong>0.614</strong></td><td><strong>0.497</strong></td><td><strong>0.428</strong></td><td><strong>0.618</strong></td><td><strong>0.618</strong></td><td><strong>0.543</strong></td><td><strong>0.769</strong></td><td><strong>0.659</strong></td><td><strong>0.588</strong></td><td><strong>0.800</strong></td></tr><tr><td></td><td>LP4P</td><td><strong>0.351</strong></td><td><strong>0.277</strong></td><td><strong>0.494</strong></td><td><strong>0.381</strong></td><td><strong>0.308</strong></td><td><strong>0.520</strong></td><td><u>0.487</u></td><td><u>0.426</u></td><td><u>0.598</u></td><td><u>0.491</u></td><td><u>0.429</u></td><td><u>0.601</u></td><td><u>0.610</u></td><td><u>0.539</u></td><td><u>0.749</u></td><td><u>0.627</u></td><td><u>0.557</u></td><td><u>0.765</u></td></tr></tbody></table>

<table><caption>Table 4: Entities link prediction on Bi-level KGs.</caption><thead><tr><th rowspan="3">Model type</th><th rowspan="3">Model</th><th colspan="6">FBH</th><th colspan="6">FBHE</th><th colspan="6">DBHE</th></tr><tr><th colspan="3">s-p-o entity</th><th colspan="3">t-p-t entity</th><th colspan="3">s-p-o entity</th><th colspan="3">t-p-t entity</th><th colspan="3">s-p-o entity</th><th colspan="3">t-p-t entity</th></tr><tr><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th><th>MRR</th><th>H@1</th><th>H@10</th></tr></thead><tbody><tr><td rowspan="2">Bi-level</td><td>BiVE [5]</td><td>0.324</td><td>0.209</td><td>0.553</td><td>0.792</td><td>0.689</td><td><u>0.955</u></td><td>0.336</td><td>0.224</td><td>0.558</td><td>0.821</td><td><u>0.767</u></td><td>0.902</td><td>0.247</td><td>0.176</td><td>0.380</td><td>0.688</td><td>0.565</td><td><u>0.886</u></td></tr><tr><td>NestE [32]</td><td><u>0.354</u></td><td><u>0.231</u></td><td><u>0.593</u></td><td><u>0.926</u></td><td><u>0.875</u></td><td><u>0.992</u></td><td>0.354</td><td>0.231</td><td>0.594</td><td>0.865</td><td><u>0.929</u></td><td><u>0.966</u></td><td>0.273</td><td>0.194</td><td><u>0.430</u></td><td><u>0.916</u></td><td><u>0.863</u></td><td><u>0.993</u></td></tr><tr><td>4 patterns</td><td>LP4P</td><td><strong>0.451</strong></td><td><strong>0.356</strong></td><td><strong>0.639</strong></td><td><strong>0.933</strong></td><td><strong>0.921</strong></td><td>0.953</td><td><strong>0.462</strong></td><td><strong>0.369</strong></td><td><strong>0.646</strong></td><td><strong>0.940</strong></td><td><strong>0.923</strong></td><td><strong>0.966</strong></td><td><strong>0.380</strong></td><td><strong>0.316</strong></td><td><strong>0.505</strong></td><td><strong>0.812</strong></td><td><u>0.780</u></td><td>0.874</td></tr></tbody></table>

<table><caption>Table 5: Detailed study of LP4P. Without attention bias and with different labelling functions.</caption><thead><tr><th rowspan="2">LP4P variants</th><th colspan="12">WD4P</th></tr><tr><th colspan="3">s-p-o entity</th><th colspan="3">t-p-o entity</th><th colspan="3">s-p-t entity</th><th colspan="3">t-p-t entity</th><th colspan="3">s-p-o entity</th><th colspan="3">t-p-t entity</th></tr><tr><th>MRR</th><th>H@10</th><th>S@1</th><th>S@10</th><th>MRR</th><th>H@10</th><th>S@1</th><th>S@10</th><th>MRR</th><th>H@10</th><th>S@1</th><th>S@10</th><th>MRR</th><th>H@10</th><th>S@1</th><th>S@10</th><th>MRR</th><th>H@1</th><th>S@1</th></tr></thead><tbody><tr><td>LP4P</td><td><strong>0.331</strong></td><td><strong>0.485</strong></td><td><u>0.780</u></td><td>0.746</td><td>0.668</td><td><u>0.801</u></td><td>0.666</td><td>0.630</td><td>0.670</td><td><strong>0.792</strong></td><td>0.667</td><td>0.630</td><td>0.771</td><td>0.843</td><td>0.804</td><td>0.731</td><td></td><td></td></tr><tr><td>LP4P(HL)</td><td><u>0.328</u></td><td><u>0.481</u></td><td><u>0.746</u></td><td><u>0.752</u></td><td><strong>0.680</strong></td><td><strong>0.808</strong></td><td><u>0.671</u></td><td><u>0.666</u></td><td><strong>0.677</strong></td><td><strong>0.792</strong></td><td><u>0.674</u></td><td><u>0.669</u></td><td><strong>0.800</strong></td><td><strong>0.855</strong></td><td><u>0.806</u></td><td><strong>0.788</strong></td><td></td><td></td></tr><tr><td>LP4P(SmL)</td><td>0.312</td><td>0.458</td><td><strong>0.802</strong></td><td>0.656</td><td>0.793</td><td><strong>0.686</strong></td><td><strong>0.689</strong></td><td>0.661</td><td>0.778</td><td><strong>0.684</strong></td><td><strong>0.690</strong></td><td><u>0.797</u></td><td><u>0.851</u></td><td><strong>0.808</strong></td><td><strong>0.808</strong></td><td></td><td></td><td></td></tr><tr><td>LP4P(OHE)</td><td>0.304</td><td>0.453</td><td>0.742</td><td>0.734</td><td>0.636</td><td>0.759</td><td>0.663</td><td>0.614</td><td>0.637</td><td>0.745</td><td>0.667</td><td>0.611</td><td>0.765</td><td>0.828</td><td>0.805</td><td>0.756</td><td></td><td></td></tr><tr><td>LP4P no EB</td><td><u>0.328</u></td><td><u>0.484</u></td><td>0.714</td><td>0.705</td><td><u>0.670</u></td><td>0.799</td><td>0.664</td><td>0.621</td><td><u>0.672</u></td><td><u>0.788</u></td><td>0.666</td><td>0.626</td><td>0.759</td><td>0.836</td><td>0.805</td><td>0.724</td><td></td><td></td></tr></tbody></table>
To ensure the fairness of our experimentation, we evaluate the baseline by pattern on WD4P-HR and WD4P-BL. We evaluate LP4P on WD4P and its subsets to showcase the models overall performance while still being comparable fairly to the baseline. Although due to time and processing power constraints, it was not possible to tune the hyperparameters of the baseline models on the subsets. To compensate, for WD4P-HR, we reuse the hyperparameters originally tuned for WD50K, as it is very similar, when not possible we reuse the hyperparameters for Wikipeople. For WD4P-BL, we reuse the hyperparameters tuned for FBHE as it shares the same annotations. To ensure a setting where the models are comparable in complete fairness, we also evaluate LP4P on state-of-the-art benchmarks where the baseline models were properly tuned.

We modify the evaluation functions of the baseline models, as they do not natively calculate metrics by pattern. Precisely, we calculate the evaluation metrics for a given pattern by aggregating the results of all predictions where the masked entity's position matches that pattern, as described in Definition 4. Scores that are obtained with this minor modification are marked with a *. Gray cells represent impossible predictions for the model. Finally, models marked with † cannot process facts of the maximum arity present in the knowledge graphs due to the model designs, and were therefore evaluated on a version with four annotations per fact maximum.

In this section, we consider two variants of our model: LP4P, with Soft labels, and when possible LP4P(HL), with Hybrid labels.

**Evaluation Metrics:** Results are reported with the Mean Reciprocal Rank (MRR) and hits at *K* (H@K). Both are rank-based metrics, with the rank of the target being its position in the ordered list of all predictions returned by the model. To assess semantic validity, in Section 6.3 we adopted a semantic-based metric called the Sem@K metric, proposed by [15]. It measures the proportion of semantically valid predictions in the top-*K* results. All metrics are bound between 0 and 1, with 1 being the best possible score. In our tables, the best scores are highlighted in bold and the second-best scores are underlined.

## 6.1 Entity prediction on WD4P

Baseline models are unable to ingest WD4P because none of them can leverage more than one annotation pattern. Therefore, hypergraph and hyper-relational models were evaluated over WD4P-HR, and bi-level models over WD4P-BL.

Overall, Table 2 shows that both LP4P and LP4P(HL) outperform the baseline for entity prediction across the four patterns. Notably, LP4P performs better on the *s*-p-o pattern, while LP4P(HL) shows superior performance on the three annotation patterns, likely due to its use of ontology constraints that guide the selection of valid predictions. Notice that only LP4P is able to predict the *s*-p-t pattern. From left to right, predictions become less challenging, i.e., predicting *s*-p-o entities is more challenging than predicting *t*-p-o entities, which in turn is harder than predicting *s*-p-t entities, with *t*-p-t entities being the easiest to predict. This can be explained by the variety of each pattern in WD4P. As seen in Table 5, the *s*-p-o patterns contain 483 distinct relations, whereas the annotation patterns involve 119 relations for *t*-p-o patterns, 110 for *s*-p-t patterns, and only 7 for *t*-p-t patterns. Their cardinality also correlates with the ease of prediction, the less triple the easier to predict.

On WD4P-HR, after LP4P and LP4P(HL), the next best performances on the *s*-p-o and *t*-p-o patterns are obtained by HAHE and pyGRAN. These models and LP4P share a common foundation in the transformer-based architecture introduced by [30]. BiVE and NestE are the only models capable of leveraging the *t*-p-t pattern in WD4P-BL. Our model clearly outperforms, and NestE obtains better results than BiVE, consistent with prior findings [20, 32]. However, the baseline performance on the *t*-p-t pattern remains extremely low. Likely because BiVE and NestE rely on the fact that triples used in annotations were seen in the training phase, which is prevented by how we eliminated data leakage. Furthermore, as we move from WD4P-HR (containing only *s*-p-o and *t*-p-o patterns), to WD4P-BL (with *s*-p-o and *t*-p-t patterns), and finally to the full WD4P dataset, we observe a consistent improvement in performance of both LP4P and LP4P(HL). This trend highlights our model's ability to benefit from richer annotation structures and pattern diversity.

## 6.2 Entity prediction on the baseline KGs

In this section, we compare the entity prediction performance of LP4P using the benchmark KGs employed in the baseline. Rather than relying on previously published results, we re-ran all baseline experiments using the provided hyperparameters from the authors to obtain consistent evaluations. This decision was motivated for the sake of reproducibility, and by our observation that a publicly released implementation used truncated versions of the KGs, leading to incomparable results. As our baseline belongs to different domains, we organize this section in two parts. First, we show the prediction results using the hyper-relational KGs that are frequently used by hypergraphs and hyper-relational models. Then, we show results using the recently proposed bi-level KGs.

**Entity prediction on hyper-relational KGs.** Table 3 allows comparing the entity prediction performance using WD50K, WikiPeople and JF17K. As baseline models often do entity prediction for base triples and all entities, we focus on these same predictions in this section. Table 3 shows that the best model on WD50K is LP4P. The second-best model overall is HAHE, it is comparable to LP4P on WikiPeople, and it is the best on JF17K followed by our model. The remaining results are coherent with the state-of-the-art. LP4P performs better than hypergraph models, which can be explained because they do not differentiate base triples from annotations. LP4P remains competitive with only the *t*-p-o pattern.

**Entity prediction on bi-level KGs.** LP4P and the bi-level baseline models are evaluated on FBHE, FBH, and DBHE for entity prediction tasks involving the *s*-p-o and *t*-p-t patterns. The *s*-p-o task aligns with BiVE's definition of base-level link prediction, while the *t*-p-t task aligns with its definition of conditional link prediction. As shown in Table 4, LP4P significantly outperforms the baseline on the *s*-p-o entity prediction task. For the *t*-p-t task, NestE beats our model on DBHE, while BiVE provides marginally lower performance. Overall, predicting *t*-p-t entities in bi-level KGs appears easier than *s*-p-o prediction. This is likely due to the limited diversity of the KGs, with a maximum of 10 different relations used in annotations (as seen in Table 1). Despite being designed to leverage more patterns, LP4P achieves competitive performance compared to BiVE and NestE on bi-level KGs.
## 6.3 Detailed LP4P study

We further study WD4P to analyze the contributions of labelling functions and attention biases. We evaluated several model variants on the WD4P dataset, including the main LP4P model (which incorporates both Soft labels and attention biases), the same model without attention biases (LP4P no EB), and three additional variants distinguished by their labelling function. We denote LP4P(OHE), which employs a traditional one-hot encoding. The LP4P(SmL) variant using Semantic labels and LP4P(HL) leveraging Hybrid labels.

We can observe in Table 5 that LP4P(SmL) consistently obtained the highest semantic validity scores (S@1 and S@10), demonstrating the effectiveness of ontological constraints. This improvement came with a reduction in ranking based performance (MRR and H@10), possibly due to over-specialization toward semantically valid triples. In contrast, the LP4P(HL) variant achieved the best overall ranking performance while maintaining higher semantic validity than LP4P. Finally, removing attention biases (LP4P no EB) had only a minor negative impact on ranking performance, which aligns with the observation made by HAHE [20]. Our results indicate that the semantic labelling function (SmL) is recommended when semantic validity is essential. In other cases, Hybrid labels (HL) offer a balance, maintaining robust ranking performance without significantly compromising semantic consistency.

In general, our experimental evaluation confirms that transformer-based approaches achieve the best overall performance. Future works could focus towards exploring further the impact of attention biases, for example by including more biases in the attention layer and not only for the four patterns. In addition, we will further experiment with our model LP4P(HL), with the ontological information of state-of-the-art datasets, to verify that it improves the LP4P performance on base triple entities and all entities.

## 7 Conclusion

We presented in this paper LP4P, the first solution for link prediction in RDF knowledge graphs that supports base triples and three distinct annotation patterns. LP4P enables predictions not only for the terms of the base triples but also for the terms associated with annotations. In addition, we propose semantic-enhanced labelling functions to further enhance LP4P and encourage the prediction of semantically valid triples by leveraging the ontologies underlying the KGs. Extensive empirical evaluations demonstrate the superiority of LP4P on annotated KG with multiple patterns of annotations, particularly when leveraging the ontology. While on benchmarks with fewer annotation patterns, LP4P's results are competitive with state of the art models. This paper also proposes WD4P, a new annotated KG that accounts for the four patterns. Given our promising results, we plan to extend our work further to better leverage annotated KGs. Principally by supporting literals and nested annotations.

## Acknowledgments

This work has received a French government support granted to the Labex Cominlab's excellence laboratory and managed by the National Research Agency in the "Investing for the Future" program under reference ANR-10-LABX-07-01.

This work was granted access to the HPC resources of IDRIS under the allocation 2025-AD010616006 made by GENCI.

## References

[1] S. Bai, F. Zhang, and P. H. S. Torr. 2021. Hypergraph convolution and hypergraph attention. *Pattern Recognition* 110 (2021).

[2] J. Cao, J. Fang, Z. Meng, et al. 2024. Knowledge graph embedding: A survey from the perspective of representation spaces. *Comput. Surveys* (2024).

[3] J. Carroll, C. Bizer, P. Hayes, et al. 2005. Named graphs. *Journal of Web Semantics*.

[4] C. Chung, J. Lee, and J. Whang. 2023. Representation Learning on Hyper-Relational and Numeric Knowledge Graphs with Transformers. *KDD 2023*.

[5] C. Chung and J. J. Whang. 2023. Learning Representations of Bi-level Knowledge Graphs for Reasoning beyond Link Prediction. *AAAI 2023*.

[6] B. Fatemi, P. Taslakian, D. Vazquez, et al. 2020. Knowledge Hypergraphs: Prediction Beyond Binary Relations. *IJCAI 2020*.

[7] Y. Feng, H. You, Z. Zhang, et al. 2019. Hypergraph Neural Networks. *AAAI 2019*.

[8] M. Galkin, P. Trivedi, G. Maheshwari, et al. 2020. Message Passing for Hyper-Relational Knowledge Graphs. *EMNLP 2020*.

[9] S. Guan, X. Jin, J. Guo, et al. 2020. NeuInfer: Knowledge Inference on N-ary Facts. *ACL 2020*.

[10] S. Guan, X. Jin, J. Guo, et al. 2023. Link Prediction on N-ary Relational Data Based on Relatedness Evaluation. *IEEE Trans. Knowl. Data Eng.* 2023.

[11] S. Guan, X. Jin, Y. Wang, et al. 2019. Link Prediction on N-ary Relational Data. *WWW 2019*.

[12] O. Hartig. 2017. Foundations of RDF* and SPARQL* (An alternative approach to statement-level metadata in RDF). *AMW 2017*.

[13] D. Hernández, A. Hogan, and M. Krötzsch. 2015. Reifying RDF: What works well with Wikidata? *SSWS 2015* (2015).

[14] Z. Hu, V. Gutiérrez-Basulto, Z. Xiang, et al. 2023. HyperFormer: Enhancing Entity and Relation Interaction for Hyper-Relational Knowledge Graph Completion. *CIKM 2023*.

[15] N. Hubert, P. Monnin, A. Brun, et al. 2024. Treat Different Negatives Differently: Enriching Loss Functions with Domain and Range Constraints for Link Prediction. *The Semantic Web*.

[16] Y. Lecun, L. Bottou, Y. Bengio, et al. 1998. Gradient-based learning applied to document recognition. *IEEE 1998*.

[17] Y. Liu, Q. Yao, and Y. Li. 2020. Generalizing Tensor Decomposition for N-ary Relational Knowledge Bases. *The Web Conference*.

[18] Y. Liu, Q. Yao, and Y. Li. 2021. Role-Aware Modeling for N-ary Relational Knowledge Bases. *WWW 2021*.

[19] H. Luo, H. E. L. Tan, et al. 2023. DHGE: Dual-View Hyper-Relational Knowledge Graph Embedding for Link Prediction and Entity Typing. *AAAI 2023*.

[20] H. Luo, H. E., Y. Yang, et al. 2023. HAHE: Hierarchical Attention for Hyper-Relational Knowledge Graphs in Global and Local Level. *ACL 2023*.

[21] F. Manola, E. Miller, B. McBride, et al. 2004. RDF primer. *W3C recommendation*.

[22] V. Nguyen, O. Bodenreider, and A. Sheth. 2014. Don't like RDF reification? Making statements about statements using singleton property. *WWW 2014*.

[23] N. Noy, A. Rector, P. Hayes, et al. 2006. Defining n-ary relations on the semantic web. *W3C working group note* (2006).

[24] L. Richard, L. Eric, N. Robert, et al. 2018. Tune: A Research Platform for Distributed Model Selection and Training. (2018).

[25] P. Rosso, D. Yang, and P. Cudré-Mauroux. 2020. Beyond Triplets: Hyper-Relational Knowledge Graph Embedding for Link Prediction. *WWW 2020*.

[26] H. Shomer, W. Jin, J. Li, et al. 2024. Learning Representations for Hyper-Relational Knowledge Graphs. *ASONAM 2023*.

[27] S. Vashishth, S. Sanyal, V. Nitin, et al. 2020. Composition-based Multi-Relational Graph Convolutional Networks.

[28] A. Vaswani, N. Shazeer, N. Parmar, et al. 2017. Attention is All you Need. *NIPS*.

[29] M. Wang, L. Qiu, and X. Wang. 2021. A Survey on Knowledge Graph Embeddings for Link Prediction. *Symmetry* (2021).

[30] Q. Wang, H. Wang, Y. Lyu, et al. 2021. Link Prediction on N-ary Relational Facts: A Graph-based Approach. *ACL-IJCNLP 2021*.

[31] J. Wen, J. Li, Y. Mao, et al. 2016. On the representation and embedding of knowledge bases beyond binary relations. *IJCAI 2016*.

[32] B. Xiong, M. Nayyeri, L. Luo, et al. 2024. NestE: Modeling Nested Relational Structures for Knowledge Graph Reasoning. *AAAI 2024*.

[33] B. Xiong, M. Nayyeri, S. Pan, et al. 2023. Shrinking Embeddings for Hyper-Relational Knowledge Graphs. *ACL 2023*.

[34] S. Yan, Z. Zhang, X. Sun, et al. 2022. HYPER2: Hyperbolic embedding for hyper-relational link prediction. *Neurocomputing* 2022.

[35] S. Yan, Z. Zhang, X. Sun, et al. 2022. PolygonE: Modeling N-ary Relational Data as Gyro-Polygons in Hyperbolic Space. *AAAI 2022*.

[36] D. Yu and Y. Yang. 2021. Improving Hyper-Relational Knowledge Graph Completion.

[37] R. Zhang, Y. Zou, and J. Ma. 2019. Hyper-SAGNN: a self-attention based graph neural network for hypergraphs. *ICLR 2019*.