@neverblink/linkml 0.13.1 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/index.d.ts +21 -11
- package/main.js +49645 -43985
- package/main.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,13 +76,15 @@ Load a schema into a `SchemaView` handle (see above), then pass that handle to a
|
|
|
76
76
|
| `loadFromString(schema, importMap, inferMessages?)` | `LoadResult` | parse from YAML text; `{ view?, report }` |
|
|
77
77
|
| `loadFromPath(path, importMap, inferMessages?)` | `LoadResult` | parse from a path in the import map; cycle-safe for the root |
|
|
78
78
|
| `jsonSchema(view, open?, treeRootOverride?)` | `string` | JSON Schema |
|
|
79
|
-
| `shacl(view, open?, onlyClassesFromRootSchema?)`
|
|
80
|
-
| `rdfs(view, onlyClassesFromRootSchema?)`
|
|
79
|
+
| `shacl(view, open?, onlyClassesFromRootSchema?, format?)` | `string` | SHACL shapes, `ttl` (default) or `nt` |
|
|
80
|
+
| `rdfs(view, onlyClassesFromRootSchema?, format?)` | `string` | RDFS, `ttl` (default) or `nt` |
|
|
81
81
|
| `linkml(view, pruningMode?, skipDerivation?, treeRoot?, outFormat?)` | `string` | derived/pruned LinkML schema |
|
|
82
82
|
| `scala(view, packageName)` | `Record<string, string>` | filename → generated Scala |
|
|
83
|
-
| `
|
|
83
|
+
| `frictionless(view, pruningMode?, treeRoot?, skipClassesWithoutIdentifier?)` | `Record<string, string>` | filename → Frictionless data package (`datapackage.json` and `schemas/*.json`) |
|
|
84
84
|
| `graphQl(view, pruningMode?, treeRoot?)` | `string` | GraphQL |
|
|
85
|
+
| `erDiagram(view, pruningMode?, treeRoot?, optionalMarker?)` | `string` | Mermaid entity relationship diagram |
|
|
85
86
|
| `lint(view, inferMessages?)` | `object` | `SchemaValidationReport` (JSON) |
|
|
87
|
+
| `buildInfo()` | `object` | `BuildInfo` (JSON) – version and build metadata |
|
|
86
88
|
|
|
87
89
|
See [`index.d.ts`](./index.d.ts) for full type signatures.
|
|
88
90
|
|
package/index.d.ts
CHANGED
|
@@ -22,7 +22,13 @@ export interface LoadResult {
|
|
|
22
22
|
|
|
23
23
|
export interface LinkMLApi {
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Version and build metadata of this copy of LinkML-Scala: which version it is, which LinkML metamodel it was built against, and what it is running on. Useful in bug reports, and for checking that the version you loaded is the one you meant to.
|
|
26
|
+
* @returns A `BuildInfo` object, as described by https://linkml.neverblink.eu/model/build-info
|
|
27
|
+
*/
|
|
28
|
+
buildInfo(): any;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Load and resolve a LinkML schema into a reusable [[SchemaView]] handle, starting from the schema's YAML text. The main schema is parsed directly from `mainSchema`, so it has no path of its own. If one of its imports (transitively) imports the main schema back by filename, that import cannot be matched against the root and the main schema will be loaded a second time. Use [[loadFromPath]] instead when the root schema takes part in an import cycle. See [[loadFromPath]] for the correct key format.
|
|
26
32
|
* @param mainSchema Main LinkML model in YAML format. It may import other models using LinkML `imports`, but all imports must be made available in the [[importMap]].
|
|
27
33
|
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
28
34
|
* @param inferMessages Whether to fill in each issue's human-readable `message` and `details`.
|
|
@@ -31,7 +37,7 @@ export interface LinkMLApi {
|
|
|
31
37
|
loadFromString(mainSchema: string, importMap: Record<string, string>, inferMessages?: boolean): LoadResult;
|
|
32
38
|
|
|
33
39
|
/**
|
|
34
|
-
* Load and resolve a LinkML schema into a reusable [[SchemaView]] handle, starting from a path into the [[importMap]]. Unlike [[loadFromString]], the main schema is read through the import map by its own path, so it is tracked from the start of import resolution. This makes it immune to cyclic imports involving the root schema: an import that (transitively) references the root back by path resolves to the already-loaded root instead of loading it again.
|
|
40
|
+
* Load and resolve a LinkML schema into a reusable [[SchemaView]] handle, starting from a path into the [[importMap]]. Unlike [[loadFromString]], the main schema is read through the import map by its own path, so it is tracked from the start of import resolution. This makes it immune to cyclic imports involving the root schema: an import that (transitively) references the root back by path resolves to the already-loaded root instead of loading it again. Keys in the ``imports`` parameter must match the expanded form of the ``imports`` entries in the schema. In particular: - A CURIE is expanded through the schema's prefix map, so ``imports: [ex:core]`` has to be keyed here by the full URI, such as ``"https://example.org/core.yaml"``. - A relative import is joined to the directory of the schema that imported it, so a ``core`` imported by ``nested/model.yaml`` has to be keyed ``"nested/core.yaml"``. Keys are therefore paths as seen from the root. - ``.yaml`` is appended unless the path already ends in ``.yaml`` or ``.yml``. Therefore, ``"core"`` and ``"core.yaml"`` are interchangeable, and a key that ends in ``.yml`` is only found by an import that explicitly asks for ``.yml``.
|
|
35
41
|
* @param path Path of the main LinkML model within the [[importMap]] (e.g. `"model.yaml"`).
|
|
36
42
|
* @param importMap JS dictionary (object) containing a mapping from path to LinkML models (in YAML format), including the main schema itself under [[path]].
|
|
37
43
|
* @param inferMessages Whether to fill in each issue's human-readable `message` and `details`.
|
|
@@ -49,13 +55,14 @@ export interface LinkMLApi {
|
|
|
49
55
|
jsonSchema(schema: SchemaView, open?: boolean, treeRootOverride?: string): string;
|
|
50
56
|
|
|
51
57
|
/**
|
|
52
|
-
* Generate SHACL shapes
|
|
58
|
+
* Generate SHACL shapes from a loaded LinkML schema.
|
|
53
59
|
* @param schema A [[SchemaView]] handle created with [[loadFromString]] or [[loadFromPath]].
|
|
54
60
|
* @param open Whether the SHACL shapes should be open (`_:b sh:closed false .`, allowing additional properties).
|
|
55
61
|
* @param onlyClassesFromRootSchema Whether to include only classes from the root schema (turned off by default). This is useful if you intend to generate SHACL shapes for each schema file separately, and you don't need the imported classes to be included in the generated SHACL shapes.
|
|
56
|
-
* @
|
|
62
|
+
* @param format RDF serialization format: `ttl` for Turtle (the default), which is prefixed and pretty-printed, or `nt` for N-Triples.
|
|
63
|
+
* @returns SHACL shapes in the requested format
|
|
57
64
|
*/
|
|
58
|
-
shacl(schema: SchemaView, open?: boolean, onlyClassesFromRootSchema?: boolean): string;
|
|
65
|
+
shacl(schema: SchemaView, open?: boolean, onlyClassesFromRootSchema?: boolean, format?: string): string;
|
|
59
66
|
|
|
60
67
|
/**
|
|
61
68
|
* Generate Scala code from a loaded LinkML schema. This is primarily used for the metamodel
|
|
@@ -69,9 +76,10 @@ export interface LinkMLApi {
|
|
|
69
76
|
* Generate RDFS from a loaded LinkML schema.
|
|
70
77
|
* @param schema A [[SchemaView]] handle created with [[loadFromString]] or [[loadFromPath]].
|
|
71
78
|
* @param onlyClassesFromRootSchema Whether to include only classes from the root schema (turned off by default). This is useful if you intend to generate SHACL shapes for each schema file separately, and you don't need the imported classes to be included in the generated SHACL shapes.
|
|
72
|
-
* @
|
|
79
|
+
* @param format RDF serialization format: `ttl` for Turtle (the default), which is prefixed and pretty-printed, or `nt` for N-Triples.
|
|
80
|
+
* @returns RDFS in the requested format
|
|
73
81
|
*/
|
|
74
|
-
rdfs(schema: SchemaView, onlyClassesFromRootSchema?: boolean): string;
|
|
82
|
+
rdfs(schema: SchemaView, onlyClassesFromRootSchema?: boolean, format?: string): string;
|
|
75
83
|
|
|
76
84
|
/**
|
|
77
85
|
* Materialize a derived LinkML schema from a loaded LinkML schema. Derives classes and prunes unreachable elements.
|
|
@@ -85,12 +93,14 @@ export interface LinkMLApi {
|
|
|
85
93
|
linkml(schema: SchemaView, pruningMode?: string, skipDerivation?: boolean, treeRoot?: string, outFormat?: string): string;
|
|
86
94
|
|
|
87
95
|
/**
|
|
88
|
-
* Generate a Frictionless
|
|
96
|
+
* Generate a Frictionless Data Package from a loaded LinkML schema. Every class becomes a CSV table, described by its own Table Schema, and references between classes become foreign keys between the tables.
|
|
89
97
|
* @param schema A [[SchemaView]] handle created with [[loadFromString]] or [[loadFromPath]].
|
|
90
|
-
* @param treeRoot
|
|
91
|
-
* @
|
|
98
|
+
* @param pruningMode Pruning mode to use for choosing which classes become tables. One of treeRoot|schema|skip. treeRoot - only classes reachable from the tree_root class. schema - only classes reachable from any of the classes defined in the root schema. skip - every class. Default: skip
|
|
99
|
+
* @param treeRoot Tree root class name to use instead of the schema defined tree_root. Does nothing if not in tree root pruning mode.
|
|
100
|
+
* @param skipClassesWithoutIdentifier Whether to skip classes that have no identifier slot. Such a table gets no primary key and nothing can reference it, so it is often not useful. Default: false
|
|
101
|
+
* @returns JS dictionary (object) containing a mapping from filename to file content: a `datapackage.json` plus one `schemas/<table>.json` per table.
|
|
92
102
|
*/
|
|
93
|
-
|
|
103
|
+
frictionless(schema: SchemaView, pruningMode?: string, treeRoot?: string, skipClassesWithoutIdentifier?: boolean): Record<string, string>;
|
|
94
104
|
|
|
95
105
|
/**
|
|
96
106
|
* Generate a GraphQL Schema from a loaded LinkML schema. Only types/interfaces/scalar/enums, queries must be provided for a specific implementation.
|