---
title: Query data
url: https://docs.triply.cc/how-to/query-data/
description: 'Query a TriplyDB dataset from the browser: run SPARQL in the SPARQL IDE, search its text
  with Elasticsearch, or query it with GraphQL.'
---

# Query data

A dataset's left-hand sidebar lists the ways to query it under **Data queries**. SPARQL is there by
default; Elasticsearch and GraphQL appear only where the dataset or the instance supports them.

## Run a SPARQL query

1. Open the dataset and click **SPARQL** under **Data queries**.
2. Write the query in the editor, which autocompletes and reports errors as you type.
3. Pick what runs it from the **Endpoint** menu. **Speedy**, TriplyDB's built-in engine, is the
   default and needs no setup. Any SPARQL service the dataset runs is listed beside it; see
   [Manage services](https://docs.triply.cc/how-to/manage-services/) for starting one.
4. Click **Execute query**, or press <kbd>Ctrl</kbd>+<kbd>Enter</kbd> (<kbd>⌘</kbd>+<kbd>Enter</kbd>
   on a Mac).

The results appear below the editor, where they can be shown as a table or as one of the other
visualizations on offer. To keep the query, click **Save query**; see
[Work with saved queries](https://docs.triply.cc/how-to/saved-queries/) for what a saved query gives you.

New to SPARQL? Start with [SPARQL: the basics](https://docs.triply.cc/concepts/sparql-basics/).

## Search the text with Elasticsearch

**Elasticsearch** appears under **Data queries** only when the dataset runs an Elasticsearch
service; see [Manage services](https://docs.triply.cc/how-to/manage-services/#create-a-service).

1. Open the dataset and click **Elasticsearch**.
2. Type a term in the **Search** field and press <kbd>Enter</kbd>.

This works like a search engine: it returns every node that contains the term, or contains it in
one of its properties. For more control, write a query in the Elasticsearch
[Query DSL](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html)
instead.

## Query with GraphQL

**GraphQL** appears under **Data queries** on instances where it is enabled. It queries a schema
that TriplyDB generates from the SHACL shapes in the dataset, so the dataset needs those shapes
first.

1. Open the dataset and click **GraphQL**.
2. Write the query and run it.

For the schema, the queries it accepts, filtering and pagination, see
[GraphQL](https://docs.triply.cc/reference/graphql/).

## Related

- [Work with saved queries](https://docs.triply.cc/how-to/saved-queries/) — saving, versioning and sharing a query
- [Paginate SPARQL results](https://docs.triply.cc/how-to/sparql-pagination/) — getting every result, not the first page
- [SPARQL introspection functions](https://docs.triply.cc/reference/introspection/) — functions only Speedy supports
