@semiont/ontology 0.5.3 → 0.5.4

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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Entity Types Bootstrap - moved to backend
3
+ *
4
+ * NOTE: The bootstrap service has been moved back to apps/backend/src/bootstrap/entity-types-bootstrap.ts
5
+ * to avoid circular dependency between @semiont/ontology and @semiont/core.
6
+ *
7
+ * Only DEFAULT_ENTITY_TYPES is exported from this package.
8
+ * The bootstrap logic depends on EnvironmentConfig from @semiont/core and EventStore from backend,
9
+ * so it belongs in the backend, not in the ontology package.
10
+ */
11
+ export { DEFAULT_ENTITY_TYPES } from './entity-types';
12
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Entity Type Extraction Utilities
3
+ *
4
+ * Extract entity types from annotation bodies.
5
+ * Entity types are stored as TextualBody with purpose: "tagging"
6
+ */
7
+ import type { Annotation } from '@semiont/core';
8
+ /**
9
+ * Extract entity types from annotation bodies
10
+ * Entity types are stored as TextualBody with purpose: "tagging"
11
+ * Accepts any object with a body property matching Annotation['body'].
12
+ * Body is optional (highlights carry none) — returns [] if absent.
13
+ */
14
+ export declare function getEntityTypes(annotation: {
15
+ body?: Annotation['body'];
16
+ }): string[];
17
+ //# sourceMappingURL=entity-extraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-extraction.d.ts","sourceRoot":"","sources":["../src/entity-extraction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE;IAAE,IAAI,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;CAAE,GAAG,MAAM,EAAE,CA8BlF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Default entity types for the Semiont system
3
+ *
4
+ * Entity types are used to tag resources and annotations with semantic categories.
5
+ * These types serve as initial seed data for the entity types collection.
6
+ */
7
+ export declare const DEFAULT_ENTITY_TYPES: string[];
8
+ //# sourceMappingURL=entity-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-types.d.ts","sourceRoot":"","sources":["../src/entity-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,UAUhC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,88 +1,16 @@
1
- import { Annotation } from '@semiont/core';
2
-
3
1
  /**
4
- * Default entity types for the Semiont system
2
+ * @semiont/ontology
5
3
  *
6
- * Entity types are used to tag resources and annotations with semantic categories.
7
- * These types serve as initial seed data for the entity types collection.
8
- */
9
- declare const DEFAULT_ENTITY_TYPES: string[];
10
-
11
- /**
12
- * Tag Collections Management
13
- *
14
- * Stores entity types in the graph database as append-only collections.
15
- * Provides interface for graph database implementations to manage entity type collections.
16
- */
17
- interface TagCollection {
18
- id: string;
19
- collectionType: 'entity-types';
20
- tags: string[];
21
- created: Date;
22
- updatedAt: Date;
23
- }
24
- interface TagCollectionOperations {
25
- /**
26
- * Get or create collections with auto-seeding
27
- */
28
- getEntityTypes(): Promise<string[]>;
29
- /**
30
- * Append new tag (no duplicates)
31
- */
32
- addEntityType(tag: string): Promise<void>;
33
- /**
34
- * Bulk append tags
35
- */
36
- addEntityTypes(tags: string[]): Promise<void>;
37
- /**
38
- * Check if collections exist
39
- */
40
- hasEntityTypesCollection(): Promise<boolean>;
41
- /**
42
- * Initialize collections with seed data if they don't exist
43
- */
44
- initializeCollections(): Promise<void>;
45
- }
46
-
47
- /**
48
- * Entity Type Extraction Utilities
49
- *
50
- * Extract entity types from annotation bodies.
51
- * Entity types are stored as TextualBody with purpose: "tagging"
52
- */
53
-
54
- /**
55
- * Extract entity types from annotation bodies
56
- * Entity types are stored as TextualBody with purpose: "tagging"
57
- * Accepts any object with a body property matching Annotation['body'].
58
- * Body is optional (highlights carry none) — returns [] if absent.
59
- */
60
- declare function getEntityTypes(annotation: {
61
- body?: Annotation['body'];
62
- }): string[];
63
-
64
- /**
65
- * Tag Schema Extraction Utilities
4
+ * Entity-type vocabulary + annotation-body extraction utilities.
66
5
  *
67
- * Extract tag categories and schema IDs from tag annotations.
68
- * Tags use dual-body structure:
69
- * - First body has purpose: "tagging" with category value
70
- * - Second body has purpose: "classifying" with schema ID
71
- */
72
-
73
- /**
74
- * Extract tag category from a tag annotation's body
75
- * Tags use dual-body structure: first body has purpose: "tagging" with category value
76
- * @param annotation - The annotation to extract category from
77
- * @returns The tag category (e.g., "Issue", "Rule"), or undefined if not a tag or no category found
78
- */
79
- declare function getTagCategory(annotation: Annotation): string | undefined;
80
- /**
81
- * Extract tag schema ID from a tag annotation's body
82
- * Tags use dual-body structure: second body has purpose: "classifying" with schema ID
83
- * @param annotation - The annotation to extract schema ID from
84
- * @returns The schema ID (e.g., "legal-irac"), or undefined if not a tag or no schema found
6
+ * Note: tag-schema *data* lives with the KB that owns it (registered at
7
+ * runtime via `frame.addTagSchema(...)`). The `TagSchema` and `TagCategory`
8
+ * *types* are exported from `@semiont/core`. This package owns only the
9
+ * extraction helpers (`getTagCategory`, `getTagSchemaId`) that read schema
10
+ * provenance off an annotation's body.
85
11
  */
