Skip to content

Commit

Permalink
Add documentation for overrides (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimvh committed Aug 4, 2022
1 parent 830088d commit 28273b3
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
59 changes: 59 additions & 0 deletions docs/configuration/configurations/overrides.md
@@ -0,0 +1,59 @@
Overrides can be used to update the values found in the configuration.

This can be useful if you import a configuration in which you want to make minor changes
but don't want to edit the original configuration.

## Types

| JSON-LD Shortcut | URI | Description |
|------------------|-------------|-----------------------------------------------------|
| Override | oo:Override | Resources of this `@type` are considered Overrides. |

## Predicates

These are the predicates

| JSON-LD Shortcut | URI | Description |
|--------------------|-----------------------|------------------------------------------------------------------|
| overrideInstance | oo:overrideInstance | Targets the identifier of the instance that needs to be updated. |
| overrideParameters | oo:overrideParameters | Contains the values that need to be updated. |

## Example: single override

The example below will make it so that `ex:myHelloWorldWithOverride` will be instantiated with the value `"HELLO"`
for its `hello:say` parameter and `"BETTER WORLD"` for its `hello:hello` parameter,
independent of what value is specified in the `ex:myHelloWorldWithOverride` instantiation.

```json
{
"@id": "ex:myObjectOverride",
"@type": "Override",
"overrideInstance": { "@id": "ex:myHelloWorldWithOverride" },
"overrideParameters": {
"hello:say": "HELLO",
"hello:hello": "BETTER WORLD"
}
}
```

## Example: linked overrides

This is a continuation of the previous example.
In case an Override targets another Override,
Components.js will apply its parameters to the final instantiation,
which is `ex:myHelloWorldWithOverride` in this example.

The newer Override has priority, which means that in this case the `hello:hello` parameter
will get the `"EVEN BETTER WORLD"` value.
Parameters that are not referenced, remain unchanged, so `hello:say` will still get the `"HELLO"` value.

```json
{
"@id": "ex:myObjectOverride2",
"@type": "Override",
"overrideInstance": { "@id": "ex:myObjectOverride" },
"overrideParameters": {
"hello:hello": "EVEN BETTER WORLD"
}
}
```
1 change: 1 addition & 0 deletions mkdocs.yml
Expand Up @@ -25,6 +25,7 @@ pages:
- Semantic: 'configuration/configurations/semantic.md'
- Non-Semantic: 'configuration/configurations/nonsemantic.md'
- Variables: 'configuration/configurations/variables.md'
- Overrides: 'configuration/configurations/overrides.md'
- Loading:
- ComponentsManager: 'loading/manager.md'
- Registration: 'loading/registration.md'
Expand Down

0 comments on commit 28273b3

Please sign in to comment.