@semiont/graph 0.2.28-build.40 → 0.2.28

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 +18 -112
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # @semiont/graph
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@semiont/graph)](https://www.npmjs.com/package/@semiont/graph)
4
3
  [![Tests](https://github.com/The-AI-Alliance/semiont/actions/workflows/package-tests.yml/badge.svg)](https://github.com/The-AI-Alliance/semiont/actions/workflows/package-tests.yml?query=branch%3Amain+is%3Asuccess+job%3A%22Test+graph%22)
5
4
 
6
5
  Graph database abstraction with Neo4j, Neptune, JanusGraph, and in-memory implementations.
@@ -45,56 +44,32 @@ const envConfig: EnvironmentConfig = {
45
44
  };
46
45
 
47
46
  const graph = await getGraphDatabase(envConfig);
48
- await graph.connect();
49
-
50
- // Create a document
51
- const document = await graph.createDocument({
52
- id: 'doc-123',
53
- name: 'My Document',
54
- format: 'text/plain',
55
- entityTypes: ['Person', 'Organization'],
56
- archived: false,
57
- createdAt: new Date().toISOString(),
58
- updatedAt: new Date().toISOString()
47
+
48
+ // Create a resource
49
+ const resource = await graph.createResource({
50
+ id: 'res_123',
51
+ type: 'Document',
52
+ title: 'My Document'
59
53
  });
60
54
 
61
55
  // Create an annotation
62
56
  const annotation = await graph.createAnnotation({
63
- id: 'anno-456',
64
- target: { source: 'doc-123' },
65
- body: [{ value: 'Important note' }],
66
- creator: 'user-123',
67
- created: new Date().toISOString()
57
+ target: { source: 'res_123' },
58
+ body: { value: 'A note' },
59
+ motivation: 'commenting'
68
60
  });
69
-
70
- // Query relationships
71
- const annotations = await graph.getAnnotationsForDocument('doc-123');
72
61
  ```
73
62
 
74
- ## Features
75
-
76
- - 🔌 **Multiple Providers** - Neo4j, AWS Neptune, JanusGraph, In-memory
77
- - 🎯 **Unified Interface** - Same API across all providers
78
- - 📊 **W3C Compliant** - Full Web Annotation Data Model support
79
- - 🔄 **Event-Driven Updates** - Sync from Event Store projections
80
- - 🚀 **Optional Projection** - Graph is optional, core features work without it
81
- - 🔍 **Rich Queries** - Cross-document relationships and entity searches
82
-
83
- ## Documentation
84
-
85
- - [API Reference](./docs/API.md) - Complete API documentation
86
- - [Architecture](./docs/ARCHITECTURE.md) - System design and principles
87
- - [Provider Guide](./docs/PROVIDERS.md) - Provider-specific details
63
+ ## Supported Implementations
88
64
 
89
- ## Examples
65
+ - **Neo4j** - Cypher-based graph database
66
+ - **Neptune** - AWS managed Gremlin-based graph database
67
+ - **JanusGraph** - Open-source Gremlin-based graph database
68
+ - **MemoryGraph** - In-memory implementation for testing
90
69
 
91
- - [Basic Example](./examples/basic.ts) - Simple graph operations
92
- - [Multi-Provider](./examples/multi-provider.ts) - Switching between providers
93
-
94
- ## Supported Implementations
70
+ ## Configuration
95
71
 
96
72
  ### Neo4j
97
- Native graph database with Cypher query language.
98
73
 
99
74
  ```typescript
100
75
  const envConfig = {
@@ -110,8 +85,7 @@ const envConfig = {
110
85
  };
111
86
  ```
112
87
 
113
- ### AWS Neptune
114
- Managed graph database supporting Gremlin.
88
+ ### Neptune
115
89
 
116
90
  ```typescript
117
91
  const envConfig = {
@@ -127,7 +101,6 @@ const envConfig = {
127
101
  ```
128
102
 
129
103
  ### JanusGraph
130
- Open-source distributed graph database.
131
104
 
132
105
  ```typescript
133
106
  const envConfig = {
@@ -144,7 +117,6 @@ const envConfig = {
144
117
  ```
145
118
 
146
119
  ### MemoryGraph
147
- In-memory implementation for development and testing.
148
120
 
149
121
  ```typescript
150
122
  const envConfig = {
@@ -158,74 +130,8 @@ const envConfig = {
158
130
 
159
131
  ## API Overview
160
132
 
161
- ### Core Operations
162
-
163
- ```typescript
164
- // Document operations
165
- await graph.createDocument(document);
166
- await graph.getDocument(id);
167
- await graph.updateDocument(id, updates);
168
- await graph.deleteDocument(id);
169
-
170
- // Annotation operations
171
- await graph.createAnnotation(annotation);
172
- await graph.getAnnotation(id);
173
- await graph.updateAnnotation(id, updates);
174
- await graph.deleteAnnotation(id);
175
-
176
- // Query operations
177
- await graph.getAnnotationsForDocument(documentId);
178
- await graph.findDocumentsByEntityTypes(['Person']);
179
- await graph.findAnnotationsByTarget(targetId);
180
-
181
- // Tag collections
182
- await graph.getEntityTypes();
183
- await graph.addEntityType('NewType');
184
- ```
185
-
186
- ## Graph as Optional Projection
187
-
188
- The graph database is designed as an **optional read-only projection**:
189
-
190
- ### Works WITHOUT Graph
191
- ✅ Viewing resources and annotations
192
- ✅ Creating/updating/deleting annotations
193
- ✅ Single-document workflows
194
- ✅ Real-time SSE updates
195
-
196
- ### Requires Graph
197
- ❌ Cross-document relationship queries
198
- ❌ Entity-based search across resources
199
- ❌ Graph visualization
200
- ❌ Network analysis
201
-
202
- See [Architecture Documentation](./docs/ARCHITECTURE.md) for details.
203
-
204
- ## Performance
205
-
206
- | Provider | Setup | Speed | Scalability | Persistence |
207
- |----------|-------|-------|-------------|-------------|
208
- | Neo4j | Medium | Fast | High | Yes |
209
- | Neptune | Complex | Medium | Very High | Yes |
210
- | JanusGraph | Complex | Medium | Very High | Yes |
211
- | Memory | None | Very Fast | Low | No |
212
-
213
- ## Development
214
-
215
- ```bash
216
- # Install dependencies
217
- npm install
218
-
219
- # Build package
220
- npm run build
221
-
222
- # Run tests
223
- npm test
224
-
225
- # Type checking
226
- npm run typecheck
227
- ```
133
+ See [docs/GraphInterface.md](docs/GraphInterface.md) for complete API documentation.
228
134
 
229
135
  ## License
230
136
 
231
- Apache-2.0
137
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/graph",
3
- "version": "0.2.28-build.40",
3
+ "version": "0.2.28",
4
4
  "type": "module",
5
5
  "description": "Graph database abstraction with Neo4j, Neptune, JanusGraph, and in-memory implementations",
6
6
  "main": "./dist/index.js",