@google-cloud/kcmd 0.0.0-stage → 0.2.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/LICENSE +203 -0
- package/README.md +264 -2
- package/build/ts/kcmd/cli.js +20252 -0
- package/build/ts/kcmd/gcp/alloydb.d.ts +12 -0
- package/build/ts/kcmd/gcp/alloydb.js +70 -0
- package/build/ts/kcmd/gcp/api.d.ts +29 -0
- package/build/ts/kcmd/gcp/api.js +162 -0
- package/build/ts/kcmd/gcp/biglake.d.ts +18 -0
- package/build/ts/kcmd/gcp/biglake.js +59 -0
- package/build/ts/kcmd/gcp/bigquery.d.ts +57 -0
- package/build/ts/kcmd/gcp/bigquery.js +134 -0
- package/build/ts/kcmd/gcp/context.d.ts +10 -0
- package/build/ts/kcmd/gcp/context.js +74 -0
- package/build/ts/kcmd/gcp/crm.d.ts +13 -0
- package/build/ts/kcmd/gcp/crm.js +91 -0
- package/build/ts/kcmd/gcp/dataplex.d.ts +147 -0
- package/build/ts/kcmd/gcp/dataplex.js +406 -0
- package/build/ts/kcmd/gcp/index.d.ts +3 -0
- package/build/ts/kcmd/gcp/index.js +21 -0
- package/build/ts/kcmd/gcp/spanner.d.ts +73 -0
- package/build/ts/kcmd/gcp/spanner.js +126 -0
- package/build/ts/kcmd/index.d.ts +7 -0
- package/build/ts/kcmd/index.js +46 -0
- package/build/ts/kcmd/layout.d.ts +16 -0
- package/build/ts/kcmd/layout.js +31 -0
- package/build/ts/kcmd/layouts/documents.d.ts +24 -0
- package/build/ts/kcmd/layouts/documents.js +264 -0
- package/build/ts/kcmd/layouts/okf.d.ts +31 -0
- package/build/ts/kcmd/layouts/okf.js +386 -0
- package/build/ts/kcmd/layouts/semantic-model.d.ts +74 -0
- package/build/ts/kcmd/layouts/semantic-model.js +621 -0
- package/build/ts/kcmd/layouts/standard.d.ts +13 -0
- package/build/ts/kcmd/layouts/standard.js +108 -0
- package/build/ts/kcmd/manifest.d.ts +34 -0
- package/build/ts/kcmd/manifest.js +262 -0
- package/build/ts/kcmd/metadata.d.ts +25 -0
- package/build/ts/kcmd/metadata.js +8 -0
- package/build/ts/kcmd/okf/catalog_residue.d.ts +14 -0
- package/build/ts/kcmd/okf/catalog_residue.js +124 -0
- package/build/ts/kcmd/okf/concept.d.ts +14 -0
- package/build/ts/kcmd/okf/concept.js +110 -0
- package/build/ts/kcmd/okf/concept_to_entry.d.ts +10 -0
- package/build/ts/kcmd/okf/concept_to_entry.js +281 -0
- package/build/ts/kcmd/okf/init_okf_workspace.d.ts +15 -0
- package/build/ts/kcmd/okf/init_okf_workspace.js +113 -0
- package/build/ts/kcmd/okf/links.d.ts +23 -0
- package/build/ts/kcmd/okf/links.js +468 -0
- package/build/ts/kcmd/okf/okf_metadata.d.ts +12 -0
- package/build/ts/kcmd/okf/okf_metadata.js +99 -0
- package/build/ts/kcmd/semantic/bigquery.d.ts +22 -0
- package/build/ts/kcmd/semantic/bigquery.js +469 -0
- package/build/ts/kcmd/semantic/binding.d.ts +3 -0
- package/build/ts/kcmd/semantic/binding.js +92 -0
- package/build/ts/kcmd/semantic/catalog_entry.d.ts +24 -0
- package/build/ts/kcmd/semantic/catalog_entry.js +35 -0
- package/build/ts/kcmd/semantic/converters/owl/convert.d.ts +26 -0
- package/build/ts/kcmd/semantic/converters/owl/convert.js +41 -0
- package/build/ts/kcmd/semantic/converters/owl/model.d.ts +98 -0
- package/build/ts/kcmd/semantic/converters/owl/model.js +30 -0
- package/build/ts/kcmd/semantic/converters/owl/parse.d.ts +11 -0
- package/build/ts/kcmd/semantic/converters/owl/parse.js +634 -0
- package/build/ts/kcmd/semantic/converters/owl/to_ir.d.ts +19 -0
- package/build/ts/kcmd/semantic/converters/owl/to_ir.js +390 -0
- package/build/ts/kcmd/semantic/deploy_bigquery.d.ts +20 -0
- package/build/ts/kcmd/semantic/deploy_bigquery.js +226 -0
- package/build/ts/kcmd/semantic/deploy_knowledge_catalog.d.ts +104 -0
- package/build/ts/kcmd/semantic/deploy_knowledge_catalog.js +1367 -0
- package/build/ts/kcmd/semantic/deploy_spanner.d.ts +15 -0
- package/build/ts/kcmd/semantic/deploy_spanner.js +150 -0
- package/build/ts/kcmd/semantic/deployment_target.d.ts +93 -0
- package/build/ts/kcmd/semantic/deployment_target.js +379 -0
- package/build/ts/kcmd/semantic/graph_ddl.d.ts +44 -0
- package/build/ts/kcmd/semantic/graph_ddl.js +656 -0
- package/build/ts/kcmd/semantic/import_model.d.ts +72 -0
- package/build/ts/kcmd/semantic/import_model.js +1698 -0
- package/build/ts/kcmd/semantic/ir.d.ts +589 -0
- package/build/ts/kcmd/semantic/ir.js +247 -0
- package/build/ts/kcmd/semantic/kc_actions.d.ts +45 -0
- package/build/ts/kcmd/semantic/kc_actions.js +531 -0
- package/build/ts/kcmd/semantic/kc_constraints.d.ts +44 -0
- package/build/ts/kcmd/semantic/kc_constraints.js +279 -0
- package/build/ts/kcmd/semantic/kc_converter.d.ts +37 -0
- package/build/ts/kcmd/semantic/kc_converter.js +839 -0
- package/build/ts/kcmd/semantic/kc_custom_types.d.ts +63 -0
- package/build/ts/kcmd/semantic/kc_custom_types.js +751 -0
- package/build/ts/kcmd/semantic/kc_entries.d.ts +155 -0
- package/build/ts/kcmd/semantic/kc_entries.js +284 -0
- package/build/ts/kcmd/semantic/kc_ids.d.ts +102 -0
- package/build/ts/kcmd/semantic/kc_ids.js +188 -0
- package/build/ts/kcmd/semantic/knowledge_catalog.d.ts +29 -0
- package/build/ts/kcmd/semantic/knowledge_catalog.js +960 -0
- package/build/ts/kcmd/semantic/loader.d.ts +258 -0
- package/build/ts/kcmd/semantic/loader.js +3576 -0
- package/build/ts/kcmd/semantic/names.d.ts +10 -0
- package/build/ts/kcmd/semantic/names.js +85 -0
- package/build/ts/kcmd/semantic/osi_converter.d.ts +60 -0
- package/build/ts/kcmd/semantic/osi_converter.js +910 -0
- package/build/ts/kcmd/semantic/parameters.d.ts +19 -0
- package/build/ts/kcmd/semantic/parameters.js +171 -0
- package/build/ts/kcmd/semantic/pull_kc.d.ts +10 -0
- package/build/ts/kcmd/semantic/pull_kc.js +272 -0
- package/build/ts/kcmd/semantic/resolve_inheritance.d.ts +59 -0
- package/build/ts/kcmd/semantic/resolve_inheritance.js +346 -0
- package/build/ts/kcmd/semantic/resolve_profiles.d.ts +291 -0
- package/build/ts/kcmd/semantic/resolve_profiles.js +2003 -0
- package/build/ts/kcmd/semantic/runtime/agent_tools.d.ts +93 -0
- package/build/ts/kcmd/semantic/runtime/agent_tools.js +243 -0
- package/build/ts/kcmd/semantic/runtime/dialect.d.ts +13 -0
- package/build/ts/kcmd/semantic/runtime/dialect.js +39 -0
- package/build/ts/kcmd/semantic/runtime/runtime.d.ts +88 -0
- package/build/ts/kcmd/semantic/runtime/runtime.js +301 -0
- package/build/ts/kcmd/semantic/runtime/store.d.ts +112 -0
- package/build/ts/kcmd/semantic/runtime/store.js +344 -0
- package/build/ts/kcmd/semantic/skills.d.ts +110 -0
- package/build/ts/kcmd/semantic/skills.js +697 -0
- package/build/ts/kcmd/semantic/source_dialect.d.ts +17 -0
- package/build/ts/kcmd/semantic/source_dialect.js +311 -0
- package/build/ts/kcmd/semantic/source_entries.d.ts +12 -0
- package/build/ts/kcmd/semantic/source_entries.js +341 -0
- package/build/ts/kcmd/semantic/spanner.d.ts +18 -0
- package/build/ts/kcmd/semantic/spanner.js +60 -0
- package/build/ts/kcmd/semantic/sql_expr_utils.d.ts +23 -0
- package/build/ts/kcmd/semantic/sql_expr_utils.js +394 -0
- package/build/ts/kcmd/semantic/sql_identifiers.d.ts +6 -0
- package/build/ts/kcmd/semantic/sql_identifiers.js +267 -0
- package/build/ts/kcmd/semantic/sql_parser.d.ts +47 -0
- package/build/ts/kcmd/semantic/sql_parser.js +400 -0
- package/build/ts/kcmd/semantic/transpile.d.ts +76 -0
- package/build/ts/kcmd/semantic/transpile.js +581 -0
- package/build/ts/kcmd/semantic/validate.d.ts +70 -0
- package/build/ts/kcmd/semantic/validate.js +2266 -0
- package/build/ts/kcmd/semantic/yaml_options.d.ts +6 -0
- package/build/ts/kcmd/semantic/yaml_options.js +58 -0
- package/build/ts/kcmd/semantic/yaml_update.d.ts +26 -0
- package/build/ts/kcmd/semantic/yaml_update.js +782 -0
- package/build/ts/kcmd/snapshot.d.ts +37 -0
- package/build/ts/kcmd/snapshot.js +386 -0
- package/build/ts/kcmd/source.d.ts +31 -0
- package/build/ts/kcmd/source.js +119 -0
- package/build/ts/kcmd/sources/bq-dataset.d.ts +17 -0
- package/build/ts/kcmd/sources/bq-dataset.js +131 -0
- package/build/ts/kcmd/sources/entrygroup.d.ts +21 -0
- package/build/ts/kcmd/sources/entrygroup.js +83 -0
- package/build/ts/kcmd/sources/kb.d.ts +21 -0
- package/build/ts/kcmd/sources/kb.js +82 -0
- package/build/ts/kcmd/sources/semantic-model.d.ts +18 -0
- package/build/ts/kcmd/sources/semantic-model.js +48 -0
- package/build/ts/kcmd/sync.d.ts +35 -0
- package/build/ts/kcmd/sync.js +734 -0
- package/package.json +62 -4
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// OWL -> OSI conversion orchestrator.
|
|
3
|
+
//
|
|
4
|
+
// The public entry point of the OWL converter: it wires the three steps --
|
|
5
|
+
// parse Turtle (parse.ts) -> map to the IR (to_ir.ts) -> serialize to OSI YAML
|
|
6
|
+
// (../../osi_converter, reused unchanged) -- and returns the YAML plus a small
|
|
7
|
+
// summary the CLI reports. It adds no mapping policy of its own.
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.convertOwlToOsi = convertOwlToOsi;
|
|
10
|
+
const osi_converter_1 = require("../../osi_converter");
|
|
11
|
+
const parse_1 = require("./parse");
|
|
12
|
+
const to_ir_1 = require("./to_ir");
|
|
13
|
+
/**
|
|
14
|
+
* Converts a Turtle (.ttl) OWL ontology to an OSI YAML document.
|
|
15
|
+
*
|
|
16
|
+
* `modelName` names the resulting semantic model (the CLI derives it from the
|
|
17
|
+
* source filename). The output is a purely LOGICAL model -- see to_ir.ts and
|
|
18
|
+
* the user guide -- with no physical binding; it loads and pushes to Knowledge
|
|
19
|
+
* Catalog as-is, and a graph deploy adds bindings on top.
|
|
20
|
+
*
|
|
21
|
+
* `opts.compactFlow` emits the compact flow YAML layout (the `owl import
|
|
22
|
+
* --compact` flag) instead of the default block layout; both parse identically.
|
|
23
|
+
*
|
|
24
|
+
* Throws only on malformed Turtle (the parser's error); mapping gaps are
|
|
25
|
+
* reported as warnings, not failures.
|
|
26
|
+
*/
|
|
27
|
+
function convertOwlToOsi(turtle, modelName, opts = {}) {
|
|
28
|
+
const owl = (0, parse_1.parseOwl)(turtle);
|
|
29
|
+
const { model, warnings: mapWarnings, stats } = (0, to_ir_1.owlToIr)(owl, modelName);
|
|
30
|
+
// An OWL import is always logical (no source/expression), so tell the
|
|
31
|
+
// serializer not to warn about the missing physical binding. `compactFlow`
|
|
32
|
+
// is opt-in (the `owl import --compact` flag): it emits the compact flow
|
|
33
|
+
// layout the semantic-model guides use so the shown output is reproducible;
|
|
34
|
+
// the default is the standard block layout.
|
|
35
|
+
const { yaml, warnings: serializeWarnings } = (0, osi_converter_1.serializeModel)(model, { logical: true, compactFlow: opts.compactFlow });
|
|
36
|
+
return {
|
|
37
|
+
yaml,
|
|
38
|
+
stats,
|
|
39
|
+
warnings: [...mapWarnings, ...serializeWarnings],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-term annotations parsed from any class or property -- links to
|
|
3
|
+
* related/defining resources and lifecycle metadata. None has a native OSI
|
|
4
|
+
* home, and the importer is import-only, so none is carried into the model:
|
|
5
|
+
* they are dropped (the earlier custom-extension carriage was removed). Shared
|
|
6
|
+
* by OwlClass, OwlDatatypeProperty, and OwlObjectProperty.
|
|
7
|
+
*/
|
|
8
|
+
export interface OwlCommonAnnotations {
|
|
9
|
+
seeAlso: string[];
|
|
10
|
+
isDefinedBy: string[];
|
|
11
|
+
deprecated: boolean;
|
|
12
|
+
versionInfo?: string;
|
|
13
|
+
}
|
|
14
|
+
/** An `owl:Class` -- becomes an OSI dataset (entity). */
|
|
15
|
+
export interface OwlClass extends OwlCommonAnnotations {
|
|
16
|
+
localName: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
comment?: string;
|
|
19
|
+
synonyms: string[];
|
|
20
|
+
examples: string[];
|
|
21
|
+
keys: string[];
|
|
22
|
+
subClassOf: string[];
|
|
23
|
+
equivalentClass: string[];
|
|
24
|
+
disjointWith: string[];
|
|
25
|
+
oneOf: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* An `owl:DatatypeProperty` -- becomes a field on its domain class's dataset.
|
|
29
|
+
*/
|
|
30
|
+
export interface OwlDatatypeProperty extends OwlCommonAnnotations {
|
|
31
|
+
localName: string;
|
|
32
|
+
domains: string[];
|
|
33
|
+
rangeIri?: string;
|
|
34
|
+
label?: string;
|
|
35
|
+
comment?: string;
|
|
36
|
+
synonyms: string[];
|
|
37
|
+
examples: string[];
|
|
38
|
+
inverseFunctional: boolean;
|
|
39
|
+
functional: boolean;
|
|
40
|
+
subPropertyOf: string[];
|
|
41
|
+
equivalentProperty: string[];
|
|
42
|
+
propertyDisjointWith: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An `owl:ObjectProperty` -- becomes a relationship (edge) between two
|
|
46
|
+
* classes.
|
|
47
|
+
*/
|
|
48
|
+
export interface OwlObjectProperty extends OwlCommonAnnotations {
|
|
49
|
+
localName: string;
|
|
50
|
+
domains: string[];
|
|
51
|
+
ranges: string[];
|
|
52
|
+
label?: string;
|
|
53
|
+
comment?: string;
|
|
54
|
+
synonyms: string[];
|
|
55
|
+
examples: string[];
|
|
56
|
+
subPropertyOf: string[];
|
|
57
|
+
inverseOf: string[];
|
|
58
|
+
equivalentProperty: string[];
|
|
59
|
+
propertyDisjointWith: string[];
|
|
60
|
+
propertyChain: string[][];
|
|
61
|
+
symmetric: boolean;
|
|
62
|
+
transitive: boolean;
|
|
63
|
+
functional: boolean;
|
|
64
|
+
reflexive: boolean;
|
|
65
|
+
irreflexive: boolean;
|
|
66
|
+
asymmetric: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The ontology header (an `owl:Ontology` node) -- becomes model-level metadata.
|
|
70
|
+
*
|
|
71
|
+
* A description (rdfs:comment / skos:definition / dcterms:/dc:description) ->
|
|
72
|
+
* the model `description`; labels -> `ai_context.synonyms`; skos:example ->
|
|
73
|
+
* `ai_context.examples`; owl:versionInfo -> appended to the description as
|
|
74
|
+
* provenance.
|
|
75
|
+
*/
|
|
76
|
+
export interface OwlOntology {
|
|
77
|
+
comment?: string;
|
|
78
|
+
synonyms: string[];
|
|
79
|
+
examples: string[];
|
|
80
|
+
version?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A parsed OWL ontology, in declaration order.
|
|
84
|
+
*
|
|
85
|
+
* Order is preserved from the source document so the generated OSI (and its
|
|
86
|
+
* golden) is stable: entities appear in class-declaration order and each
|
|
87
|
+
* entity's fields in datatype-property-declaration order.
|
|
88
|
+
*/
|
|
89
|
+
export interface OwlModel {
|
|
90
|
+
baseIri?: string;
|
|
91
|
+
ontology?: OwlOntology;
|
|
92
|
+
classes: OwlClass[];
|
|
93
|
+
datatypeProperties: OwlDatatypeProperty[];
|
|
94
|
+
objectProperties: OwlObjectProperty[];
|
|
95
|
+
allDisjointClasses: string[][];
|
|
96
|
+
allDisjointProperties: string[][];
|
|
97
|
+
allDifferent: string[][];
|
|
98
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The OWL intermediate model: a thin, parser-facing view of an ontology.
|
|
3
|
+
//
|
|
4
|
+
// This is deliberately NOT the semantic-model IR (see ../../ir.ts). It is a
|
|
5
|
+
// small staging shape that the Turtle parser (parse.ts) fills from RDF triples
|
|
6
|
+
// and the mapper (to_ir.ts) reads to produce the IR. Keeping the two apart lets
|
|
7
|
+
// the parser stay a mechanical triples-to-structs step while all of the OWL ->
|
|
8
|
+
// OSI mapping policy lives in one place (to_ir.ts).
|
|
9
|
+
//
|
|
10
|
+
// Scope: the OWL constructs the converter maps to native OSI today -- classes,
|
|
11
|
+
// datatype/object properties, their human annotations (rdfs:label / comment,
|
|
12
|
+
// skos labels / definition / example, dcterms/dc description), datatype ranges,
|
|
13
|
+
// keys (owl:hasKey, owl:InverseFunctionalProperty), class hierarchy
|
|
14
|
+
// (rdfs:subClassOf -> extends), and ontology-header metadata -- PLUS the
|
|
15
|
+
// constructs with no native home that ride along verbatim as custom extensions:
|
|
16
|
+
// property inheritance (rdfs:subPropertyOf), inverse/equivalence/disjointness
|
|
17
|
+
// cross-references (owl:inverseOf, owl:equivalentClass, owl:disjointWith,
|
|
18
|
+
// owl:equivalentProperty, owl:propertyDisjointWith), the full set of property
|
|
19
|
+
// characteristics (symmetric / transitive / functional / reflexive /
|
|
20
|
+
// irreflexive / asymmetric), per-term annotations (rdfs:seeAlso,
|
|
21
|
+
// rdfs:isDefinedBy, owl:deprecated, owl:versionInfo), enumerations
|
|
22
|
+
// (owl:oneOf), property chains (owl:propertyChainAxiom), and the set-level
|
|
23
|
+
// axioms that hang off an anonymous node rather than a named term
|
|
24
|
+
// (owl:AllDisjointClasses, owl:AllDisjointProperties, owl:AllDifferent -> the
|
|
25
|
+
// model). A carried cross-reference keeps the FULL referent IRI; the mapper
|
|
26
|
+
// shortens it to a local name only when it lives in this ontology's own
|
|
27
|
+
// namespace (see to_ir.refValue). Richer OWL still absent (SHACL, cardinality
|
|
28
|
+
// restrictions, individuals); see the "What is not covered yet" note in the
|
|
29
|
+
// guide.
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OwlModel } from './model';
|
|
2
|
+
export declare function localName(iri: string): string;
|
|
3
|
+
export declare function namespace(iri: string): string | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Parses a Turtle document into an OwlModel.
|
|
6
|
+
*
|
|
7
|
+
* Synchronous: `n3`'s Parser returns the full quad array when called without a
|
|
8
|
+
* callback, which suits a one-shot file import. Throws on malformed Turtle (the
|
|
9
|
+
* parser's own error), which the CLI surfaces.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseOwl(turtle: string): OwlModel;
|