# Skosmos Vocabulary Extractor (SKOS thesaurus API) (`datamule/skosmos-vocabulary-extractor`) Actor

Point at ANY Skosmos SKOS REST API and pull structured vocabulary data: list vocabularies, search concepts, resolve a concept URI to full detail (labels, broader/narrower/related, mappings), fetch top concepts and RDF types. Works with AGROVOC, ZBW/STW, Loterre and any conforming server.

- **URL**: https://apify.com/datamule/skosmos-vocabulary-extractor.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Skosmos Vocabulary Extractor (SKOS thesaurus API)

Point this actor at **any Skosmos server** and pull structured SKOS vocabulary data — no
per-service code required. [Skosmos](https://skosmos.org/) is the de-facto open-source
vocabulary / thesaurus browser: it powers the FAO's **AGROVOC**, the ZBW's **STW Thesaurus for
Economics**, France's **Loterre**, Finland's **Finto**, **ACTRIS**, and dozens of national and
domain-specific vocabulary services. Every one exposes the same SKOS REST API — this actor speaks
it generically.

SKOS (Simple Knowledge Organization System) is the W3C standard for thesauri, taxonomies,
classification schemes, and subject-heading systems. If you build knowledge graphs, do data
cleaning / subject indexing, or need controlled-vocabulary terms with their broader/narrower
hierarchy and cross-vocabulary mappings, this is your extraction layer.

### What it does

Five modes:

| Mode | What it returns |
|------|-----------------|
| **vocabularies** | Every vocabulary the server hosts — id, title, URI. The cheap connectivity probe; run it first to discover what's available. |
| **search** | Full-text concept search within a vocabulary (or globally across the whole server). One row per hit, carrying the `prefLabel`, `altLabel`, `type`, and language. Use a `*` suffix for prefix search. |
| **data** | Resolve a single concept URI to its **full detail**: every `prefLabel` in all languages, `broader` / `narrower` / `related` links, `notation`, `definition`, and cross-vocabulary mapping links (`exactMatch` / `closeMatch`). |
| **topConcepts** | The top-level concepts of a vocabulary — the roots of its hierarchy. |
| **types** | The RDF types (Concept, Collection, …) a vocabulary declares. |

### Example input

```json
{
  "baseUrl": "https://agrovoc.fao.org/browse/rest/v1",
  "modes": ["vocabularies", "search"],
  "vocab": "agrovoc",
  "query": "water*",
  "lang": "en",
  "maxHits": 50
}
```

Resolve one concept to full detail:

```json
{
  "baseUrl": "https://agrovoc.fao.org/browse/rest/v1",
  "modes": ["data"],
  "vocab": "agrovoc",
  "uri": "http://aims.fao.org/aos/agrovoc/c_8309"
}
```

### Servers you can point it at

- **AGROVOC (FAO)** — `https://agrovoc.fao.org/browse/rest/v1` (multilingual agriculture thesaurus)
- **ZBW / STW** — `https://zbw.eu/beta/skosmos/rest/v1` (economics: STW, JEL classification)
- **Loterre** — `https://loterre.istex.fr/rest/v1` (multi-domain French research vocabularies)
- **ACTRIS** — `https://vocabulary.actris.nilu.no/skosmos/rest/v1` (atmospheric research)
- ...and any other [Skosmos](https://skosmos.org/) instance (they all share the `/rest/v1` API).

### Output

Each result is one flat row tagged with its `mode`. Concept rows carry the `prefLabel`, the full
`uri`, the SKOS `type`, `notation`, and (in `data` mode) the `broader` / `narrower` / `related`
URI lists plus every-language `labels` and mapping links. Results render as a clean table in the
Apify Console and export to JSON, CSV, Excel, and more.

### Notes

- The `data` mode keeps **all languages** of every label (under `labels`), while `prefLabel` is the
  single best label for your chosen `lang`.
- A search that matches nothing is an honest empty result, not an error. If a whole run produces
  zero rows across every mode, the actor fails fast rather than reporting false success.
- Only public, read-only SKOS REST endpoints are queried; no authentication is used or required.

### Pricing

Pay-per-event: you are charged per result row produced. List vocabularies, search concepts, or
resolve a URI — you only pay for the records you get back.

# Actor input Schema

## `baseUrl` (type: `string`):

The `/rest/v1` root of ANY Skosmos server (the open-source SKOS vocabulary browser). Fetching `{baseUrl}/vocabularies` lists what it hosts. Examples: https://agrovoc.fao.org/browse/rest/v1 (FAO AGROVOC), https://zbw.eu/beta/skosmos/rest/v1 (ZBW/STW economics), https://loterre.istex.fr/rest/v1 (Loterre), https://vocabulary.actris.nilu.no/skosmos/rest/v1 (ACTRIS).

## `modes` (type: `array`):

Which operations to run. 'vocabularies' lists every vocabulary on the server (cheap connectivity probe). 'search' full-text searches concepts within a vocab (or globally). 'data' resolves a concept URI to full detail (all labels, broader/narrower/related, mappings). 'topConcepts' returns a vocab's hierarchy roots. 'types' lists the RDF types a vocab declares.

## `vocab` (type: `string`):

The vocabulary id to operate on (from a 'vocabularies' run, e.g. 'agrovoc', 'stw'). Required for 'data' and 'topConcepts'; optional for 'search' and 'types' (blank = search/type across the whole server).

## `query` (type: `string`):

For 'search' mode: the text to match against concept labels. Append '*' for a prefix search (e.g. 'water*'). Matched against prefLabel, altLabel and hiddenLabel.

## `uri` (type: `string`):

For 'data' mode: the full concept URI to resolve (get it from a prior 'search' run, e.g. http://aims.fao.org/aos/agrovoc/c\_8309).

## `lang` (type: `string`):

ISO 639-1 language code for labels (e.g. 'en', 'fr', 'de'). Controls which prefLabel is returned as the display label; the 'data' mode still keeps every language under 'labels'.

## `maxHits` (type: `integer`):

For 'search' mode: maximum concept hits to return.

## Actor input object example

```json
{
  "baseUrl": "https://agrovoc.fao.org/browse/rest/v1",
  "modes": [
    "vocabularies"
  ],
  "vocab": "agrovoc",
  "query": "water*",
  "lang": "en",
  "maxHits": 50
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "baseUrl": "https://agrovoc.fao.org/browse/rest/v1",
    "vocab": "agrovoc",
    "query": "water*"
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/skosmos-vocabulary-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "baseUrl": "https://agrovoc.fao.org/browse/rest/v1",
    "vocab": "agrovoc",
    "query": "water*",
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/skosmos-vocabulary-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "baseUrl": "https://agrovoc.fao.org/browse/rest/v1",
  "vocab": "agrovoc",
  "query": "water*"
}' |
apify call datamule/skosmos-vocabulary-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/skosmos-vocabulary-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/R5jJgRnekddp29tzA/builds/Nnv3JTpQEomAjjwrK/openapi.json
