Blog Post

How to set up an API for a SKOS based taxonomy with just a few clicks.

Ravinder Singh • 30 June 2020

In this short tutorial we are going to learn how to set up a taxonomy delivery API using the EasyGraph platform. All it takes is a few minutes.

For our example we are going to use a taxonomy of languages. The example taxonomy was built using Graphologi and then exported. We will use this exported file in the following steps. You can download the taxonomy and workspace file from https://github.com/Graphifi/blog-EasyGraph-API-for-SKOS-taxonomy/archive/master.zip

If you want to view the taxonomy in Graphologi you can create a Graphologi trial account by signing up at https://graphologi.graphifi.com/ and then import the file. To learn more about Graphologi please see https://www.graphifi.com/graphologi

As shown in the image below our example taxonomy has only three languages of which two have narrower concepts.

Next we are going to set up EasyGraph. We will be using the online version of EasyGraph for this example, but if you want to try it all on your local setupthe steps are the same.

Go to https://easygraph.graphifi.com/ and login (you will need a LinkedIn account).

From the dashboard click on the Bootstrap card.

On the Basics screen enter details as shown below and click Next.

On the Load Ontology screen choose the “Graphologi Model (includes SKOS, SKOS-XL)” option and click Next.

You do not need to do anything in the Prefixes, Aliases and Preview Shapes steps so click Next in all these steps.

On the ID Setup screen select the “Clear All (Read Only API)” option as shown below.

Click the Finish button. That is all you need to do to set up the API.

Next let us import the taxonomy data into EasyGraph. From the dashboard select the System Manager and click the Import tab.

Click on the Data tab and then click Browse Files button. From the file dialog select the taxonomy file which you downloaded earlier. Click the Import button. You should see a success message.

Now we will try some API requests using Playground. An example playground workspace has been created for this example. You can download it from https://github.com/Graphifi/blog-EasyGraph-API-for-SKOS-taxonomy/archive/master.zip

To learn more about the Playground please see the documentation at https://easygraph.graphifi.com/docs/easygraph.html#playground or take a look at the EasyGraph quick start tutorial https://www.graphifi.com/easygraph-quick-start-search

From the dashboard select the Playground and import the workspace file. Open the newly imported workspace. Once opened you should see the requests as in the image below.

The first request is to search for resources of type ‘concept scheme’ (skos:ConceptScheme). As we have imported only one taxonomy this request should return only one resource.

The second request searches for resources of type Concept (skos:Concept) that are in a concept scheme.

The third request shows how linked resources (SKOS-XL labels) can be fetched using a single search request.

The fourth request shows how a filter can be added to a concept, where linked resources must satisfy the criteria of the filter for the concepts to be returned in the results.

The last request shows how facets can be used to return counts.

To see how each request is built, expand the request and click the Build tab as shown in the screenshot below.

To run all the requests click the play button at the top of the screen. Once the request has been run the results are available in the Response tab.

That is all for this post. We would love to know what you think or if you have any questions, suggestions or hit a bug please get in touch.

Share by: