How to query a graph database

To query a graph database you need two things: an access point to send queries to—an API or directly through a terminal; and a query language.

Access varies depending on the database so it would be futile to go into much detail, but it is worth mentioning that RDFox is commonly queried in the shell, via the web console, or REST API, depending on the use case.

There is a seemingly endless list of query languages. Their nuances are important when crafting a specific solution but they all aim for a similar goal—to extract and/or manipulate data in a database. Some of the most common are GraphQL, Gremlin, and of course, SPARQL—the W3C standard.

Those are your tools, but now let’s look at how.

This is how to query a graph database through the RDFox web console, returning the entire dataset:

First, spin up your database, import your data, and start the endpoint.

Then write the following SPARQL query:

WHERE{ ?S ?P ?O }

And hit run.

Within the console you will see up to the first 200 results, but you can export the results in a number of file formats for further examination.

It’s as simple as that!

If you’d like to learn more about this query and more advanced queries, see our Getting Started Guide in the documentation, or the RDFox Getting Started tutorial series over on Youtube.

Down arrow icon.