StepModel

StepModel

The stepModel contains code specifically for the step model Handles all steps related data

Constructor

new StepModel()

Source:

Extends

Members

prefixes :Object

Source:
Overrides:

Key - value pairs containing default prefixes we always need

Type:
  • Object

prefixRegex :RegExp

Source:
Overrides:
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:
Overrides:
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:
Overrides:
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:
Overrides:

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

(async) getAllInputPatternsAsString() → {string}

Source:

Gets the input patterns as n3string.

Returns:

n3string of all input patterns

Type
string

(async) getAllQueryPatternsAsString() → {string}

Source:

Gets all query patterns as n3string

Returns:

n3string of all query patterns

Type
string

(async) getInputPatternByStep(stepName) → {Object|null}

Source:

Get input pattern of the provided step

Parameters:
Name Type Description
stepName string

name of the step are interested in

Returns:
  • object with the following properties:

    • triples: n3string of the expected triples
    • replaceVar: n3string of the variables to replace
    • prefixes: all the prefixes for a step as a string
    • step: name of the step
  • returns 'null' if no match can be found for either the triples or if there are no variables to replace

Type
Object | null

(async) getTriplesFromSteps(steps) → {String|null}

Source:

Transforms the provided steps into a temporary N3 file which gets fed to the reasoner.

Which in turn returns the inferred N3 steps that we need to add to the users profile. SHOULD NEVER BE USED WITH SOLID (only possible to change internal data)

Parameters:
Name Type Description
steps Object.<String, (String|Array.<String>)>

Stepname - stepvalue pairs. Stepvalue can be a string or an array of strings for steps that take multiple values

Returns:
  • N3 strings inferred from the steps or null if no steps were provided.
Type
String | null

replacePrefixesInFile(file)

Source:
Overrides:
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