### 8.5.10. Categorize

This section describes a procedure that replaces string property values on nodes with relationship to a unique category node for that property value.

The available procedure is described in the table below:

`CALL apoc.refactor.categorize(sourceKey, type, outgoing, label, targetKey, copiedKeys, batchSize)` | turn each unique propertyKey into a category node and connect to it

#### 8.5.10.1. Example Usage

The example below will help us learn how to use this procedure.

The following creates nodes with a `favoriteColor` property:

    CREATE (:Person {name: "Mark", favoriteColor: "Red"})
    CREATE (:Person {name: "Jennifer", favoriteColor: "Blue"})
    CREATE (:Person {name: "David", favoriteColor: "Red"})

The following turn all `favoriteColor` properties into `FAVORITE_COLOR` relationships to `Color` nodes with a matching `color` property.

    CALL apoc.refactor.categorize('favoriteColor', 'FAVORITE_COLOR', true, 'Color', 'color', [], 100)

If we execute this query, it will result in the following graph: