Skip to content

pyld flatten

pyld flatten --help
 Usage: pyld flatten [OPTIONS] [INPUT_]                                         

 Flatten a *-LD document.                                                      

╭─ Arguments ──────────────────────────────────────────────────────────────────╮
│   input_      [INPUT_]  Path or URL. Omit to read from standard input.       │
│                         [default: None]                                      │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --ctx                                        TEXT         Context to compact │
│                                                           with.              │
│                                                           [default: None]    │
│ --output-format                              [json|yaml]  Format to output   │
│                                                           the data at.       │
│                                                           [default: json]    │
│ --base                                       TEXT         Base URL.          │
│                                                           [default: None]    │
│ --extract-all-scri…    --no-extract-all-…                 Extract all        │
│                                                           documents in YAML  │
│                                                           stream, or all     │
│                                                           scripts embedded   │
│                                                           in HTML.           │
│                                                           [default:          │
│                                                           extract-all-scrip… │
│ --expand-context                             TEXT         Context to expand  │
│                                                           with.              │
│                                                           [default: None]    │
│ --help                                                    Show this message  │
│                                                           and exit.          │
╰──────────────────────────────────────────────────────────────────────────────╯

Example

pyld flatten docs/examples/pythagorean-theorem.yamlld --output-format yaml
- '@id': _:b0
  https://math.namespace/equal:
  - '@id': _:b1
  - '@id': _:b4
- '@id': _:b1
  https://math.namespace/add:
  - '@id': _:b2
  - '@id': _:b3
- '@id': _:b2
  https://math.namespace/squared:
  - '@value': variable:a
- '@id': _:b3
  https://math.namespace/squared:
  - '@value': variable:b
- '@id': _:b4
  https://math.namespace/squared:
  - '@value': variable:c
- '@id': https://dbpedia.org/page/Pythagorean_theorem
  http://www.w3.org/ns/prov#Entity:
  - '@id': _:b0