@neverblink/linkml 0.15.0 → 0.16.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 +16 -13
- package/index.d.ts +27 -0
- package/main.js +79731 -66898
- package/main.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,20 +71,23 @@ const { view } = LinkML.loadFromPath("model.yaml", {
|
|
|
71
71
|
|
|
72
72
|
Load a schema into a `SchemaView` handle (see above), then pass that handle to any generator:
|
|
73
73
|
|
|
74
|
-
| Function
|
|
75
|
-
|
|
76
|
-
| `loadFromString(schema, importMap, inferMessages?)`
|
|
77
|
-
| `loadFromPath(path, importMap, inferMessages?)`
|
|
78
|
-
| `jsonSchema(view, open?, treeRootOverride?)`
|
|
79
|
-
| `shacl(view, open?, onlyClassesFromRootSchema?, format?)`
|
|
80
|
-
| `rdfs(view, onlyClassesFromRootSchema?, format?)`
|
|
81
|
-
| `linkml(view, pruningMode?, skipDerivation?, treeRoot?, outFormat?)`
|
|
82
|
-
| `scala(view, packageName)`
|
|
74
|
+
| Function | Returns | Notes |
|
|
75
|
+
|------------------------------------------------------------------------------|--------------------------|--------------------------------------------------------------------------------|
|
|
76
|
+
| `loadFromString(schema, importMap, inferMessages?)` | `LoadResult` | parse from YAML text; `{ view?, report }` |
|
|
77
|
+
| `loadFromPath(path, importMap, inferMessages?)` | `LoadResult` | parse from a path in the import map; cycle-safe for the root |
|
|
78
|
+
| `jsonSchema(view, open?, treeRootOverride?)` | `string` | JSON Schema |
|
|
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
|
+
| `linkml(view, pruningMode?, skipDerivation?, treeRoot?, outFormat?)` | `string` | derived/pruned LinkML schema |
|
|
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
|
-
| `graphQl(view, pruningMode?, treeRoot?)`
|
|
85
|
-
| `erDiagram(view, pruningMode?, treeRoot?, optionalMarker?)`
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
84
|
+
| `graphQl(view, pruningMode?, treeRoot?)` | `string` | GraphQL |
|
|
85
|
+
| `erDiagram(view, pruningMode?, treeRoot?, optionalMarker?)` | `string` | Mermaid entity relationship diagram |
|
|
86
|
+
| `ossie(view, pruningMode?, treeRoot?, outFormat?)` | `string` | Apache Ossie ontology, `yaml` (default) or `json` |
|
|
87
|
+
| `translation(view, target)` | `string` | Translation dictionary for generator outputs |
|
|
88
|
+
| `lint(view, inferMessages?)` | `object` | `SchemaValidationReport` (JSON) |
|
|
89
|
+
| `buildInfo()` | `object` | `BuildInfo` (JSON) – version and build metadata |
|
|
90
|
+
| `fromOssie(ontology, schemaId?, outFormat?)` | `string` | the LinkML schema from an Apache Ossie ontology |
|
|
88
91
|
|
|
89
92
|
See [`index.d.ts`](./index.d.ts) for full type signatures.
|
|
90
93
|
|
package/index.d.ts
CHANGED
|
@@ -121,6 +121,33 @@ export interface LinkMLApi {
|
|
|
121
121
|
*/
|
|
122
122
|
erDiagram(schema: SchemaView, pruningMode?: string, treeRoot?: string, optionalMarker?: boolean): string;
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Generate JSON dictionaries that translate the LinkML name to specific frameworks. This is useful when the framework symbols are significant and must be known, like when constructing a query that is meant to be executed against a database conformant to a LinkML schema.
|
|
126
|
+
* @param schema A [[SchemaView]] handle created with [[loadFromString]] or [[loadFromPath]].
|
|
127
|
+
* @param target Target framework to generate translations for. One of "base", "uri", "scala", or "graphql".
|
|
128
|
+
* @returns Translation dictionary for translating the linkml names to framework names.
|
|
129
|
+
*/
|
|
130
|
+
translation(schema: SchemaView, target: string): string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Generate an Apache Ossie ontology from a loaded LinkML schema. Classes become entity types, enums and named types become value types, and slots become the relationships grouped under the concept that plays their first role.
|
|
134
|
+
* @param schema A [[SchemaView]] handle created with [[loadFromString]] or [[loadFromPath]].
|
|
135
|
+
* @param pruningMode Pruning mode to use for choosing which elements become concepts. One of treeRoot|schema|skip. treeRoot - only elements reachable from the tree_root class. schema - only elements reachable from any of the classes defined in the root schema. skip - every element. Default: skip
|
|
136
|
+
* @param treeRoot Tree root class name to use instead of the schema defined tree_root. Does nothing if not in tree root pruning mode.
|
|
137
|
+
* @param outFormat Output serialization format to use. One of yaml|json. Default: yaml
|
|
138
|
+
* @returns The ontology, serialized in the specified format.
|
|
139
|
+
*/
|
|
140
|
+
ossie(schema: SchemaView, pruningMode?: string, treeRoot?: string, outFormat?: string): string;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Read an Apache Ossie ontology and produce the LinkML schema it describes. The opposite of [[ossie]]. Feed the result to [[loadFromString]] if you want to run a generator over it.
|
|
144
|
+
* @param ontology The ontology document, as YAML or JSON.
|
|
145
|
+
* @param schemaId The `id` of the schema to produce. An Ossie ontology has none of its own, so by default it is a placeholder built from the ontology's name.
|
|
146
|
+
* @param outFormat Output serialization format to use. One of yaml|json. Default: yaml
|
|
147
|
+
* @returns The LinkML schema, serialized in the specified format.
|
|
148
|
+
*/
|
|
149
|
+
fromOssie(ontology: string, schemaId?: string, outFormat?: string): string;
|
|
150
|
+
|
|
124
151
|
/**
|
|
125
152
|
* Lint a loaded LinkML schema, finding problems that may cause issues when using the model. This method returns a structured JSON that follows the validation-report.yaml model. TODO: consider typing the return value in TypeScript using a TypeScript generator. See: https://github.com/NeverBlink-OSS/linkml-scala/issues/127
|
|
126
153
|
* @param schema A [[SchemaView]] handle created with [[loadFromString]] or [[loadFromPath]].
|