Represents the function signature of a mapping from some value to a term.
Used by this library where lambdas are accepted for translating arbitrary values chosen by the user to terms.
Remarks
This library includes an assortment of opinionated mappings from values to terms that adhere to this interface.
They are located in the following namespaces:
While the above mappings can be used anywhere a mapping from value to term is needed, users can also write their own as plain lambdas.
No restrictions are imposed on the type or content of the value parameter accepted by these mapping functions except for the understanding that they return terms that represent the value in some way that is meaningful for the user in some circumstances.
Example: Using a built-in mapping
It is expected that in most cases the easiest way to convert between RDF terms and native values is by referencing one of the existing mapping functions like LiteralFrom.double:
classPersonextendsTermWrapper { setage(value: number) { RequiredAs.object(this, "age", LiteralFrom.double) // 3rd param is the mapping } }
Represents the function signature of a mapping from some value to a term.
Used by this library where lambdas are accepted for translating arbitrary values chosen by the user to terms.
Remarks
Example: Using a built-in mapping
It is expected that in most cases the easiest way to convert between RDF terms and native values is by referencing one of the existing mapping functions like LiteralFrom.double:
Example: Using an inline lambda
Mapping can also be expressed as a lambda (function expression or arrow function expression):
Example: Mapping as TypeScript function
Example: Mapping as JavaScript function
Example: Mapping as TypeScript typed constant
Authoring mappings as typed TypeScript constants helps by compile-time checking that a lambda adheres to the interface.