Abstract
This paper introduces pyRDF2Vec, a Python software package that reimplements the well-known RDF2Vec algorithm along with several of its extensions. By making the algorithm available in the most popular data science language, and by bundling all extensions into a single place, the use of RDF2Vec is simplified for data scientists. The package is released under an MIT license and structured in such a way to foster further research into sampling, walking, and embedding strategies, which are vital components of the RDF2Vec algorithm. Several optimisations have been implemented in pyRDF2Vec that allow for more efficient walk extraction than the original algorithm. Furthermore, best practices in terms of code styling, testing, and documentation were applied such that the package is future-proof as well as to facilitate external contributions.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
References
Bordes, A., Usunier, N., Garcia-Duran, A., Weston, J., Yakhnenko, O.: Translating embeddings for modeling multi-relational data. In: Advances in Neural Information Processing Systems, vol. 26 (2013)
Chen, J., Hu, P., Jimenez-Ruiz, E., Holter, O.M., Antonyrajah, D., Horrocks, I.: OWL2Vec*: embedding of owl ontologies. Mach. Learn. 110(7), 1813–1845 (2021)
Choudhary, S., Luthra, T., Mittal, A., Singh, R.: A survey of knowledge graph embedding and their applications. arXiv preprint arXiv:2107.07842 (2021)
Cochez, M., Ristoski, P., Ponzetto, S.P., Paulheim, H.: Biased graph walks for RDF graph embeddings. In: Proceedings of the 7th International Conference on Web Intelligence, Mining and Semantics, pp. 1–12 (2017)
De Vries, G.K.D., De Rooij, S.: Substructure counting graph kernels for machine learning from RDF data. J. Web Semant. 35, 71–84 (2015)
Degraeve, V., Vandewiele, G., Ongenae, F., Van Hoecke, S.: R-GCN: the R could stand for random. arXiv preprint arXiv:2203.02424 (2022)
Engleitner, N., Kreiner, W., Schwarz, N., Kopetzky, T., Ehrlinger, L.: Knowledge graph embeddings for news article tag recommendation. In: Joint Proceedings of the Semantics Co-located Events: Poster\(\backslash \) &Demo Track and Workshop on Ontology-Driven Conceptual Modelling of Digital Twins co-located with Semantics 2021, Amsterdam and Online, 6–9 September 2021. CEUR-WS. org (2021)
Gkotse, B., Jouvelot, P., Ravotti, F.: Ontology embeddings with ontowalk2vec: an application to UI personalisation. Ph.D. thesis, MINES ParisTech-PSL Research University; CERN-Suisse (2022)
Grave, E., Bojanowski, P., Gupta, P., Joulin, A., Mikolov, T.: Learning word vectors for 157 languages. In: Proceedings of the International Conference on Language Resources and Evaluation (LREC 2018) (2018)
Gurbuz, O., et al.: Knowledge graphs for indication expansion: an explainable target-disease prediction method. Front. Genet. 13, 814093 (2022)
Iana, A., Paulheim, H.: More is not always better: the negative impact of A-box materialization on RDF2Vec knowledge graph embeddings. arXiv preprint arXiv:2009.00318 (2020)
Jain, N., Kalo, J.-C., Balke, W.-T., Krestel, R.: Do embeddings actually capture knowledge graph semantics? In: Verborgh, R., et al. (eds.) ESWC 2021. LNCS, vol. 12731, pp. 143–159. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-77385-4_9
Mikolov, T., Chen, K., Corrado, G., Dean, J.: Efficient estimation of word representations in vector space (2013)
Mukherjee, S., Oates, T., Wright, R.: Graph node embeddings using domain-aware biased random walks. arXiv preprint arXiv:1908.02947 (2019)
Nickel, M., Murphy, K., Tresp, V., Gabrilovich, E.: A review of relational machine learning for knowledge graphs. Proc. IEEE 104(1), 11–33 (2015)
Portisch, J., Heist, N., Paulheim, H.: Knowledge graph embedding for data mining vs. knowledge graph embedding for link prediction-two sides of the same coin? Semant. Web 13(3), 399–422 (2022)
Portisch, J., Paulheim, H.: Putting RDF2Vec in order. arXiv preprint arXiv:2108.05280 (2021)
Ristoski, P., Rosati, J., Di Noia, T., De Leone, R., Paulheim, H.: RDF2Vec: RDF graph embeddings and their applications. Semant. Web 10(4), 721–752 (2019)
Schlichtkrull, M., Kipf, T.N., Bloem, P., van den Berg, R., Titov, I., Welling, M.: Modeling relational data with graph convolutional networks. In: Gangemi, A., et al. (eds.) ESWC 2018. LNCS, vol. 10843, pp. 593–607. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-93417-4_38
Shi, Y., Cheng, G., Tran, T.K., Kharlamov, E., Shen, Y.: Efficient computation of semantically cohesive subgraphs for keyword-based knowledge graph exploration. In: Proceedings of the Web Conference 2021, pp. 1410–1421 (2021)
Shi, Y., Cheng, G., Tran, T.K., Tang, J., Kharlamov, E.: Keyword-based knowledge graph exploration based on quadratic group Steiner trees. In: IJCAI, vol. 2021, pp. 1555–1562 (2021)
Sousa, R.T., Silva, S., Pesquita, C.: Supervised semantic similarity. bioRxiv (2021)
Steenwinckel, B., et al.: Walk extraction strategies for node embeddings with RDF2Vec in knowledge graphs. In: Kotsis, G., et al. (eds.) DEXA 2021. CCIS, vol. 1479, pp. 70–80. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-87101-7_8
Steenwinckel, B., Vandewiele, G., Weyns, M., Agozzino, T., Turck, F.D., Ongenae, F.: INK: knowledge graph embeddings for node classification. Data Min. Knowl. Discov. 36, 620–667 (2022)
Taweel, A.A., Paulheim, H.: Towards exploiting implicit human feedback for improving RDF2Vec embeddings. arXiv preprint arXiv:2004.04423 (2020)
Wang, Q., Mao, Z., Wang, B., Guo, L.: Knowledge graph embedding: a survey of approaches and applications. IEEE Trans. Knowl. Data Eng. 29(12), 2724–2743 (2017)
Zhang, S., Lin, X., Zhang, X.: Discovering DTI and DDI by knowledge graph with MHRW and improved neural network. In: 2021 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), pp. 588–593. IEEE (2021)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Appendix: Example Usage
A Appendix: Example Usage
We now provide a simple code snippet in Listing 1 that demonstrates how a user can generate embeddings for nodes of interest in his/her KG with just a few lines of code.

Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Steenwinckel, B., Vandewiele, G., Agozzino, T., Ongenae, F. (2023). pyRDF2Vec: A Python Implementation and Extension of RDF2Vec. In: Pesquita, C., et al. The Semantic Web. ESWC 2023. Lecture Notes in Computer Science, vol 13870. Springer, Cham. https://doi.org/10.1007/978-3-031-33455-9_28
Download citation
DOI: https://doi.org/10.1007/978-3-031-33455-9_28
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-33454-2
Online ISBN: 978-3-031-33455-9
eBook Packages: Computer ScienceComputer Science (R0)