8000 Add a collapse command by beckyjackson · Pull Request #578 · ontodev/robot · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add a collapse command #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions docs/collapse.md
8000
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Collapse

Sometimes, a class hierarchy can contain more intermediate classes than necessary, especially when extracting modules. ROBOT includes `collapse` to remove intermediate classes based on a minimal number of subclasses, using the `--threshold` option. If `--threshold` is not provided, it will default to `2`. The threshold must be a positive integer greater than or equal to 2.

```
robot collapse \
--input module.owl \
--threshold 3 \
--output minimized_module.owl
```

Collapse will not remove root classes or leaf classes (i.e. top-level classes, without a named superclass, and bottom-level classes, without any subclasses). For each intermediate class, if it has *fewer* subclasses than the threshold, then it will be removed.

For example, given `--threshold 2`:

```
- class:A
- class:B
- class:C
- class:D
- class:E
- class:F
- class:G
- class:H
```

Becomes:

```
- class:A
- class:B
- class:E
- class:F
- class:G
- class:H
```

`class:C` and `class:D` are removed because they each only have one subclass. `class:F` is kept because it has two subclasses, which is the threshold.

If there are any classes that you don't want removed, you can keep them regardless of the number of subclasses using `--precious <IRI/CURIE>` (for a set of terms in a file, use `--precious-terms <term-file>`).

robot collapse \
--input uberon_module.owl \
--threshold 3 \
--precious UBERON:0000483 \
--output results/uberon_minimized.owl

For example, given `--threshold 2` and `--precious class:D`, that same example from above would become:

```
- class:A
- class:B
- class:D
- class:E
- class:F
- class:G
- class:H
```

---

## Error Messages

### Threshold Error

The `--threshold` input must be an integer.

### Threshold Value Error

The `--threshold` input must be an integer greater than 1.

Loading
0