Frictionless
Generate a Frictionless Data Package. Every class becomes a CSV table, described by its own Table Schema, and references between classes become foreign keys between the tables. The files are a datapackage.json plus one schemas/<table>.json per table.
ohi get w3c/prov-oohi linkml to frictionless --pruning-mode schema \ --to datapackage/ prov-o.linkml.yamlimport ohi_linkml
with ohi_linkml.load_file("prov-o.linkml.yaml") as schema: files = schema.frictionless(pruning_mode="schema")import { readFileSync } from "node:fs";import { LinkML } from "@neverblink/linkml";
const yaml = readFileSync("prov-o.linkml.yaml", "utf8");const { view, report } = LinkML.loadFromString(yaml, {});if (!view) throw new Error(JSON.stringify(report));const files = view.frictionless({ pruning_mode: "schema" });import eu.neverblink.linkml.generator.options.*import eu.neverblink.linkml.generator.frictionless.FrictionlessGeneratorimport eu.neverblink.linkml.schemaview.{SchemaIssues, SchemaView}
val loaded = SchemaView.loadSchemaViewFromUri("prov-o.linkml.yaml")given SchemaView = SchemaIssues.orThrow(loaded)val files = FrictionlessGenerator().generateFiles( FrictionlessGeneratorOptions(pruningMode = PruningMode.Schema),)#include <stddef.h>#include "ohi_linkml.h"
linkml_init_threads();char *report = NULL, *error = NULL;long long schema = linkml_load_file("prov-o.linkml.yaml", NULL, &report, &error);char *files = linkml_frictionless( schema, "{\"pruning_mode\": \"schema\"}", &error);linkml_free(files);linkml_free(report);linkml_free(error);linkml_close(schema);Options
Section titled “Options”metadata_languagestringdefault enCLI
--metadata-languageScala metadataLanguageThe language of the titles and descriptions in the output, for schemas with text in more than one language.
pruning_modePruningModedefault skipCLI
--pruning-modeScala pruningModeWhich classes become tables.
tree_rootThe elements reachable from the tree root class. Without a tree root, the same asschema.schemaEverything defined in the root schema, and every element reachable from it. This leaves out the unused parts of imported schemas, such as most oflinkml:types.skipEvery element of the root schema and of all its imports.
skip_classes_without_identifierbooleandefault falseCLI
--skip-classes-without-identifierScala skipClassesWithoutIdentifierWhether to skip the classes with no identifier slot. The table of such a class has no primary key, and so no references from other tables.
tree_rootstringCLI
--tree-rootScala treeRootThe class to use as the tree root, instead of the class with tree_root: true in the schema. Only for the tree_root pruning mode.