Capturing Knowledge Graphs and Rules with Octagon Embeddings
Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence. Main Track. Pages 3289-3297.
https://doi.org/10.24963/ijcai.2024/364
Keywords
- Knowledge Representation and Reasoning: KRR: Learning and reasoning
- Data Mining: DM: Knowledge graphs and knowledge base completion
- Machine Learning: ML: Neuro-symbolic methods
Abstract
Region based knowledge graph embeddings represent relations as geometric regions. This has the advantage that the rules which are captured by the model are made explicit, making it straightforward to incorporate prior knowledge and to inspect learned models. Unfortunately, existing approaches are severely restricted in their ability to model relational composition, and hence also their ability to model rules, thus failing to deliver on the main promise of region based models. With the aim of addressing these limitations, we investigate regions which are composed of axis-aligned octagons. Such octagons are particularly easy to work with, as intersections and compositions can be straightforwardly computed, while they are still sufficiently expressive to model arbitrary knowledge graphs. Among others, we also show that our octagon embeddings can properly capture a non-trivial class of rule bases. Finally, we show that our model achieves competitive experimental results.
- [Abboud et al., 2020] Ralph Abboud, İsmail İlkan Ceylan, Thomas Lukasiewicz, and Tommaso Salvatori. BoxE: A box embedding model for knowledge base completion. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Sys- tems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
- [Arakelyan et al., 2021] Erik Arakelyan, Daniel Daza, Pasquale Minervini, and Michael Cochez. Complex query answering with neural link predictors. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021.
- [Balazevic et al., 2019] Ivana Balazevic, Carl Allen, and Timothy M. Hospedales. TuckER: Tensor factorization for knowledge graph completion. In Proceedings of the 2019 Conference on Empirical Methods in Natural Lan- guage Processing and the 9th International Joint Confer- ence on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 5184-5193. Association for Computational Linguistics, 2019.
- [Bordes et al., 2011] Antoine Bordes, Jason Weston, Ronan Collobert, and Yoshua Bengio. Learning structured em- beddings of knowledge bases. In Proceedings of the Twenty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2011, San Francisco, California, USA, August 7-11, 2011, pages 301-306. AAAI Press, 2011.
- [Bordes et al., 2013] Antoine Bordes, Nicolas Usunier, Alberto García-Durán, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neu- ral Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States, pages 2787-2795, 2013.
- [Dettmers et al., 2018] Tim Dettmers, Pasquale Minervini, Pontus Stenetorp, and Sebastian Riedel. Convolutional 2d knowledge graph embeddings. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 1811-1818. AAAI Press, 2018.
- [Guo et al., 2018] Shu Guo, Quan Wang, Lihong Wang, Bin Wang, and Li Guo. Knowledge graph embedding with iterative guidance from soft rules. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 4816-4823. AAAI Press, 2018.
- [Guo et al., 2022] Qingyu Guo, Fuzhen Zhuang, Chuan Qin, Hengshu Zhu, Xing Xie, Hui Xiong, and Qing He. A survey on knowledge graph-based recommender systems. IEEE Trans. Knowl. Data Eng., 34(8):3549-3568, 2022.
- [Gutiérrez-Basulto and Schockaert, 2018] Víctor Gutiérrez- Basulto and Steven Schockaert. From knowledge graph embedding to ontology embedding? an analysis of the compatibility between vector space representations and rules. In Principles of Knowledge Representation and Rea- soning: Proceedings of the Sixteenth International Confer- ence, KR 2018, Tempe, Arizona, 30 October -2 November 2018, pages 379-388. AAAI Press, 2018.
- [Hogan et al., 2021] Aidan Hogan, Eva Blomqvist, Michael Cochez, Claudia d'Amato, Gerard de Melo, Clau- dio Gutierrez, Sabrina Kirrane, José Emilio Labra Gayo, Roberto Navigli, Sebastian Neumaier, Axel- Cyrille Ngonga Ngomo, Axel Polleres, Sabbir M. Rashid, Anisa Rula, Lukas Schmelzeisen, Juan Sequeda, Steffen Staab, and Antoine Zimmermann. Knowledge Graphs. Synthesis Lectures on Data, Semantics, and Knowledge.
- [Jackermeier et al., 2023] Mathias Jackermeier, Jiaoyan Chen, and Ian Horrocks. Box 2 EL: Concept and role box embeddings for the description logic EL++. CoRR, abs/2301.11118, 2023.
- [Kazemi and Poole, 2018] Seyed Mehran Kazemi and David Poole. Simple embedding for link prediction in knowl- edge graphs. In Advances in Neural Information Process- ing Systems 31: Annual Conference on Neural Informa- tion Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, Canada, pages 4289-4300, 2018.
- [Lacroix et al., 2018] Timothée Lacroix, Nicolas Usunier, and Guillaume Obozinski. Canonical tensor decomposi- tion for knowledge base completion. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmässan, Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learn- ing Research, pages 2869-2878. PMLR, 2018.
- [Marino et al., 2017] Kenneth Marino, Ruslan Salakhutdi- nov, and Abhinav Gupta. The more you know: Using knowledge graphs for image classification. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 20-28. IEEE Computer Society, 2017.
- [Meilicke et al., 2019] Christian Meilicke, Melisachew Wudage Chekol, Daniel Ruffinelli, and Heiner Stuckenschmidt. Anytime bottom-up rule learning for knowledge graph completion. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 3137-3143. ijcai.org, 2019.
- [Mondal et al., 2021] Sutapa Mondal, Sumit Bhatia, and Raghava Mutharaju. EmEL++: Embeddings for EL++ de- scription logic. In Proceedings of the AAAI 2021 Spring Symposium on Combining Machine Learning and Knowl- edge Engineering (AAAI-MAKE 2021), Stanford Univer- sity, Palo Alto, California, USA, March 22-24, 2021, volume 2846 of CEUR Workshop Proceedings. CEUR- WS.org, 2021.
- [Omran et al., 2018] Pouya Ghiasnezhad Omran, Kewen Wang, and Zhe Wang. Scalable rule learning via learn- ing representation. In Proceedings of the Twenty-Seventh International Joint Conference on Artificial Intelligence, IJCAI 2018, July 13-19, 2018, Stockholm, Sweden, pages 2149-2155. ijcai.org, 2018. IJCAI
- [Pavlovic and Sallinger, 2023] Aleksandar Pavlovic and Emanuel Sallinger. ExpressivE: A spatio-functional embedding for knowledge graph completion. In The Eleventh International Conference on Learning Repre- sentations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023.
- [Reinanda et al., 2020] Ridho Reinanda, Edgar Meij, and Maarten de Rijke. Knowledge graphs: An information retrieval perspective. Found. Trends Inf. Retr., 14(4):289- 444, 2020.
- [Schneider et al., 2022] Phillip Schneider, Tim Schopf, Ju- raj Vladika, Michael Galkin, Elena Simperl, and Florian Matthes. A decade of knowledge graphs in natural lan- guage processing: A survey. In Proceedings of the 2nd Conference of the Asia-Pacific Chapter of the Associa- tion for Computational Linguistics and the 12th Interna- tional Joint Conference on Natural Language Processing, AACL/IJCNLP 2022 -Volume 1: Long Papers, Online Only, November 20-23, 2022, pages 601-614. Association for Computational Linguistics, 2022.
- [Sun et al., 2019] Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. Rotate: Knowledge graph embed- ding by relational rotation in complex space. In 7th Inter- national Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenRe- view.net, 2019.
- [Toutanova and Chen, 2015] Kristina Toutanova and Danqi Chen. Observed versus latent features for knowledge base and text inference. In Proceedings of the 3rd Workshop on Continuous Vector Space Models and their Composition- ality, CVSC 2015, Beijing, China, July 26-31, 2015, pages 57-66. Association for Computational Linguistics, 2015.
- [Trouillon et al., 2017] Théo Trouillon, Christopher R. Dance, Éric Gaussier, Johannes Welbl, Sebastian Riedel, and Guillaume Bouchard. Knowledge graph completion via complex tensor factorization. J. Mach. Learn. Res., 18:130:1-130:38, 2017.
- [Trouillon et al., 2019] Théo Trouillon, Éric Gaussier, Christopher R. Dance, and Guillaume Bouchard. On inductive abilities of latent factor models for relational learning. J. Artif. Intell. Res., 64:21-53, 2019.
- [Wang et al., 2018] Yanjie Wang, Rainer Gemulla, and Hui Li. On multi-relational link prediction with bilinear mod- els. In Proceedings of the Thirty-Second AAAI Confer- ence on Artificial Intelligence, (AAAI-18), the 30th innova- tive Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Ar- tificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pages 4227-4234. AAAI Press, 2018.
- [Wang et al., 2023] Dingmin Wang, Yeyuan Chen, and Bernardo Cuenca Grau. Efficient embeddings of logical variables for query answering over incomplete knowledge graphs. In Thirty-Seventh AAAI Conference on Artificial Intelligence, AAAI 2023, Thirty-Fifth Conference on Inno- vative Applications of Artificial Intelligence, IAAI 2023, Thirteenth Symposium on Educational Advances in Ar- tificial Intelligence, EAAI 2023, Washington, DC, USA, February 7-14, 2023, pages 4652-4659. AAAI Press, 2023.
- [Xiong et al., 2022] Bo Xiong, Nico Potyka, Trung-Kien Tran, Mojtaba Nayyeri, and Steffen Staab. Faithful embed- dings for EL++ knowledge bases. In The Semantic Web - ISWC 2022 -21st International Semantic Web Conference, Virtual Event, October 23-27, 2022, Proceedings, volume 13489 of Lecture Notes in Computer Science, pages 22- 38. Springer, 2022.
- [Zhang et al., 2019] Shuai Zhang, Yi Tay, Lina Yao, and Qi Liu. Quaternion knowledge graph embeddings. In Ad- vances in Neural Information Processing Systems 32: An- nual Conference on Neural Information Processing Sys- tems 2019, NeurIPS 2019, December 8-14, 2019, Vancou- ver, BC, Canada, pages 2731-2741, 2019.
- [Zhu et al., 2021] Zhaocheng Zhu, Zuobai Zhang, Louis- Pascal A. C. Xhonneux, and Jian Tang. Neural bellman- ford networks: A general graph neural network framework for link prediction. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural In- formation Processing Systems 2021, NeurIPS 2021, De- cember 6-14, 2021, virtual, pages 29476-29490, 2021.
References were extracted automatically from the PDF and may contain errors.
Full text extracted automatically from the PDF; figures, tables and equations may differ. The PDF is the version of record.
1 Introduction
Knowledge graphs, i.e. sets of (entity, relation, entity) triples, have become one of the most popular frameworks for knowledge representation, with applications ranging from search [Reinanda et al., 2020] and recommendation [Guo et al., 2022] to natural language processing [Schneider et al., 2022] and computer vision [Marino et al., 2017]. Their popularity has spurred an extensive line of work dedicated to representation learning on knowledge graphs. Most works in this area focus on the paradigm of knowledge graph embedding [Bordes et al., 2011], aiming to learn a vector representation e for each entity e and a scoring function sr for each relation r such that sr(e, f) reflects the likelihood that (e, r, f) is a valid triple, i.e. that entity e is in relation r with entity f.
Knowledge graph embeddings are intended to capture semantic regularities, making it possible to predict plausible triples that were missing from the original knowledge graph. Consider, for instance, the seminal TransE model [Bordes et al., 2013], which uses scoring functions of the form sr(e, f) = -d(e + r, f), where r ∈ Rn is an embedding of the relation r, e, f ∈ Rn are entity embeddings of the same dimension and d is a distance metric. Note that sr(e, f ) achieves its maximal value of 0 iff e + r = f . We can thus say that the embedding fully supports the triple (e, r, f) when sr(e, f ) = 0. If r1 + r2 = r3 we have that sr1 (e, f ) = 0 and sr2 (f , g) = 0 together imply sr3 (e, g) = 0. In this sense, we can say that the embedding captures the following rule:
This correspondence between knowledge graph embeddings and symbolic rules is appealing. For instance, if we already know that (1) is valid, we can impose r1 + r2 = r3 when learning the embedding. We can also use this correspondence to inspect which semantic dependencies a learned embedding is capturing. Unfortunately, TransE has some inherent limitations, which mean that certain knowledge graphs cannot be faithfully captured [Wang et al., 2018]. This has been addressed in more recent models such as ComplEx [Trouillon et al., 2017], ConvE [Dettmers et al., 2018] and TuckER [Balazevic et al., 2019], to name just a few, but while these models often perform better on the task of link prediction, the connection between their parameters and the captured semantic dependencies is considerably more opaque.
Region based knowledge graph embedding models [Guti´errez-Basulto and Schockaert, 2018; Abboud et al., 2020; Pavlovic and Sallinger, 2023] aim to get the best of both worlds, increasing the expressivity of TransE while maintaining an explicit correspondence between model parameters and semantic dependencies. They represent each relation r as a geometric region Xr ⊆ R2n . We say that a triple (e, r, f) is captured by the embedding if e ⊕ f ∈ Xr, where ⊕ denotes vector concatenation. To characterise semantic dependencies, we can then exploit the fact that the intersection, subsumption and composition of relations can be naturally modelled in terms of their embeddings Xr. For instance, we say that the embedding captures the rule r1(X, Y )∧r2(X, Y ) → r3(X, Y ) iff Xr1 ∩Xr2 ⊆ Xr3 . To model rules of the form (1), we can characterise relational composition as follows:
We then say that (1) is captured iff Xr1 ⋄ Xr2 ⊆ Xr3 . Rules of the form (1), which are sometimes referred to as closed path rules, play an important role in link prediction [Meilicke et al., 2019]. When designing a region based model, it is thus important that the composition of regions can be straightforwardly characterised. However, existing approaches are severely limited in this respect. For instance, BoxE [Abboud et al., 2020] cannot model relational composition at all, while ExpressivE [Pavlovic and Sallinger, 2023] uses parallelograms, which are not closed under composition.
To address these concerns, our aim in this paper is to develop a region based model which is as simple as possible, while (i) still being expressive enough to capture arbitrary knowledge graphs and (ii) using regions which are closed under intersection and composition. Based on these desiderata, we arrive at a model which relies on axis-aligned octagons (with all angles fixed at 45 degrees). We show that despite their simplicity, the proposed octagon embeddings are sufficiently expressive to properly capture a large class of rule bases. This is an important property, among others because it means that we can inject prior knowledge, in the form of a given rule base, without unintended consequences. Our result is considerably more general than what is possible with BoxE, which is not able to capture any closed path rules, and more general than what is known about ExpressivE. Moreover, because compositions and intersections of octagons can be straightforwardly computed, octagon embeddings are considerably more practical than existing alternatives. While our main focus is on better understanding the expressivity of region based models, we have also empirically evaluated the proposed octagon embeddings. We found octagons to achieve results close to the current state-of-the-art. This demonstrates that learning octagon embeddings is a promising strategy, especially in contexts where both knowledge graphs and rules need to be modelled. 1
2 Preliminaries
Let E and R be sets of entities and relations respectively. We consider knowledge graph embeddings in which each entity e ∈ E is represented by a vector e ∈ Rn and each relation r ∈ R is represented by a region Xr ⊆ R2n . We refer to such representations as region-based knowledge graph embeddings. We say that a triple (e, r, f) is captured or supported by a given embedding if e ⊕ f ⊆ Xr. This notion of support allows us to unambiguously associate a knowledge graph with a given geometric embedding, which in turn allows us to study the expressivity of knowledge graph embedding models. In practice, we typically use regions with soft boundaries. This makes learning easier and it is better aligned with the fact that link prediction is typically treated as a ranking problem rather than a classification problem. We will return to the issue of learning regions with soft boundaries in Section 5.
Coordinate-wise region embeddings. Region based embeddings were first studied from a theoretical point of view in [Guti´errez-Basulto and Schockaert, 2018]. Their setting allowed relations to be represented by arbitrary convex polytopes. Using such regions is not feasible in practice, however, as they require exponentially many parameters. A natural solution is to use regions Xr which can be described using n two-dimensional regions Xir :
1 An extended version of this paper with supplementary materials can be found at https://arxiv.org/abs/2401.16270.


