Skip to content

Simple Knowledge Organization System (SKOS)

rossbowen edited this page Mar 10, 2023 · 2 revisions

SKOS (Simple Knowledge Organization System) is a vocabulary for describing the basic structure and content of concept schemes such as thesauri, classification schemes, subject heading lists, and taxonomies. It is used to represent the semantic relationships between concepts, such as broader and narrower terms, and related concepts, in a machine-readable format. This allows for the integration and linking of different concept schemes, and facilitates the discovery and reuse of knowledge resources on the web.

Resources

  • The SKOS Primer has introductory material and examples.

The examples in this wiki are included as files which can be retrieved by cloning the wiki's repo.

git clone https://github.com/GSS-Cogs/knowledge.wiki.git

Concepts

Concepts are the individual pieces of a classification. In a classification of animals, there may be different concepts for dog, cat, fish etc.

SKOS provides a skos:Concept class to indicate some resource is a concept.

@prefix ex: <http://example.org#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

ex:dog a skos:Concept .
ex:cat a skos:Concept .
ex:fish a skos:Concept .

Concept schemes

Concept schemes

@prefix ex: <http://example.org#> .

ex:animals a skos:ConceptScheme .

A concept belonging to a particular scheme can be indicated with skos:inScheme.

@prefix ex: <http://example.org#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .

ex:dog a skos:Concept ;
    skos:inScheme ex:animals ;
    .

ex:cat a skos:Concept ;
    skos:inScheme ex:animals ;
    .

# etc.
flowchart
    ex:animals((ex:animals)) --rdf:type--> skos:ConceptScheme((skos:ConceptScheme))

    ex:dog((ex:dog)) --rdf:type--> skos:Concept((skos:Concept))
    ex:cat((ex:cat)) --rdf:type--> skos:Concept((skos:Concept))
    ex:fish((ex:fish)) --rdf:type--> skos:Concept((skos:Concept))

    ex:dog((ex:dog)) --skos:inScheme--> ex:animals
    ex:cat((ex:cat)) --skos:inScheme--> ex:animals
    ex:fish((ex:fish)) --skos:inScheme--> ex:animals
Loading

SKOS also defines a skos:Collection. Some discussion of the differences between collections and concept schemes is here.

Hierarchies

Hierarchies in codelists must be indicated by using the skos:broader and skos:narrower predicates.

For example, in a dataset describing types of animals, we can express the relationship:

  • some animals are mammals,
  • but all mammals are animals

by asserting:

<#animals> skos:narrower <#mammals> .
<#mammals> skos:broader <#animals> .

This looks diagrammatically as follows:

flowchart TD
    id1((animals)) -->|some| id2((mammals))
    id2((mammals)) -->|all| id1((animals))
    id3((animals)) -->|skos:narrower| id4((mammals))
    id4((mammals)) -->|skos:broader| id3((animals))
Loading

Top concepts

The codes at the top of the hierarchy (and so have no skos:broader relationships) must be related to the codelist using the skos:hasTopConcept property.

flowchart TD
    Animals[Animals Codelist] -->|skos:hasTopConcept| animals
    animals -->|skos:narrower| mammals
    mammals -->|skos:broader| animals
Loading

Using CSVW to create a codelist or SKOS taxonomy

We can use CSVW as a convenient way to create a codelist, represented in RDF using SKOS.

For example, take the Standard Industrial Trade Classification (SITC):

0 Food and live animals
├─ 00 Live animals other than animals of division 03
│  ├─ 001 Live animals other than animals of division 03
├─ 01 Meat and meat preparations
│  ├─ 011 Meat of bovine animals, fresh, chilled or frozen
│  ├─ 012 Other meat and edible meat offal
│  ├─ 016 Meat, edible meat offal, salted, dried; flours, meals
│  ├─ 017 Meat, edible meat offal, prepared, preserved, n.e.s
│  ├─ ...
├─ 02 Dairy products and birds' eggs
│  ├─   022 Milk, cream and milk products (excluding butter, cheese)
│  ├─ ...

We can create a CSV representation of the different classifications along with the hierarchy as follows:

notation label comment parent
0 Food and live animals ...
00 Live animals other than animals of division 03 ... 0
001 Live animals other than animals of division 03 ... 00
01 Meat and meat preparations ... 0
011 Meat of bovine animals, fresh, chilled or frozen ... 01
012 Other meat and edible meat offal ... 01
016 Meat, edible meat offal, salted, dried; flours, meals ... 01
017 Meat, edible meat offal, prepared, preserved, n.e.s ... 01
... ... ...
02 Dairy products and birds' eggs ... 0
022 Milk, cream and milk products (excluding butter, cheese) ... 02
... ... ...

We are able to create a CSVW file which can be used to create a codelist. Note the use of virtual columns to assert the type and the relationship between the concepts and the concept scheme.

{
    "@context": "http://www.w3.org/ns/csvw",
    "@id": "http://data.gov.uk/codelist/standard-international-trade-classification/revision-4.csv",
    "@type": "Table",
    "url": "http://data.gov.uk/codelist/standard-international-trade-classification/revision-4.csv",
    "tableSchema": {
        "columns": [
            {
                "titles": "notation",
                "name": "notation",
                "required": true,
                "propertyUrl": "skos:notation"
            },
            {
                "titles": "label",
                "name": "label",
                "required": true,
                "propertyUrl": "rdfs:label"
            },
            {
                "titles": "comment",
                "name": "comment",
                "required": false,
                "propertyUrl": "rdfs:comment"
            },
            {
                "titles": "parent_notation",
                "name": "parent_notation",
                "required": false,
                "propertyUrl": "skos:broader",
                "valueUrl": "http://data.gov.uk/codelist/standard-international-trade-classification/revision-4/{+parent_notation}"
            },
            {
                "virtual": true,
                "propertyUrl": "skos:inScheme",
                "valueUrl": "http://data.gov.uk/codelist/standard-international-trade-classification/revision-4"
            },
            {
                "virtual": true,
                "propertyUrl": "rdf:type",
                "valueUrl": "skos:Concept"
            }
        ],
        "aboutUrl": "http://data.gov.uk/codelist/standard-international-trade-classification/revision-4/{+notation}"
    }
}

Performing csv2rdf on this CSVW produces RDF like:

<http://data.gov.uk/codelist/standard-international-trade-classification/revision-4/0> a skos:Concept ;
    skos:notation "0" ;
    rdfs:label "Food and live animals" ;
    rdfs:comment "..." ;
    skos:inScheme <http://data.gov.uk/codelist/standard-international-trade-classification/revision-4> ;
    .

<http://data.gov.uk/codelist/standard-international-trade-classification/revision-4/00> a skos:Concept ;
    skos:notation "00" ;
    rdfs:label "Live animals other than animals of division 03" ;
    rdfs:comment "..." ;
    skos:broader <http://data.gov.uk/codelist/standard-international-trade-classification/revision-4/0> ;
    skos:inScheme <http://data.gov.uk/codelist/standard-international-trade-classification/revision-4> ;
    .

# etc...

A limitation of using CSVW to produce a skos:ConceptScheme is the inability to set both skos:narrower and skos:broader relationships concurrently, and to set the skos:hasTopConcept relationship. When loading a skos:ConceptScheme generated from CSVW in this way, we serialise these additional relationships using CONSTRUCT queries in SPARQL.