WebID

This service allows you to create and view WebID-conform profiles.

Features

  • CRUD operations in WebID
  • Storage in triple store

Dependencies

  • LdpService
  • TripleStoreService

Install

$ npm install @semapps/webid --save

Usage

const { WebIdService } = require('@semapps/webid');
module.exports = {
mixins: [WebIdService],
settings: {
usersContainer: 'http://localhost:3000/users/'
}
};

Optionally, you can configure the API routes with moleculer-web:

const { ApiGatewayService } = require('moleculer-web');
const { Routes } = require('@semapps/webid');
broker.createService({
mixins: [ApiGatewayService],
settings: {
routes: [...Routes, /* Other routes here */],
}
});

Settings

PropertyTypeDefaultDescription
usersContainerStringrequiredURI of the container where WebIDs will be stored

Actions

The following service actions are available:

create

Parameters
PropertyTypeDefaultDescription
emailstringrequiredEmail address
nickstringFirst part of the email addressNickname
namestringnameName
familyNamestringnullFamily name
homepagestringnullUser's website
Return

Object - Created profile

view

Parameters
PropertyTypeDefaultDescription
userIdstringThe webId of the logged userUser's slug
Return

Object - User's profile

edit

Parameters
PropertyTypeDefaultDescription
userIdstringThe webId of the logged userUser's slug
emailstringnullEmail address
nickstringnullNickname
namestringnameName
familyNamestringnullFamily name
homepagestringnullUser's website
Return

Object - Modified profile

list

Return

String - LDP container with all registered users

Events

The following events are emitted.

webid.created

Sent after a new profile is created.

Parameters

Object - Created profile