Merge remote-tracking branch 'origin/main'
# Conflicts: # CHANGES.md # package-lock.json # package.json # src/storage/adapters/fileSystemStorage.ts
This commit is contained in:
commit
da675f0e5b
49 changed files with 5099 additions and 4391 deletions
35
README.md
35
README.md
|
|
@ -3,7 +3,7 @@
|
|||
<br/><br/>
|
||||
|
||||
[](LICENSE)
|
||||
[](https://nodejs.org/)
|
||||
[](https://nodejs.org/)
|
||||
[](https://www.typescriptlang.org/)
|
||||
[](CONTRIBUTING.md)
|
||||
|
||||
|
|
@ -69,15 +69,19 @@ configuration.
|
|||
Brainy offers specialized packages for different use cases:
|
||||
|
||||
#### CLI Package
|
||||
|
||||
```bash
|
||||
npm install -g @soulcraft/brainy-cli
|
||||
```
|
||||
|
||||
Command-line interface for data management, bulk operations, and database administration.
|
||||
|
||||
#### Web Service Package
|
||||
|
||||
```bash
|
||||
npm install @soulcraft/brainy-web-service
|
||||
```
|
||||
|
||||
REST API web service wrapper that provides HTTP endpoints for search operations and database queries.
|
||||
|
||||
## 🏁 Quick Start
|
||||
|
|
@ -488,6 +492,33 @@ const backupData = await db.backup()
|
|||
const restoreResult = await db.restore(backupData, {clearExisting: true})
|
||||
```
|
||||
|
||||
### Database Statistics
|
||||
|
||||
Brainy provides a way to get statistics about the current state of the database:
|
||||
|
||||
```typescript
|
||||
import {BrainyData, getStatistics} from '@soulcraft/brainy'
|
||||
|
||||
// Create and initialize the database
|
||||
const db = new BrainyData()
|
||||
await db.init()
|
||||
|
||||
// Get statistics using the standalone function
|
||||
const stats = await getStatistics(db)
|
||||
console.log(stats)
|
||||
// Output: { nounCount: 0, verbCount: 0, metadataCount: 0, hnswIndexSize: 0 }
|
||||
|
||||
// Or using the instance method
|
||||
const instanceStats = await db.getStatistics()
|
||||
```
|
||||
|
||||
The statistics include:
|
||||
|
||||
- `nounCount`: Number of nouns (entities) in the database
|
||||
- `verbCount`: Number of verbs (relationships) in the database
|
||||
- `metadataCount`: Number of metadata entries
|
||||
- `hnswIndexSize`: Size of the HNSW index
|
||||
|
||||
### Working with Nouns (Entities)
|
||||
|
||||
```typescript
|
||||
|
|
@ -1081,7 +1112,7 @@ The repository includes a comprehensive demo that showcases Brainy's main featur
|
|||
- **[Try the live demo](https://soulcraft-research.github.io/brainy/demo/index.html)** - Check out the
|
||||
interactive demo on
|
||||
GitHub Pages
|
||||
- Or run it locally with `npm run demo` (see [demo instructions](README.demo.md) for details)
|
||||
- Or run it locally with `npm run demo` (see [demo instructions](demo.md) for details)
|
||||
- To deploy your own version to GitHub Pages, use the GitHub Actions workflow in
|
||||
`.github/workflows/deploy-demo.yml`,
|
||||
which automatically deploys when pushing to the main branch or can be manually triggered
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue