Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 1x 4x 4x 4x 4x 4x 4x 4x | import { container } from 'tsyringe';
import { Store } from "@faubulous/mentor-rdf";
import { ServiceToken } from '@src/services/tokens';
import { IWorkspaceFileService, IWorkspaceIndexerService } from '@src/services/core';
import { ShapeGraphService } from '@src/services/validation/shape-graph-service';
import { loadFrameworkVocabularies } from '@src/services/core/preset-graphs';
export const reindexWorkspace = {
id: 'mentor.command.reindexWorkspace',
handler: async () => {
const store = container.resolve<Store>(ServiceToken.Store);
// Replace the store's contents wholesale: deleting the graphs one quad at a
// time took seconds on a large workspace and released no memory, because
// the store's term dictionary never shrinks.
store.clear();
loadFrameworkVocabularies(store);
// Restore the preset and user shape graphs that the wipe removed.
await container.resolve<ShapeGraphService>(ServiceToken.ShapeGraphService).loadAll();
// Rediscover the workspace files, so the index also recovers from file system
// changes the file watcher did not report.
await container.resolve<IWorkspaceFileService>(ServiceToken.WorkspaceFileService).discoverFiles();
// Reindex the workspace files..
const workspaceIndexer = container.resolve<IWorkspaceIndexerService>(ServiceToken.WorkspaceIndexerService);
await workspaceIndexer.indexWorkspace(true);
}
}; |