Skip to main content

Extracting the ontologies

Data.world provides a powerful mechanism for exploring the system ontologies that underpin the platform’s catalog. These ontologies are accessible within every dataset through a special graph called :system. This section outlines how to query and extract ontology information for both the KOS and DWEC models.

Accessing the platform ontologies

To work with the platform ontologies, you will query the :system graph. Whenever you initiate a new query, the workspace automatically defines a :system graph relative to the dataset, ensuring consistent ontology access.

Note that you can download the results of any query as a TTL file by selecting the Download as turtle (TTL) menu option from the Download menu.

extract_ontology_01.png

Working with KOS

KOS (Knowledge Organization System) defines a structured model that describes many types of cataloged entities. It includes a core model as well as a variety of extensions tailored for different technologies.

Query the core KOS model

The core KOS model contains foundational classes and properties (for example, tables, columns). You can extract the core model using the following query.

This query retrieves around 300 resources, offering a manageable starting point for exploration.

Query:

PREFIX : <this is filled in by your SPARQL editor>
PREFIX kos: <https://open-kos.org/schema/>
PREFIX dwec: <https://dwec.data.world/v0/>

DESCRIBE ?s 
FROM :system 
WHERE {
    ?s ?p ?o . 
    FILTER (afn:namespace(?s) = afn:namespace (kos:))
}

Sample results:

extract_ontology_02.png

Query all KOS extensions

The KOS extensions cover specific technologies and contain a much broader set of ontology resources (approximately 3000). To retrieve all KOS extensions:

Query:

PREFIX : <this is filled in by your SPARQL editor>
PREFIX kos: <https://open-kos.org/schema/>
PREFIX dwec: <https://dwec.data.world/v0/>

DESCRIBE ?s 
FROM :system 
WHERE {
    ?s ?p ?o . 
    FILTER (STRSTARTS (STR(?s), "https://open-kos.org/"))
}

Sample results:

extract_ontology_03.png

Query a specific KOS extension

If you wish to focus on a particular technology extension (e.g., Snowflake), modify the FILTER accordingly. For example, to retrieve only Snowflake-specific resources.

The Snowflake extension includes about 46 resources.

Query:

PREFIX kos: <https://open-kos.org/schema/>
PREFIX dwec: <https://dwec.data.world/v0/>

DESCRIBE ?s 
FROM :system 
WHERE {
    ?s ?p ?o . 
    FILTER (STRSTARTS (STR(?s), "https://open-kos.org/ext/kos-snowflake/"))
}

You can repeat this for any extension you see in the main export.

Sample results:

extract_ontology_04.png

Working with DWEC

DWEC (data.world Entity Catalog) also defines catalog structures. While similar to KOS, DWEC is less modular. Extraction of its core and full model follows similar patterns.

Query the core DWEC model

Retrieve the base classes and properties defined within the core DWEC model.

Query:

PREFIX kos: <https://open-kos.org/schema/>
PREFIX dwec: <https://dwec.data.world/v0/>

DESCRIBE ?s 
FROM :system 
WHERE {
    ?s ?p ?o . 
    FILTER (afn:namespace(?s) = afn:namespace (dwec:))
}

Sample results:

extract_ontology_05.png

Query all DWEC resources

Extract all available DWEC resources, including modular and extension elements.

Because DWEC’s modularity is less strict compared to KOS, filtering for specific structures may require more careful inspection of the results.

Query:

PREFIX kos: <https://open-kos.org/schema/>
PREFIX dwec: <https://dwec.data.world/v0/>

DESCRIBE ?s 
FROM :system 
WHERE {
    ?s ?p ?o . 
    FILTER (STRSTARTS (STR(?s), "https://dwec.data.world/"))
}

Sample results:

extract_ontology_06.png

It is important to understand how ontology classes relate to the types of resources visible in the catalog. In KOS extensions (e.g., Snowflake), the owl:Class definitions correspond directly to catalog entities. For example, a class such as SnowflakeRowAccessPolicy represents a type of resource you can find in the catalog interface.