We call such region based embeddings coordinate-wise. For example, we can view TransE as a coordinate-wise region based embedding model, where
In this case, the two-dimensional regions correspond to unbounded bands, as illustrated in Figure 1. ExpressivE [Pavlovic and Sallinger, 2023] is also a coordinate-wise model, where the regions Xir are parallelograms. An important drawback of parallelograms is that they are not closed under composition: if Xir1 and Xir2 are parallelograms, then it may be that Xir1 ⋄Xir2 is not a parallelogram, with ⋄ defined as in (2). Similarly, parallelograms are not closed under intersection. To address these limitations, we can consider some alternatives. Starting from the TransE bands defined in (4), a natural generalisation is to add domain and range constraints, i.e. to use hexagonal regions of the following form, as also illustrated in Figure 1:
Unfortunately, as we will see in Section 4, such hexagons are not sufficiently expressive to capture arbitrary knowledge graphs. As a minimal extension, we consider octagons of the following form, as illustrated in Figure 2:
Throughout the paper, we will refer to regions of the form (6) as octagons. However, note that some of these regions are degenerate, having in fact fewer than eight vertices.
Cross-coordinate region embeddings. Some region based models go beyond coordinate-wise embeddings. We will refer to them as cross-coordinate models. For instance, BoxE [Abboud et al., 2020] uses regions of the following form:
An advantage of cross-coordinate models is that they can rely on simpler two-dimensional regions. For instance, the regions Air and Bir in the BoxE model essentially correspond to TransE bands. While a coordinate-wise model with TransE bands is not sufficiently expressive to capture arbitrary knowledge graphs, by using cross-coordinate comparisons, BoxE can circumvent this limitation.
Capturing rules. The main promise of region based models is that the spatial configuration of the regions reveals the semantic dependencies that are captured. Let us first consider a closed-path rule of the following form:
Such a rule can be encoded using relational composition and set inclusion, as follows:
Accordingly, we say that a region based embedding captures this rule iff the following inclusion holds:
Other types of rules can be modelled in a similar way. For instance, a rule such as r1(X, Y ) ∧ r2(X, Y ) → r(X, Y ) is captured by a region based embedding if Xr1 ∩ Xr2 ⊆ Xr.
To illustrate how rules can be captured by region based embeddings, first consider a coordinate-wise model with TransE bands, i.e. regions of the form (4). We have that Xr1 ⋄ . . . ⋄ Xrk ⊆ Xr holds iff ∑ki=1 u-ri ≥ u-r and ∑ki=1 u+ri ≤ u+r . This means that every rule of the form (8) can be satisfied. However, the model is not sensitive to the order in which the relations in the body appear. For instance, whenever r1(X, Y )∧r2(Y, Z) → r(X, Z) is satisfied, we also have that r2(X, Y ) ∧ r1(Y, Z) → r(X, Z) is satisfied, which is clearly undesirable. Coordinate-wise models with TransE bands are thus not sufficiently expressive to properly capture rules.
Now consider a cross-coordinate model such as BoxE, using regions of the form (7). It holds that (x1, . . . , x2n, z1, . . . , z2n) ∈ Xr1 ⋄ Xr2 iff there are y1, . . . , y2n ∈ R such that for every i ∈ {1, . . . , n} we have:
This is the case iff for every i ∈ {1, . . . , n} we have:
While Xr1 ⋄ Xr2 constrains the pairs (xi, zi) and (xn+i, zn+i), any region Xr3 rather constrains the pairs (xi, zn+i) and (xn+i, zi). It is thus not possible to have Xr1 ⋄ Xr2 ⊆ Xx3 , unless in trivial cases where Xr1 = ∅, Xr2 = ∅, or (if infinite bounds are allowed) Xr3 = R4n . In all these trivial cases, the embedding also captures other rules, e.g. if Xr1 = ∅ then all rules of the form r1(X, Y ) ∧ r4(Y, Z) → r5(X, Z) are also satisfied.
ExpressivE is able to capture rules of the form (8), while avoiding unintended consequences [Pavlovic and Sallinger, 2023]. However, in practice we are typically interested in capturing sets of such rules, and it is unclear under which conditions this is possible with ExpressivE. Another drawback of ExpressivE is that compositions and intersections of regions are difficult to compute, which, among others, makes checking whether a given rule is satisfied computationally expensive. Moreover, it is not clear how injecting rules into the learning process can then be done in a practical way.
3 Modelling Relations with Octagons
In this paper, we focus on coordinate-wise models where the two-dimensional regions are octagons. Let us write Xr = [Or 1 , . . . ,Orn ] to denote that relation r is defined using the octagons Or 1 , . . . ,Orn , in the sense that (x1, . . . , xn, y1, . . . , yn) ∈ Xr iff (xi, yi) ∈ Or i for each i ∈ {1, . . . , n}. Clearly, if Xr = [Or 1 , . . . ,Orn ] and Xs = [Os 1 , . . . ,Osn ] then we have Xr ∩Xs = [Or 1 ∩Os 1 , . . . , Orn ∩Osn ] and Xr ⋄Xs = [Or 1 ⋄Os 1 , . . . ,Orn ⋄ Osn ]. To study how properties such as reflexivity, symmetry and transitivity can be satisfied in octagon embeddings, it is thus sufficient to study these properties for individual octagons, which is what we focus on in this section.
Parameterisation. Let us write Octa(x-i , x+i , yi , y+ i , u-i , u+i , vi , v+ i ) to denote the octagon defined in (6). Note that the eight parameters are not independent. For instance, we have that Octa(x-, x+, y-, y+, u-, u+, v-, v+) = Octa(x-, x+, y-, y+, u-, u+,max(v-, x- + y-), v+). Indeed, if x ≥ x- and y ≥ y-, we also have x+y ≥ x- +y-, meaning that the bound x + y ≥ v- can be strengthened to x + y ≥ max(x- + y-, v-). We call the parameters (x-, x+, y-, y+, u-, u+, v-, v+) normalised if they cannot be strengthened, i.e. if increasing any of the lower bounds or decreasing any of the upper bounds always leads to a different octagon. As the following proposition reveals, we can easily normalise any set of parameters. 2
Proposition 1. Consider the following set of parameters:
2 All proofs can be found in the supplementary materials.

