renku graph

Renku CLI commands for handling of Knowledge Graph data.

Description

Export part or all of the Renku Knowledge Graph metadata for the current project.

By default, this will export the metadata created in the last commit in the project. If that commit was not a renku command that creates metadata, it will produce no output.

Commands and options

renku graph

Graph commands.

renku graph [OPTIONS] COMMAND [ARGS]...

export

Export Renku graph metadata for project.

renku graph export [OPTIONS]

Options

--format <format>

Choose an output format.

Options:

jsonld | json-ld | nt | rdf | dot | dot-landscape | dot-debug

--revision <revision>

Limit graph to changes done in revision (or range of revisions like ‘A..B’).

-f, --full

Generate full graph for project (default). Overrides –revision.

--strict

Validate triples before output.

--no-indent

Format without indentation/pretty-printing (only for JSON-LD).

Examples

Here we create a new dataset and then use renku graph export to export the created metadata as JSON-LD, the default format.

$ renku dataset create my-dataset
OK
$ renku graph export
 [
     {
         "@id": "https://localhost/datasets/850e74d6c0204e8c923457a1b9ce52d8",
         "@type": [
         "http://schema.org/Dataset",
         "http://www.w3.org/ns/prov#Entity"
         ],

         [... many more lines ...]

     }
 ]

If you want the Knowledge Graph data for the whole project, you can use renku graph export --full (--full is the default). Alternatively, you can get data for a single commit by using renku graph export --revision <git commit sha> or by specifying a range of commits like renku graph export --revision sha1..sha2.

renku graph export currently supports various formats for export, such as json-ld, rdf, nt (for triples) and dot (for GraphViz graphs), which can be specified using the --format option. For instance,

$ renku graph export --full --format dot | dot -Tpng -o my_graph.png

would produce a PNG image of the whole Knowledge Graph for the project.

To run validation on the generated output, you can pass the --strict option, which will check that all the nodes and properties in the graph are correct and that there isn’t anything missing.