Skip to main content

pyRDF2Vec: A Python Implementation and Extension of RDF2Vec

  • Conference paper
  • First Online:
The Semantic Web (ESWC 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13870))

Included in the following conference series:

  • 1307 Accesses

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.

Resource type: Software

License: MIT license

URL: https://github.com/IBCNServices/pyRDF2Vec.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 89.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 119.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    https://www.kaggle.com/c/kaggle-survey-2022.

  2. 2.

    www.rdf2vec.org.

  3. 3.

    https://github.com/features/actions.

  4. 4.

    https://python-poetry.org/.

  5. 5.

    www.pytest.org.

  6. 6.

    http://mypy-lang.org/.

  7. 7.

    https://www.sphinx-doc.org/.

  8. 8.

    https://pepy.tech/project/pyRDF2Vec.

  9. 9.

    https://scholar.google.com/scholar?q="pyRDF2Vec".

  10. 10.

    https://github.com/IBCNServices/pyRDF2Vec.

References

  1. 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)

    Google Scholar 

  2. 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)

    Article  MathSciNet  MATH  Google Scholar 

  3. Choudhary, S., Luthra, T., Mittal, A., Singh, R.: A survey of knowledge graph embedding and their applications. arXiv preprint arXiv:2107.07842 (2021)

  4. 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)

    Google Scholar 

  5. 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)

    Article  Google Scholar 

  6. Degraeve, V., Vandewiele, G., Ongenae, F., Van Hoecke, S.: R-GCN: the R could stand for random. arXiv preprint arXiv:2203.02424 (2022)

  7. 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)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. 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)

    Google Scholar 

  10. Gurbuz, O., et al.: Knowledge graphs for indication expansion: an explainable target-disease prediction method. Front. Genet. 13, 814093 (2022)

    Article  Google Scholar 

  11. 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)

  12. 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

    Chapter  Google Scholar 

  13. Mikolov, T., Chen, K., Corrado, G., Dean, J.: Efficient estimation of word representations in vector space (2013)

    Google Scholar 

  14. Mukherjee, S., Oates, T., Wright, R.: Graph node embeddings using domain-aware biased random walks. arXiv preprint arXiv:1908.02947 (2019)

  15. Nickel, M., Murphy, K., Tresp, V., Gabrilovich, E.: A review of relational machine learning for knowledge graphs. Proc. IEEE 104(1), 11–33 (2015)

    Article  Google Scholar 

  16. 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)

    Article  Google Scholar 

  17. Portisch, J., Paulheim, H.: Putting RDF2Vec in order. arXiv preprint arXiv:2108.05280 (2021)

  18. 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)

    Article  Google Scholar 

  19. 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

    Chapter  Google Scholar 

  20. 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)

    Google Scholar 

  21. 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)

    Google Scholar 

  22. Sousa, R.T., Silva, S., Pesquita, C.: Supervised semantic similarity. bioRxiv (2021)

    Google Scholar 

  23. 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

    Chapter  Google Scholar 

  24. 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)

    Article  MathSciNet  MATH  Google Scholar 

  25. Taweel, A.A., Paulheim, H.: Towards exploiting implicit human feedback for improving RDF2Vec embeddings. arXiv preprint arXiv:2004.04423 (2020)

  26. 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)

    Article  Google Scholar 

  27. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Bram Steenwinckel .

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.

figure a

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics