Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quick Start

This chapter demonstrates how to load and query the Mona Lisa knowledge graph using Tentris. Tentris can be used via a statically pre-built binary, a docker image or Python.

License

To use Tentris, a license needs to be requested via https://tentris.io.

Binary

The Tentris binary is the recommended method for deployments, as it provides more features than both the docker image and the Python bindings.

  1. Place the license at ~/.config/tentris-license.toml.
    If the license is placed in Downloads, it can be moved to the correct location using the following command.

    mv ~/Downloads/tentris-license.toml ~/.config/tentris-license.toml
    
  2. Download and install Tentris.

    curl --proto https --tlsv1.2 -sSf https://raw.githubusercontent.com/tentris/tentris/refs/heads/main/install.sh | sh
    
    Manual Installation

    The files for manually installing Tentris can be found here.

    Note: See the chapter Uninstalling Tentris on how to uninstall Tentris.

  3. Load the Mona Lisa knowledge graph using the offline loader.

    curl -sSf "https://files.tentris.io/mona-lisa.ttl" | tentris load
    
  4. Start the server.

    tentris serve
    
  5. Visit the Web UI (http://0.0.0.0:9080/ui) to query the knowledge graph.

For more details about the binary, please refer to the chapter Binary.

Docker Image

The docker image is recommended for trying out Tentris.

  1. Start the server.

    docker run -it \
         -v ./tentris-license.toml:/config/tentris-license.toml:ro \
         -v ./data:/data \
         -p 9080:9080 \
         ghcr.io/tentris/tentris:latest
    
  2. Load the Mona Lisa knowledge graph using SPARQL Update.

    curl -H "Content-Type: application/sparql-update" \
         --data "LOAD <https://files.tentris.io/mona-lisa.ttl>" "http://localhost:9080/update"
    
  3. Visit the Web UI (http://0.0.0.0:9080/ui) to query the knowledge graph.

For more details about the docker image, please refer to the chapter Docker.

⚠️ Warning: if you are using colima on macOS to run docker containers, make sure that mountType is set to virtiofs and vmType is set to vz. This can be changed with colima start --edit. In our testing other options prevented docker from mounting the license properly.

Python

The Python bindings are recommended if you want to use Tentris in your Python scripts.

  1. Install the Python bindings of Tentris.
    curl --proto https --tlsv1.2 -sSf https://raw.githubusercontent.com/tentris/tentris/refs/heads/main/install-python.sh | sh
    
  2. Run the following script.
    import tentris
    import rdflib
    
    # Create an RDFLib graph using Tentris as its backend
    g = rdflib.Graph(store="TentrisStore")
    # Load the graph using the SPARQL Update operation `LOAD`
    # https://www.w3.org/TR/2013/REC-sparql11-update-20130321/#load 
    g.update("LOAD <https://files.tentris.io/mona-lisa.ttl>")
    # Query the Mona Lisa knowledge graph
    query_str = """
       PREFIX foaf: <http://xmlns.com/foaf/0.1/>
       PREFIX dbr: <http://dbpedia.org/resource/>
       PREFIX dbo: <http://dbpedia.org/ontology/>
    
       SELECT ?name WHERE {
          dbr:Mona_Lisa dbo:author ?person .
          ?person foaf:name ?name .
       }
    """
    for binding in graph.query(query_str):
       print(f"{binding.name.n3()}")
    

⚠️ Warning: In the case of the Python bindings, TentrisStore is an in-memory store and knowledge graphs are not persisted.

For more details about the Python bindings (e.g., persistence), please refer to the chapter Python.