Class: VocabularyApplicationService
Defined in: application/services/core/VocabularyService.ts:286
In-memory VocabularyService backed by a MaterializedVocabularyIndex. Schemes in the index that carry a url are lazy: their concepts are fetched on first use by VocabularyApplicationService.listConcepts, VocabularyApplicationService.searchConcepts (when the scheme is in schemeUris) or VocabularyApplicationService.resolveTerm. Scheme URIs are matched with and without a trailing slash and across the https://sidedoc.app/vocabs/ and https://vocab.sidedoc.app/schemes/ aliases.
Implements
Constructors
Constructor
new VocabularyApplicationService(index?): VocabularyApplicationService;Defined in: application/services/core/VocabularyService.ts:298
Parameters
| Parameter | Type | Description |
|---|---|---|
index? | MaterializedVocabularyIndex | Index to serve; defaults to the index bundled with the package. |
Returns
VocabularyApplicationService
Methods
getMaterializedIndex()
getMaterializedIndex(): Promise<MaterializedVocabularyIndex>;Defined in: application/services/core/VocabularyService.ts:320
Return the index the service was created with. Concepts loaded lazily are not added to it.
Returns
Promise<MaterializedVocabularyIndex>
Implementation of
VocabularyService.getMaterializedIndex
listConcepts()
listConcepts(input): Promise<VocabularyListResult<VocabularyConceptSummary>>;Defined in: application/services/core/VocabularyService.ts:357
List the concepts of one scheme sorted by label, loading a lazy scheme first. Defaults to locale en, page 1 and 50 items. parentUri and includeDescendants are currently ignored.
Parameters
| Parameter | Type |
|---|---|
input | { includeDescendants?: boolean; locale?: string; page?: number; pageSize?: number; parentUri?: string; schemeUri: string; } |
input.includeDescendants? | boolean |
input.locale? | string |
input.page? | number |
input.pageSize? | number |
input.parentUri? | string |
input.schemeUri | string |
Returns
Promise<VocabularyListResult<VocabularyConceptSummary>>
Implementation of
VocabularyService.listConcepts
listSchemes()
listSchemes(input?): Promise<VocabularyListResult<VocabularySchemeSummary>>;Defined in: application/services/core/VocabularyService.ts:328
List schemes, optionally filtered by a case-insensitive substring of URI or English label, sorted by label. Defaults to page 1 with 25 items. conceptCount excludes lazy concepts not yet loaded.
Parameters
| Parameter | Type |
|---|---|
input? | { page?: number; pageSize?: number; query?: string; } |
input.page? | number |
input.pageSize? | number |
input.query? | string |
Returns
Promise<VocabularyListResult<VocabularySchemeSummary>>
Implementation of
resolveFieldVocabulary()
resolveFieldVocabulary(input): Promise<
| FieldVocabularyBinding
| null>;Defined in: application/services/core/VocabularyService.ts:511
Return the vocabulary binding of a profile field with its scheme URIs normalized to the canonical URIs known to this service, or null when the field has no binding.
Parameters
| Parameter | Type |
|---|---|
input | { fieldPath: string; profile: DocumentProfile; } |
input.fieldPath | string |
input.profile | DocumentProfile |
Returns
Promise< | FieldVocabularyBinding | null>
Implementation of
VocabularyService.resolveFieldVocabulary
resolveTerm()
resolveTerm(input): Promise<
| VocabularyConceptSummary
| null>;Defined in: application/services/core/VocabularyService.ts:482
Look up a concept by full or compact URI, loading the matching lazy scheme if needed. Returns null when the term is unknown.
Parameters
| Parameter | Type |
|---|---|
input | { locale?: string; term: string; } |
input.locale? | string |
input.term | string |
Returns
Promise< | VocabularyConceptSummary | null>
Implementation of
searchConcepts()
searchConcepts(input): Promise<VocabularyListResult<VocabularyConceptSummary>>;Defined in: application/services/core/VocabularyService.ts:386
Search concepts by label in the requested locale (English when no concept has a label in that locale), then by URI for concepts not matched by label. Results are ranked by match quality (exact URI, exact label, prefix, substring). An empty query returns no items. parentUri and includeDescendants are currently ignored.
Parameters
| Parameter | Type |
|---|---|
input | { includeDescendants?: boolean; locale?: string; page?: number; pageSize?: number; parentUri?: string; query: string; schemeUris?: string[]; } |
input.includeDescendants? | boolean |
input.locale? | string |
input.page? | number |
input.pageSize? | number |
input.parentUri? | string |
input.query | string |
input.schemeUris? | string[] |
Returns
Promise<VocabularyListResult<VocabularyConceptSummary>>
Implementation of
VocabularyService.searchConcepts
suggestConcepts()
suggestConcepts(input): Promise<VocabularyConceptSummary[]>;Defined in: application/services/core/VocabularyService.ts:457
Return the first limit (default 10) results of VocabularyApplicationService.searchConcepts.
Parameters
| Parameter | Type |
|---|---|
input | { includeDescendants?: boolean; limit?: number; locale?: string; parentUri?: string; query: string; schemeUris?: string[]; } |
input.includeDescendants? | boolean |
input.limit? | number |
input.locale? | string |
input.parentUri? | string |
input.query | string |
input.schemeUris? | string[] |
Returns
Promise<VocabularyConceptSummary[]>
Implementation of
VocabularyService.suggestConcepts
fromMaterializedIndex()
static fromMaterializedIndex(index): VocabularyApplicationService;Defined in: application/services/core/VocabularyService.ts:313
Create a service from an existing materialized index.
Parameters
| Parameter | Type |
|---|---|
index | MaterializedVocabularyIndex |
Returns
VocabularyApplicationService
fromSkosDocuments()
static fromSkosDocuments(documents): VocabularyApplicationService;Defined in: application/services/core/VocabularyService.ts:306
Create a service from SKOS documents via materializeVocabularyIndexFromSkosDocuments.
Parameters
| Parameter | Type |
|---|---|
documents | object[] |
Returns
VocabularyApplicationService