BaseModel

BaseModel

new BaseModel()

Source:
To Do:
  • Factor out code only used on startup for fixing links that has no business being in the extended classes.

The baseModel contains reusable code that can be extended to other Models

Members

prefixes :Object

Source:

Key - value pairs containing default prefixes we always need

Type:
  • Object

prefixRegex :RegExp

Source:
To Do:
  • move this out

Regular expression to match prefixes that need to be adjusted to the server's url

Only used once at startup in app.js

Type:
  • RegExp

replacementPrefixes :Object

Source:
To Do:
  • move this out, only used on startup

The prefixes which depend on the server's current URL and thus always need to point to the right address.

Type:
  • Object

subpathlinkRegex :RegExp

Source:
To Do:
  • move this out

Regular expression to match 'subpathlinks' that need to be adjusted to the server's url

Only used once at startup in app.js

Type:
  • RegExp

Methods

(async) getAll(req) → {Object}

Source:

gets all of the items from this model and converts to jsonLD

Parameters:
Name Type Description
req Object

Request, currently unused

Returns:
  • Json representation of data
Type
Object

replacePrefixesInFile(file)

Source:
To Do:
  • - replacing the sublinkpath links won't work if there are references to links not pointing to a 'plan' - pull this out of baseModel as it's only used once on startup but never in any of the derived classes

Replaces all "@prefix..." and "ex:sublinkpath..." lines in the supplied file with the correct links as these links depend on the hostname of the server

Parameters:
Name Type Description
file string

name of the file whose contents we will be replacing

BaseModel

new BaseModel(req)

Source:
Parameters:
Name Type Description
req Object

HTTP request, used to generate the correct links from the URL of the request

Members

prefixes :Object

Source:

Key - value pairs containing default prefixes we always need

Type:
  • Object

prefixRegex :RegExp

Source:
To Do:
  • move this out

Regular expression to match prefixes that need to be adjusted to the server's url

Only used once at startup in app.js

Type:
  • RegExp

replacementPrefixes :Object

Source:
To Do:
  • move this out, only used on startup

The prefixes which depend on the server's current URL and thus always need to point to the right address.

Type:
  • Object

subpathlinkRegex :RegExp

Source:
To Do:
  • move this out

Regular expression to match 'subpathlinks' that need to be adjusted to the server's url

Only used once at startup in app.js

Type:
  • RegExp

Methods

(async) getAll(req) → {Object}

Source:

gets all of the items from this model and converts to jsonLD

Parameters:
Name Type Description
req Object

Request, currently unused

Returns:
  • Json representation of data
Type
Object

replacePrefixesInFile(file)

Source:
To Do:
  • - replacing the sublinkpath links won't work if there are references to links not pointing to a 'plan' - pull this out of baseModel as it's only used once on startup but never in any of the derived classes

Replaces all "@prefix..." and "ex:sublinkpath..." lines in the supplied file with the correct links as these links depend on the hostname of the server

Parameters:
Name Type Description
file string

name of the file whose contents we will be replacing