@neverblink/linkml 0.8.7-5-25b1515-SNAPSHOT → 0.8.9
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 +9 -1
- package/index.d.ts +59 -49
- package/main.js +49599 -40325
- package/main.js.map +4 -4
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -20,9 +20,14 @@ import { LinkML } from "@neverblink/linkml";
|
|
|
20
20
|
const schema = `
|
|
21
21
|
id: https://example.org/my-schema
|
|
22
22
|
name: my-schema
|
|
23
|
+
prefixes:
|
|
24
|
+
linkml: https://w3id.org/linkml/
|
|
25
|
+
imports:
|
|
26
|
+
- linkml:types
|
|
23
27
|
default_range: string
|
|
24
28
|
classes:
|
|
25
29
|
Person:
|
|
30
|
+
tree_root: true
|
|
26
31
|
attributes:
|
|
27
32
|
name:
|
|
28
33
|
age:
|
|
@@ -40,8 +45,11 @@ console.log(jsonSchema);
|
|
|
40
45
|
| Function | Returns | Notes |
|
|
41
46
|
| --- | --- | --- |
|
|
42
47
|
| `jsonSchema(schema, importMap, open?, treeRootOverride?)` | `string` | JSON Schema |
|
|
43
|
-
| `shacl(schema, importMap, open?)` | `string` | SHACL shapes in N-Triples |
|
|
48
|
+
| `shacl(schema, importMap, open?, onlyClassesFromRootSchema?)` | `string` | SHACL shapes in N-Triples |
|
|
49
|
+
| `rdfs(schema, importMap, onlyClassesFromRootSchema?)` | `string` | RDFS in N-Triples |
|
|
50
|
+
| `linkml(schema, importMap, pruningMode?, skipDerivation?, treeRoot?, outFormat?)` | `string` | derived/pruned LinkML schema |
|
|
44
51
|
| `scala(schema, importMap, packageName)` | `Record<string, string>` | filename → generated Scala |
|
|
52
|
+
| `tableSchema(schema, importMap, treeRoot?)` | `string` | Frictionless Table Schema (JSON) |
|
|
45
53
|
| `lint(schema, importMap, maxProblems?, verbose?)` | `string` | problem summary, empty if valid |
|
|
46
54
|
|
|
47
55
|
See [`index.d.ts`](./index.d.ts) for full type signatures.
|
package/index.d.ts
CHANGED
|
@@ -1,65 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* The implementation is generated from Scala by Scala.js; this file is
|
|
5
|
-
* hand-maintained and must be kept in sync with
|
|
6
|
-
* `generator/src-js/eu/neverblink/linkml/js/LinkMlJsApi.scala`.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Mapping from imported model filename to its LinkML model source (YAML).
|
|
11
|
-
* Every `imports:` entry referenced by the main schema must have a matching
|
|
12
|
-
* entry here.
|
|
13
|
-
*/
|
|
14
|
-
export type ImportMap = Record<string, string>;
|
|
1
|
+
// AUTO-GENERATED from generator/src-js/eu/neverblink/linkml/js/LinkMlJsApi.scala.
|
|
2
|
+
// Do not edit by hand — regenerate with ./mill uiTypes (or generator.js.npmPackage).
|
|
15
3
|
|
|
16
4
|
export interface LinkMLApi {
|
|
17
5
|
/**
|
|
18
|
-
* Generate JSON Schema from the provided LinkML model
|
|
19
|
-
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @
|
|
24
|
-
|
|
6
|
+
* Generate JSON Schema from the provided LinkML model
|
|
7
|
+
* @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]].
|
|
8
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
9
|
+
* @param open Whether the JSON Schema should allow `additionalProperties` or not.
|
|
10
|
+
* @param treeRootOverride Override for the LinkML `tree_root` class which will be at the root of the JSON Schema.
|
|
11
|
+
* @returns Serialized JSON Schema
|
|
12
|
+
*/
|
|
13
|
+
jsonSchema(mainSchema: string, importMap: Record<string, string>, open?: boolean, treeRootOverride?: string): string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generate SHACL shapes (in N-Triples format) from the provided LinkML model
|
|
17
|
+
* @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]].
|
|
18
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
19
|
+
* @param open Whether the SHACL shapes should be open (`_:b sh:closed false .`, allowing additional properties).
|
|
20
|
+
* @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.
|
|
21
|
+
* @returns SHACL shapes in N-Triples format
|
|
22
|
+
*/
|
|
23
|
+
shacl(mainSchema: string, importMap: Record<string, string>, open?: boolean, onlyClassesFromRootSchema?: boolean): string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generate Scala code from the provided LinkML model. This is primarily used for the metamodel
|
|
27
|
+
* @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]].
|
|
28
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
29
|
+
* @param packageName Package to generate the classes in
|
|
30
|
+
* @returns JS dictionary (object) containing a mapping from filename to the generated Scala code.
|
|
31
|
+
*/
|
|
32
|
+
scala(mainSchema: string, importMap: Record<string, string>, packageName: string): Record<string, string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Generate RDFS from the provided LinkML model.
|
|
36
|
+
* @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]].
|
|
37
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
38
|
+
* @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.
|
|
39
|
+
* @returns JS dictionary (object) containing a mapping from filename to the generated Scala code.
|
|
25
40
|
*/
|
|
26
|
-
|
|
27
|
-
mainSchema: string,
|
|
28
|
-
importMap: ImportMap,
|
|
29
|
-
open?: boolean,
|
|
30
|
-
treeRootOverride?: string,
|
|
31
|
-
): string;
|
|
41
|
+
rdfs(mainSchema: string, importMap: Record<string, string>, onlyClassesFromRootSchema: boolean): string;
|
|
32
42
|
|
|
33
43
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
39
|
-
* @
|
|
44
|
+
* Materialize a derived LinkML schema from a LinkML model. Resolves imports, derives classes, and prunes unreachable elements.
|
|
45
|
+
* @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]].
|
|
46
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
47
|
+
* @param pruningMode Pruning mode to use for removing unused elements (classes, types, enums). One of treeRoot|schemaRoot|skip. treeRoot - remove all elements unreachable from the tree_root class. schema - remove all elements unreachable from any of the classes defined in the root schema. skip - do not remove unused elements. Default: treeRoot
|
|
48
|
+
* @param skipDerivation If true, will not derive classes and instead copy them as-is.
|
|
49
|
+
* @param treeRoot Tree root class name to use instead of the schema defined tree_root. Does nothing if not in tree root pruning mode.
|
|
50
|
+
* @param outFormat Output serialization format to use. One of yaml|json. Default: yaml
|
|
51
|
+
* @returns The derived [[SchemaDefinition]] serialized in the specified format.
|
|
40
52
|
*/
|
|
41
|
-
|
|
53
|
+
linkml(mainSchema: string, importMap: Record<string, string>, pruningMode?: string, skipDerivation?: boolean, treeRoot?: string, outFormat?: string): string;
|
|
42
54
|
|
|
43
55
|
/**
|
|
44
|
-
* Generate
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @
|
|
49
|
-
* @returns Mapping from filename to the generated Scala source.
|
|
56
|
+
* Generate a Frictionless Table Schema from a LinkML model.
|
|
57
|
+
* @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]].
|
|
58
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
59
|
+
* @param treeRoot Tree root class name to use instead of the schema defined tree_root.
|
|
60
|
+
* @returns Table Schema, serialized as a JSON
|
|
50
61
|
*/
|
|
51
|
-
|
|
62
|
+
tableSchema(mainSchema: string, importMap: Record<string, string>, treeRoot?: string): string;
|
|
52
63
|
|
|
53
64
|
/**
|
|
54
|
-
* Lint the provided LinkML model,
|
|
55
|
-
*
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @
|
|
60
|
-
* @returns The summary of detected problems, or an empty string if everything is correct.
|
|
65
|
+
* Lint the provided LinkML model, finding problems that may cause issues when using the model.
|
|
66
|
+
* @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]].
|
|
67
|
+
* @param importMap JS dictionary (object) containing a mapping from filename to LinkML models (in YAML format)
|
|
68
|
+
* @param maxProblems Maximum number of problems to include in the summary
|
|
69
|
+
* @param verbose Whether to use the more verbose problem descriptions
|
|
70
|
+
* @returns The summary of detected problems, or an empty string if everything is correct
|
|
61
71
|
*/
|
|
62
|
-
lint(mainSchema: string, importMap:
|
|
72
|
+
lint(mainSchema: string, importMap: Record<string, string>, maxProblems?: number, verbose?: boolean): string;
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
export declare const LinkML: LinkMLApi;
|