86
- declare function getTagSchemaId(annotation: Annotation): string | undefined;
87
-
88
- export { DEFAULT_ENTITY_TYPES, type TagCollection, type TagCollectionOperations, getEntityTypes, getTagCategory, getTagSchemaId };
12
+ export { DEFAULT_ENTITY_TYPES } from './entity-types';
13
+ export type { TagCollection, TagCollectionOperations } from './tag-collections';
14
+ export { getEntityTypes } from './entity-extraction';
15
+ export { getTagCategory, getTagSchemaId } from './tag-extraction';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGhF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Tag Collections Management
3
+ *
4
+ * Stores entity types in the graph database as append-only collections.
5
+ * Provides interface for graph database implementations to manage entity type collections.
6
+ */
7
+ export interface TagCollection {
8
+ id: string;
9
+ collectionType: 'entity-types';
10
+ tags: string[];
11
+ created: Date;
12
+ updatedAt: Date;
13
+ }
14
+ export interface TagCollectionOperations {
15
+ /**
16
+ * Get or create collections with auto-seeding
17
+ */
18
+ getEntityTypes(): Promise<string[]>;
19
+ /**
20
+ * Append new tag (no duplicates)
21
+ */
22
+ addEntityType(tag: string): Promise<void>;
23
+ /**
24
+ * Bulk append tags
25
+ */
26
+ addEntityTypes(tags: string[]): Promise<void>;
27
+ /**
28
+ * Check if collections exist
29
+ */
30
+ hasEntityTypesCollection(): Promise<boolean>;
31
+ /**
32
+ * Initialize collections with seed data if they don't exist
33
+ */
34
+ initializeCollections(): Promise<void>;
35
+ }
36
+ //# sourceMappingURL=tag-collections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-collections.d.ts","sourceRoot":"","sources":["../src/tag-collections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,cAAc,CAAC;IAC/B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEpC;;OAEG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1C;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;OAEG;IACH,wBAAwB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7C;;OAEG;IACH,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Tag Schema Extraction Utilities
3
+ *
4
+ * Extract tag categories and schema IDs from tag annotations.
5
+ * Tags use dual-body structure:
6
+ * - First body has purpose: "tagging" with category value
7
+ * - Second body has purpose: "classifying" with schema ID
8
+ */
9
+ import type { Annotation } from '@semiont/core';
10
+ /**
11
+ * Extract tag category from a tag annotation's body
12
+ * Tags use dual-body structure: first body has purpose: "tagging" with category value
13
+ * @param annotation - The annotation to extract category from
14
+ * @returns The tag category (e.g., "Issue", "Rule"), or undefined if not a tag or no category found
15
+ */
16
+ export declare function getTagCategory(annotation: Annotation): string | undefined;
17
+ /**
18
+ * Extract tag schema ID from a tag annotation's body
19
+ * Tags use dual-body structure: second body has purpose: "classifying" with schema ID
20
+ * @param annotation - The annotation to extract schema ID from
21
+ * @returns The schema ID (e.g., "legal-irac"), or undefined if not a tag or no schema found
22
+ */
23
+ export declare function getTagSchemaId(annotation: Annotation): string | undefined;
24
+ //# sourceMappingURL=tag-extraction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-extraction.d.ts","sourceRoot":"","sources":["../src/tag-extraction.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAShD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAUzE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAUzE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/ontology",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "description": "Entity types, tag schemas, and W3C annotation vocabularies",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "README.md"
17
17
  ],
18
18
  "scripts": {
19
- "build": "npm run typecheck && tsup",
19
+ "build": "npm run typecheck && tsup && tsc -p tsconfig.build.json",
20
20
  "typecheck": "tsc --noEmit",
21
21
  "clean": "rm -rf dist",
22
22
  "test": "vitest run",
@@ -27,7 +27,7 @@
27
27
  "devDependencies": {
28
28
  "@vitest/coverage-v8": "^4.1.0",
29
29
  "tsup": "^8.0.1",
30
- "typescript": "^5.6.3"
30
+ "typescript": "^6.0.2"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"