JSON-LD
This service allows you to manage JSON-LD formatted data.
Features
- Manipulate JSON-LD data (frame, compact, expand...)
- Manipulate JSON-LD contexts (parse, validate...)
- Automaticaly generate a local JSON-LD context
Dependencies
- OntologiesService
- ApiGateway (if a local context file is defined)
Sub-services
- JsonLdParserService
- JsonLdContextService
- JsonLdDocumentLoaderService
- JsonLdApiService
Install
$ yarn add @semapps/jsonld
Usage
const path = require('path');
const { JsonLdService } = require('@semapps/jsonld');
module.exports = {
mixins: [JsonLdService],
settings: {
baseUri: 'http://localhost:3000',
localContextPath: '/.well-known/context.jsonld',
cachedContextFiles: [
{
uri: 'https://www.w3.org/ns/activitystreams',
file: path.resolve(__dirname, './config/context-as.json')
}
]
}
};
Service settings
Property | Type | Default | Description |
---|---|---|---|
baseUri | String | required | Base URL of the server. |
localContextPath | String | "/.well-known/context.jsonld" | Path of the automatically generated local JSON-LD context file |
cachedContextFiles | [Object] | Context files to put in cache on start (see example above) |