@manta-eu/ldo 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +35 -34
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,47 +1,48 @@
1
- # manta-ldo
1
+ # @manta-eu/ldo
2
2
 
3
- This package generates TS types (via LDKit) from SHACL shapes.
3
+ TypeScript types for the Manta knowledge graph, generated from its SHACL shapes with
4
+ [LDkit](https://ldkit.io/).
4
5
 
5
- ## Build process
6
+ ## Installation
6
7
 
7
- 1. `pnpm build:shacl` — assembles `.shapes/shacl.ttl` from the kgc sources below.
8
- 2. `pnpm build:ldkit` — regenerates the codegen-only `.shapes/shacl-ldkit.ttl` projection, then
9
- generates `.ldkit/*.ts` from `.shapes/shacl.ttl` + that projection.
8
+ ```bash
9
+ pnpm add @manta-eu/ldo
10
+ ```
10
11
 
11
- `pnpm codegen` runs both in order. Only `.ldkit/*.ts` is committed to git (see `.gitattributes`,
12
- `linguist-generated=true`). The two `.shapes/*.ttl` files above are intermediates of that run and are
13
- git-ignored; `.shapes/reference/shacl-shacl.ttl` is a committed input and stays.
12
+ ## Usage
14
13
 
15
- Shapes are authored against the canonical vocabulary as a
16
- realm-invariant superset; `@manta-eu/ldo/realm` (`realm.ts`) rebases the generated `.ldkit/namespaces.ts`
17
- onto whichever realm the app runs as (`VITE_KEYCLOAK_REALM`), so one generation serves every realm.
14
+ Each export is a set of generated LDkit schemas and the namespaces they are built from:
18
15
 
19
- Running `pnpm build:shacl` assembles `.shapes/shacl.ttl` from three kgc sources for one pinned realm
20
- (`codegenRealm` in `scripts/build-shacl.mjs`): the realm's `all-shacl.ttl` from
21
- `devenv build outputs.all-shacl-by-realm`, its `ontology/memory-schemas.ttl`, and its
22
- `shacl/shapes/observed-entities.ttl`. Every realm's IRIs are rebased onto one canonical vocabulary
23
- root, since the generated types recompose them at runtime from `realm.ts`.
16
+ ```typescript
17
+ import { namespaces } from "@manta-eu/ldo/namespaces";
18
+ import * as schemas from "@manta-eu/ldo/schemas";
19
+ ```
24
20
 
25
- ## Per-realm SHACL (a separate concern, not built here)
21
+ The types describe the graph as a whole. `./realm` carries the vocabulary roots a deployment
22
+ rebases them onto:
26
23
 
27
- The per-realm bundle `<realm>/all-shacl.ttl` — the shared bundle rebased to the realm, plus the
28
- realm's own shapes — is unrelated to the codegen above and is committed at the repo root. It carries
29
- no `ontology/memory-schemas.ttl`. Only `.shapes/shacl.ttl` above merges that file.
30
- `make generate-shacl-all` builds the bundle with Nix (`devenv/packages/all-shacl-by-realm.nix`) into
31
- `shacl/<realm>/all-shacl.ttl`. `manta-shacl-upload` uploads it to RDFox for SHACL validation, and
32
- `manta.action-handlers-codegen`'s `shacl.clj` reads the same file.
24
+ ```typescript
25
+ import { realmRegistry, realmVocabRoots, defaultRealm } from "@manta-eu/ldo/realm";
26
+ ```
33
27
 
34
- ## Rebuild Process
28
+ These read injected configuration: without `VITE_REALM_REGISTRY` carrying the roster your
29
+ application deploys, `realmVocabRoots` is empty and `defaultRealm` is `""`. `VITE_KEYCLOAK_REALM`
30
+ picks which of them is active, and is optional — unset means the default.
35
31
 
36
- Whenever the realm shapes change, this needs to be rebuilt to regenerate the TS types.
32
+ ## Exports
37
33
 
38
- > pnpm codegen
34
+ | Export | Contents |
35
+ | ------------------ | ---------------------------------------------------- |
36
+ | `.` | The generated schemas and namespaces together |
37
+ | `./schemas` | LDkit schemas for every shape |
38
+ | `./namespaces` | Namespace prefixes the schemas are built from |
39
+ | `./realm` | Vocabulary roots and the registry that resolves them |
40
+ | `./sparql-types` | Types for SPARQL result bindings |
41
+ | `./manual-schemas` | Hand-written schemas for shapes that are not derived |
39
42
 
40
- That runs `build:shacl` and `build:ldkit` in order. CI runs the same script (in the `devenv build`
41
- workflow, where nix is set up) and fails when the committed output differs, so regenerate and commit
42
- whenever the realm shapes change.
43
+ `./ad-platform-links`, `./external-links`, `./figma-links` and `./redirect-queries` carry the
44
+ link-shaped helpers that go with them.
43
45
 
44
- The memory subclass shapes inside it are authored and tested kgc-side — see
45
- `kgc/tests/test_memory_schema_shapes.py` (structural invariants) and
46
- `kgc/tests/test_memory_subclass_parity.py` (subclass ↔ inference-rule parity), both parametrized
47
- over every realm.
46
+ ## License
47
+
48
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manta-eu/ldo",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Package that generates TS types from SHACL shapes using LDkit",
5
5
  "exports": {
6
6
  ".": {
@@ -83,6 +83,6 @@
83
83
  "codegen": "pnpm build:shacl && pnpm build:ldkit",
84
84
  "test": "vitest --run",
85
85
  "types": "tsc --noEmit",
86
- "build": "tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json --resolve-full-paths"
86
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json --resolve-full-paths"
87
87
  }
88
88
  }