Run a WOQL Query

This how-to guide provides an example of the WOQL query language using the Python client.

Assume that you have installed the client, connected to a database, and connected with a client.

WOQLQuery

Writing WOQL queries in Python is fairly simple. We have a WOQLQuery class that can be used to construct WOQL Queries.

A simple example, in which we get all the names of the people in the database:

from terminusdb_client import WOQLQuery, WOQLClient

query = WOQLQuery().woql_and(
    WOQLQuery().triple('v:PersonId', 'rdf:type', '@schema:Person'),
    WOQLQuery().triple('v:PersonId', '@schema:name', 'v:Name')
)
result = client.query(query)

Last updated