Then Octa(x-, x+, y-, y+, u-, u+, v-, v+) = Octa(x-1 , x+1 , y1 , y+ 1 , u-1 , u+1 , v1 , v+ 1 ). Furthermore, if we have x-1 > x+1 , y1 > y+ 1 , u-1 > u+1 or v1 > v+ 1 then Octa(x-, x+, y-, y+, u-, u+, v-, v+) = ∅. Otherwise, the set of parameters (x-1 , x+1 , y1 , y+ 1 , u-1 , u+1 , v1 , v+ 1 ) is normalised.
Capturing relational properties. As we saw in the previous section, two operations are of particular importance for capturing rules: intersection and composition. The intersection of Octa(x-1 , x+1 , y1 , y+ 1 , u-1 , u+1 , v1 , v+ 1 ) and Octa(x-2 , x+2 , y2 , y+ 2 , u-2 , u+2 , v2 , v+ 2 ) is the following octagon:
Octagons are also closed under composition, as the following proposition reveals.
Proposition 2. Let O1 = Octa(x-1 , x+1 , y1 , y+ 1 , u-1 , u+1 , v1 , v+ 1 ) and O2 = Octa(x-2 , x+2 , y2 , y+ 2 , u-2 , u+2 , v2 , v+ 2 ) be non-empty octagons with normalised parameters. Then O1 ⋄ O2 = Octa(x-3 , x+3 , y3 , y+ 3 , u-3 , u+3 , v3 , v+ 3 ), where:
The inverse of a relation can also be straightforwardly characterised. Let us define the inverse of an octagon O = Octa(x-, x+, y-, y+, u-, u+, v-, v+) as:
Then clearly we have (x, y) ∈ O iff (y, x) ∈ Oinv , hence the relation encoded by Oinv is indeed the inverse of the relation encoded by O. It also follows that O is symmetric if the following conditions are satisfied: x- = y-, x+ = y+ and u- = -u+. Similarly, assuming the parameters are normalised, the relation captured by the octagon O is reflexive over its domain [x-, x+], i.e. ∀x ∈ [x-, x+] . (x, x) ∈ O, iff the following conditions are satisfied:
From the definition of composition, it straightforwardly follows that a non-empty octagon with normalised coordinates is transitive, i.e. satisfies O ⋄O ⊆ O, iff the following conditions are satisfied:
- u- ≤max(y- -x+, 2u-, v- - v+);
- u+ ≥min(y+ -x-, 2u+, v+ - v-);
- v- ≤max(x- + y-, u- + v-, v- -u+);
- v+ ≥min(x+ + y+, u+ + v+, v+ -u-).
We can also show the following.
Proposition 3. Let O = Octa(x-, x+, y-, y+, u-, u+, v-, v+) and assume that these parameters are normalised. It holds that O ⋄ O = O iff one of the following conditions is satisfied:
- O = ∅;
- O = [x-, x+] × [y-, y+] with x+ ≥ y- and x- ≤ y+;
- O = {(x, x) | x ∈ [x-, x+]};
- u- = 0, u+ > 0, v- < v+, v- - x+ ≤ x-, x+ ≤ v+ - x-, v- - y+ ≤ y-, y+ ≤ v+ - y- and u+ = min(y+ - x-, v+ - v-);
- u- < 0, u+ = 0, v- < v+, v- - x+ ≤ x-, x+ ≤ v+ - x-, v- - y+ ≤ y-, y+ ≤ v+ - y- and u- = max(y- - x+, v- - v+).
Figure 3 shows an octagon which satisfies the conditions from the fourth case. If we compose an octagon with itself a sufficient number of times, we always end up with one of the octagon types from Proposition 3. In particular, let us define O(m) as O(m-1) ⋄O for m ≥ 2 and O(1) = O. We then have the following result.
Proposition 4. If v- < v+ then there exists some m ≥ 1 such that O(m) ⋄ O = O(m) .
4 Expressivity of Octagon Embeddings
We now study the ability of octagon embeddings to capture knowledge graphs and rules. We will denote a given knowledge graph embedding as γ. Such an embedding represents each entity e ∈ E as the vector γ(e) ∈ Rn and each relation r ∈ R as the region γ(r) ⊆ R2n . We say that γ is an octagon embedding if it is a coordinate-wise model in which γ(r) is defined in terms of octagons, for each r ∈ R.
4.1 Capturing Knowledge Graphs
With each region based embedding γ we can associate the knowledge graph Gγ = {(e, r, f) | γ(e) ⊕ γ(f) ∈ γ(r)}. An important question is whether a given region based embedding model is capable of modelling any knowledge graph, i.e. whether for any knowledge graph G ⊆ E × R × E there exists an embedding γ such that G = Gγ. When using coordinate-wise embeddings with TransE bands, this is not possible [Wang et al., 2018; Kazemi and Poole, 2018]. In fact, for a coordinate-wise model with hexagons of the form (5) this is still not possible as the following proposition reveals.
Proposition 5. Let Xr be a hexagon region of the form (5) and let e, f ∈ Rn . If e ⊕ f ∈ Xr and f ⊕ e ∈ Xr then we also have e ⊕ e ∈ Xr .
From this proposition, it follows that the hexagon model cannot correctly capture a knowledge graph containing the triples (e, r, f) and (f, r, e) but not (e, r, e). However, if we use octagons instead of hexagons, we can correctly capture any knowledge graph.
Proposition 6. Let G ⊆ E ×R× E be a knowledge graph. There exists an octagon embedding γ such that G = Gγ .
4.2 Capturing Rules
We now analyse which sets of rules can be correctly captured by octagon embeddings. Previous work [Abboud et al., 2020] has focused in particular on the following types of rules 3 :
Asymmetry:
r(X, Y ) → ¬r(Y, X)
(11)
Let us define the inverse region Xinv r as follows:
Note that when Xr = [O1, . . . ,On] then Xinv r = [Oinv 1 , . . . , Oinv n ] with Oinv i as defined in (9). Each of the aforementioned rule types can be straightforwardly modelled using regions. In particular, we say that a region based embedding γ captures or satisfies (10) iff γ(r) ⊆ γ(r)inv ; (11) iff γ(r) ∩ γ(r)inv = ∅; (12) iff γ(r1) ⊆ γ(r2)inv ; (13) iff γ(r1) ⊆ γ(r2); (14) iff γ(r1) ∩ γ(r2) ⊆ γ(r3); (15) iff γ(r1) ∩ γ(r2) = ∅; and (16) iff γ(r1) ⋄ γ(r2) ⊆ γ(r3). For a set of rules K and a rule ρ, we write K |= ρ to denote that ρ is entailed by K in the usual sense. We also write γ |= ρ to denote that the embedding γ captures the rule ρ.
3 Asymmetry rule was called anti-symmetry in [Abboud et al., 2020]. We use the former to avoid any confusion with the standard notion of anti-symmetric relations. Furthermore, [Abboud et al., 2020] defined inversion as r1(X, Y ) ≡ r2(Y,X). We consider inversion as a rule, since the equivalence can be straightforwardly recovered by two inversion rules.
We are interested in analysing whether a given region based embedding model can capture a set of rules K, without capturing any other rules, i.e. such that for any rule ρ it holds that γ |= ρ iff K |= ρ. Whether this is possible in general depends on the kinds of rules which K is permitted to contain. We first show a negative result. We call a region based embedding γ convex if γ(r) is convex for every r ∈ R.
Proposition 7. There exists a consistent set of hierarchy, intersection and mutual exclusion rules K such that every convex embedding of the form (3) or (7) which satisfies K also satisfies some hierarchy rule which is not entailed by K.
We can show the same result when only hierarchy, intersection and asymmetry rules are permitted. Note that Proposition 7 also applies to BoxE, and thus contradicts the claim from [Abboud et al., 2020] that BoxE can capture arbitrary consistent sets of symmetry, asymmetry, inversion, hierarchy, intersection and mutual exclusion rules. The underlying issue relates to the fact that the considered embeddings are defined from two-dimensional regions, and when these regions are convex, Helly's theorem imposes restrictions on when intersections of such regions can be disjoint. Furthermore, note that [Abboud et al., 2020] did not consider composition rules, as such rules cannot be captured by BoxE. When we omit asymmetry, mutual exclusion and composition rules, we can capture any rule base, as the following result shows.
Proposition 8. Let K be a set of symmetry, inversion, hierarchy and intersection rules. There exists a coordinate-wise octagon embedding γ which satisfies K, and which only satisfies those symmetry, inversion, hierarchy and intersection rules which are entailed by K, and which does not satisfy any asymmetry, mutual exclusion and composition rules.
Let us now shift our focus to composition rules. First, we have the following negative result, showing that octagon embeddings cannot capture arbitrary sets of composition rules.
Proposition 9. Let K = {r1(X, Y ) ∧ r1(Y,Z) → r2(X,Z), r2(X, Y ) ∧ r2(Y,Z) → r3(X,Z)}. It holds that every octagon embedding γ which satisfies K also satisfies some composition rule which is not entailed by K.
The underlying issue relates to composition rules where the same relation appears more than once. If we exclude such cases, we can correctly embed sets of composition rules.
Definition 1. An extended composition rule over a set of relations R is an expression of the form:
where k ≥ 1 and r1, . . . , rk+1 ∈ R. Such a rule is called regular if we have ri ̸= rj for i ̸= j.
Regular composition rules generalise the hierarchy and composition rules from [Abboud et al., 2020], noting that the latter work also required the three relations appearing in composition rules to be distinct.
Proposition 10. Let K be a set of regular composition rules. Assume that any extended composition rule entailed by K is either a trivial rule of the form r ⊆ r or a regular rule. There exists an octagon embedding γ which satisfies K, and which only satisfies those extended composition rules which are entailed by K.
This result is significant given the importance of composition rules for link prediction [Meilicke et al., 2019], among others. Moreover, a similar result was not yet shown in previous work on region based embeddings, to the best of our knowledge. At the same time, however, the result is limited by the fact that only regular rules are considered and no inverse relations. Knowledge graph completion often relies (explicitly or implicitly) on rules such as playsForTeam(X, Y ) ∧ playsForTeam-1 (Y,Z) ∧ playsSport(Z,U) → playsSport(X,U). Our analysis suggests that capturing sets of such rules would require an octagon model with cross-coordinate comparisons, which we leave as a topic for future work.
5 Learning Octagon Embeddings
In our theoretical analysis, determining whether a triple (e, r, f) is supported by an embedding was based on a discrete criterion: either e⊕ f lies in Xr or it does not. In practice, however, we need to learn regions with fuzzy boundaries, given that link prediction is typically treated as a ranking problem, rather than a classification problem. Continuous representations are typically also easier to learn than discrete structures. Let us consider a region Xr = [Or 1 , . . . , Orn ], where Or i = Octa(x-i , x+i , , yi , y+ i , , u-i , u+i , , vi , v+ i , ). Let us write x- = (x-1 , . . . , x-n ) and similar for x+, y-, y+, u-, u+, v- and v+. Octagon embeddings impose the following four constraints on an entity pair (e, f):
We will refer to the regions defined by these four constraints as bands. We can straightforwardly use the sigmoid function σ to convert the constraints into soft scores. For the uconstraint we can use the following "distance" to the u-band:
where we write uc = (u+ +u-)/2 and uw = (u+ -u-)/2. The functions distx, disty and distv are defined analogously. Note that e ⊕ f ∈ Xr iff distx(e, r, f) ≥ 0.5, disty(e, r, f) ≥ 0.5, distu(e, r, f) ≥ 0.5 and distv(e, r, f) ≥ 0.5. Furthermore note that BoxE and ExpressivE also convert interval constraints into soft scores. However, rather than using scores of the form (17), these models use a piecewise linear function of the distance to the centre of the interval. Although a different slope is used for points inside and outside the interval, we may question to what extent the resulting embeddings still define regions. While the regions defined by scoring functions of the form (17) also have fuzzy boundaries, this "fuzziness" is mostly limited to the immediate vicinity of the boundary.
We also consider a variant of the distance function (17) which uses learnable attention weights uatt, as follows:
where we write ⊙ for component-wise multiplication. Weighted variants of distx, disty and distv are defined analogously. The attention weights intuitively allow the model to "forget" certain constraints, e.g. by focusing only (or primarily) on the u band in some coordinates.
| FB15k-237 | WN18RR | |||||||
|---|---|---|---|---|---|---|---|---|
| H@1 | H@3 | H@10 | MRR | H@1 | H@3 | H@10 | MRR | |
| TransE | 22.3 | 37.2 | 53.1 | 33.2 | 01.3 | 40.1 | 52.9 | 22.3 |
| BoxE | 23.8 | 37.4 | 53.8 | 33.7 | 40.0 | 47.2 | 54.1 | 45.1 |
| ExpressivE | 24.3 | 36.6 | 51.2 | 33.3 | 46.4 | 52.2 | 59.7 | 50.8 |
| u | 23.1 | 37.3 | 53.2 | 33.2 | 01.6 | 39.9 | 51.5 | 22.0 |
| ux | 23.3 | 37.1 | 52.5 | 33.1 | 01.9 | 39.0 | 51.6 | 21.8 |
| uxy | 23.2 | 37.2 | 53.1 | 33.2 | 01.8 | 40.8 | 52.8 | 22.8 |
| uv∗ | 24.1 | 36.9 | 52.8 | 33.6 | 43.6 | 48.5 | 52.9 | 46.9 |
| uvxy∗ | 24.1 | 36.7 | 51.7 | 33.2 | 43.6 | 49.2 | 56.1 | 47.9 |
As in BoxE and ExpressivE, coordinate-wise scores are aggregated to a scalar by taking their negated norm. We define dist(e, r, f ) = distx(e, r, f ) ⊕ disty (e, r, f ) ⊕ distu(e, r, f ) ⊕ distv(e, r, f) and score triples as follows (and similar for the weighted variant):
In the above expression, p is a hyperparameter. Learning occurs by minimizing the following margin loss function with self-adversarial negative sampling [Sun et al., 2019]:
where α = softmax(s(e1, r, f1) ⊕ . . . ⊕ s(en, r, fn), the margin λ is a hyperparameter, and N = {(e1, r, f1), . . . , (en, r, fn)} is a set of randomly sampled negative examples.
6 Experimental Results
We consider several variants of our model. The full model is denoted by uvxy, whereas ux refers to a model in which distv and disty are not used, and similar for the other variants. For uv and uvxy, we have used the variant with attention weights (18). For the other configurations, attention weights were not used, as they were found to make little difference 4 . Note that our u model is almost identical to TransE, except that an explicit width parameter is used, while uv can be seen as a variant of ExpressivE without learnable scale factors.
Table 1 compares the performance of our model with TransE [Bordes et al., 2013], BoxE [Abboud et al., 2020] and ExpressivE [Pavlovic and Sallinger, 2023] for link prediction, using the two most common benchmarks [Toutanova and Chen, 2015; Dettmers et al., 2018]. As usual, performance is measured using Hits@k and Mean Reciprocal Rank (MRR). All results are for 1000-dimensional embeddings for FB15k-237 and 500-dimensional embeddings for WN18RR, following BoxE and ExpressivE's experimental setup. Other hyperparameters are specified in the supplementary materials.
The performance of u is almost identical to TransE, which suggests that the addition of an explicit width parameter plays no significant role. Adding the x, y and v constraints does not bring any benefits on FB15k-237. On WN18RR, however, introducing the v constraint has a big impact on H@1, which goes from less than 1% for u, ux and uxy to more than 40% for uv and uvxy. This result is in line with Proposition 5, which states that hexagons cannot capture relations that are both symmetric and irreflexive: for most WN18RR relations, models without v constraints incorrectly rank (e, r, e) triples first 5 . Including the x and y constraints also improves performances in the case of WN18RR. Introducing attention weights, as in (18), has a significant positive effect on the overall performance on WN18RR but not for FB15k-237. As Table 1 shows, uvxy outperforms BoxE on all metrics. Further analysis can be found in the supplementary materials.
4 An analysis of the impact of attention weights can be found in the supplementary materials.

Octagon embeddings slightly underperform ExpressivE in most cases. We may wonder whether this reflects the inherent limitations of using fixed angles. In fact, when inspecting the scale factors in learned ExpressivE embedddings, we noticed that most are close to -1, 0 or 1 (see Figure 4). In other words, most of the learned parallelograms are diamonds (uv), bands (u, v, x, y) or squares (xy), all of which can be represented in our octagon model. This suggests that the underperformance of the octagon model is rather the result of overparameterisation. On the one hand, we have shown theoretically that all four constraints are needed to capture semantic dependencies, and this is also confirmed by our empirical results on WN18RR. On the other hand, not all constraints might be needed for all coordinates. The use of attention weights was inspired by this view, but the weights themselves of course also introduce further parameters.
7 RelatedWork
Knowledge graph embeddings have generally been classified in three broad categories: linear models, tensor decomposition models and neural models [Hogan et al., 2021]. Linear models use a distance to score triples, after applying a linear transformation to entity or relation embeddings, e.g. a translation [Bordes et al., 2013] or rotation [Sun et al., 2019]. Region based models can essentially be viewed under the same umbrella, where the idea of computing distances between points is generalised to evaluating relationships between points and regions. Tensor decomposition models, such as ComplEx [Trouillon et al., 2017; Lacroix et al., 2018], TuckER [Balazevic et al., 2019] and QuatE [Zhang et al., 2019], view knowledge graphs as a three-dimensional tensor, which can be factorised into (low-rank) entity and relation embeddings. While these models tend to perform well, they often come with a significantly higher computational cost. Another important limitation is that they are far less interpretable in terms of how they capture semantic dependencies between relations. Tensor decomposition models also have important theoretical limitations when it comes to capturing rules [Guti´errez-Basulto and Schockaert, 2018]. Neural models, including ConvE [Dettmers et al., 2018] and graph neural network based approaches [Zhu et al., 2021], are even less interpretable than tensor decomposition models.
5 This result still holds without attention weights: on WN18RR, uvxy achieves a H@1 of 39.6, H@3 of 45.9, H@10 of 50.7 and MRR of 43.8 without trainable attention weights.
Knowledge graph embeddings have been combined with rules in various ways. For instance, it has been proposed to incorporate learned rules [Guo et al., 2018] or hard ontological constraints [Abboud et al., 2020] when learning knowledge graph embeddings. Conversely, learned embeddings have been exploited for implementing an efficient rule mining system [Omran et al., 2018]. The ability of models to capture rules has also been evaluated indirectly, for instance by analysing their inductive generalisation capabilities [Trouillon et al., 2019] or their ability to capture intersections and compositions of relations for evaluating complex queries [Arakelyan et al., 2021; Wang et al., 2023].
Region based approaches are closely related to ontology embeddings. In particular, several models have recently been introduced for the Description Logic EL++, which features subsumption and composition of relations, as well as union and intersection of concepts. Concepts are typically embedded as hyperballs [Mondal et al., 2021] or hypercubes [Xiong et al., 2022]. The Box2EL model [Jackermeier et al., 2023] also represents relations as regions, based on BoxE, which was found to improve performance. Given the limitations of BoxE on modeling composition, an evaluation of more expressive region based models is likely to yield even better results, although such an evaluation is yet to be performed.
8 Conclusions
The study of region based knowledge graph embedding essentially aims to identify the simplest models that are capable of capturing particular types of reasoning patterns. Despite the extensive work on knowledge graph embedding, there are still surprisingly many open questions on this front. Octagons where shown to be capable of capturing arbitrary knowledge graphs, while a simpler model based on hexagons is not. Octagons also have the desired property of being closed under intersection and composition, which is not the case for closely related models such as BoxE and ExpressivE. We have furthermore shown that the octagon model is capable of modelling (particular) sets of composition rules, which is an important property that was not yet shown for existing region based models. Our empirical results show that octagon embeddings slightly underperform ExpressivE and further work is needed to better understand whether this performance gap can be closed by changing how the octagons are learned.
Acknowledgments
Computations have been performed on the supercomputer facilities of the M´esocentre Clermont-Auvergne of the Universit´e Clermont Auvergne. Steven Schockaert was supported by grants from EPSRC (EP/W003309/1) and the Leverhulme Trust (RPG-2021-140).
@inproceedings{ijcai2024p364,
title = {Capturing Knowledge Graphs and Rules with Octagon Embeddings},
author = {Charpenay, Victor and Schockaert, Steven},
booktitle = {Proceedings of the Thirty-Third International Joint Conference on
Artificial Intelligence, {IJCAI-24}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Kate Larson},
pages = {3289--3297},
year = {2024},
month = {8},
note = {Main Track},
doi = {10.24963/ijcai.2024/364},
url = {https://doi.org/10.24963/ijcai.2024/364},
}
TY - CPAPER TI - Capturing Knowledge Graphs and Rules with Octagon Embeddings AU - Charpenay, Victor AU - Schockaert, Steven T2 - Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence, IJCAI-24 PB - International Joint Conferences on Artificial Intelligence Organization PY - 2024 SP - 3289 EP - 3297 DO - 10.24963/ijcai.2024/364 UR - https://doi.org/10.24963/ijcai.2024/364 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: