Use Python with Stardog

Apr 7, 2020, 2 minute read
Stardog Newsletter

Get the latest in your inbox

Python has become very popular for data science applications. It is now possible to access your Stardog Knowledge Graph using Python and our wrapper library called pystardog. Keep reading to see how easy it can be.

1. Download and install Stardog
2. Create a Python virtualenv and install requirements
3. Download the notebook and tutorial dataset
4. Open the notebook
5. Follow the instructions in the notebook

1. Download and install Stardog

  1. Follow the directions here to set up Stardog on your computer.
  2. Test that Stardog is running with
   $ stardog-admin server status

2. Create a Python virtualenv and install requirements

This tutorial assumes that you are running Python 3.3 or newer. If that is not the case, follow this page to get a virtualenv created instead of the following steps. I keep my virtualenvs in ~/.virtualenvs. If you use a different directory plug it in instead.

  1. Create a virtualenv
   python3 -m venv ~/.virtualenvs/tutorial
  1. Activate the virtualenv
   . ~/.virtualenvs/tutorial/bin/activate
  1. Install requirements
   pip install pystardog jupyterlab pandas seaborn

3. Download the notebook and tutorial dataset

Notebook

Schema

Data

4. Open the notebook

From within the directory that you saved the notebook and dataset:

jupyter notebook

5. Follow the instructions in the notebook.

Stardog and your favorite Python libraries make a strong team. I hope this gentle introduction will help you begin your next data masterpiece. Good luck!

download our free e-guide

Knowledge Graphs 101

How to Overcome a Major Enterprise Liability and Unleash Massive Potential

Download for free
ebook