/
List of Available Lens Functions

List of Available Lens Functions

The information in this document refers to functions that are available in the latest version of the RML Mapper feature.
Lenses may require updating in order to take advantage of any newly created functions.

 

General Functionality

  • A triple will not be generated if the subject or object is provided will a NULL value.

  • Strings passed into functions may be sourced from

    • References (The entire value of a field in the source document)

    • Templates (A string that includes values of fields in the source document, as well as manually specified strings)

    • Outputs from other Functions (Functions may therefore be nested)

Prefixes

In order to make use of the below functions, you must include the following prefixes in your mapping files:

@prefix fnml: <http://semweb.mmlab.be/ns/fnml#> . @prefix fno: <https://w3id.org/function/ontology#> . @prefix grel: <http://users.ugent.be/~bjdmeest/function/grel.ttl#> .

Custom Data Lens Functions

ifEqual

  • Description: If a value equals and expected value, return if else that

  • Required Parameters:

    • Input - Input text

    • String1 - Value to be equal to

    • String2 - If equal return this value

    • String3 - If not equal return this value

  • Returns: String3 if input equals String1, otherwise return String2

fnml:functionValue [ # The object is the result of the function rr:predicateObjectMap [ rr:predicate fno:executes ; # Execute the function rr:objectMap [ rr:constant grel:removeEqualValues ] # The name of the function ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; # Expected input type rr:objectMap [ rr:template "{Name}" ] # Input value param, referenced from the data source ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; # Expected input type rr:objectMap [ rr:template "John" ] # Input value param, string constant as defined in "" ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter3 ; # Expected input type rr:objectMap [ rr:template "matches name" ] # Input value param, string constant as defined in "" ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter4 ; # Expected input type rr:objectMap [ rr:template "no match" ] # Input value param, string constant as defined in "" ] ; ]

toPascalCase

  • Description: Returns as value as PascalCase

  • Required Parameters:

    • Input - Input text

  • Returns: Input as PascalCase

fnml:functionValue [ # The object is the result of the function rr:predicateObjectMap [ rr:predicate fno:executes ; # Execute the function rr:objectMap [ rr:constant grel:toPascalCase ] # The name of the function ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; # Expected input type rr:objectMap [ rml:reference "Name" ] # Input value param, referenced from the data source ] ]

toCamelCase

  • Description: Returns as value as camelCase

  • Required Parameters:

    • Input - Input text

  • Returns: Input as camelCase

toKebabCase

  • Description: Returns as value as kebab-case

  • Required Parameters:

    • Input - Input text

  • Returns: Input as kebab-case

toScreamingSnakeCase

  • Description: Returns as value as SCREAMING_SNAKE_CASE

  • Required Parameters:

    • Input - Input text

  • Returns: Input as SCREAMING_SNAKE_CASE

toSnakeCase

  • Description: Returns as value as snake_case

  • Required Parameters:

    • Input - Input text

  • Returns: Input as snake_case

unixEpochConverter

  • Description: Reads a long representing unix time to xsd:date

  • Required Parameters:

    • Input - Input text

    • String1 - days, seconds, milliseconds (default)

  • Returns: a unix time conversion

existsThen

  • Description: Takes an input value and if it is not null, return the output value

  • Required Parameters:

    • Input - Input text

    • String1 - value to return when not null

  • Returns: String1 when not null, otherwise null

removeEqualValues

  • Description: Returns NULL if Input is equal to any of the values in String1

  • Use Case: Don’t generate a triple if the value in the source data is ‘None’ or N/A

  • Required Parameters:

    • Input - Input text

    • String1 - Delimited list of values

  • Returns: Input or NULL

findAndReplace

  • Description: Find part or all of the first input value from a list of regex, provided by the second input of comma separated values, and replace with its respective value from the third input of comma separated values

  • Use Case: Remove undesirable values from within field data.

  • Expects:

    • Input - Input text

    • String1 - Regex find values

    • String2 - Regex replace values

  • Returns: Input, where matched values from String1 are replaced with corresponding values from String2

removeAllDoubleQuotes

  • Description: Returns the input with all double quotes removed

  • Use Case: Remove unnecessary double quotation marks from within field data.

  • Expects:

    • Input- Input text

  • Returns: Input with all double quotation marks have been removed.

translateToISODate

  • Description: Allows valid xsd:date values to be generated from non ISO standard date formats.

  • Use Case: The source data provides a date, but it’s not in xsd:date format.

  • Expects:

    • YearString - Delimited list containing

      • Input - Input text

      • StartPosition - Which position to start from, relative to the beginning on the Input text

      • CharacterCount - Number of characters after the StartPosition to extract

      • Prefix -2 digit prefix to add to extracted 2 character date, to make a 4 character date.

    • MonthString - Delimited list containing

      • Input - Input text

      • StartPosition - Which position to start from, relative to the beginning on the Input text

      • CharacterCount - Number of characters after the StartPosition to extract

    • DayString - Delimited list containing

      • Input - Input text

      • StartPosition - Which position to start from, relative to the beginning on the Input text

      • CharacterCount - Number of characters after the StartPosition to extract

  • Returns: Date in the format YYYY-MM-DD

extractCharactersFromEnd

  • Description: Extract a configurable number of characters from within a provided string, relative to the end of the string.

  • Use Case: You only want the last 5 characters from a provided string.

  • Expects:

    • Input - Input text

    • String1 - Which position to start from, relative to the end on the Input text (0 being the last character)

    • String2 - Number of characters prior to the position in String1 to extract

  • Returns: A slice of characters from the input text or NULL

extractCharactersFromStart

  • Description: Extract a configurable number of characters from within a provided string, relative to the beginning of the string.

  • Use Case: You only want the first 5 characters from a provided string.

  • Expects:

    • Input - Input text

    • String1 - Which position to start from, relative to the beginning of the Input text (0 being the first character)

    • String2 - Number of characters after the position in String1 to extract

  • Returns: A slice of characters from the input text or NULL

retrieveValueFromDelimitedList

  • Description: Extracts a specified value from a provided delimited list.

  • Use Case:

  • Expects:

    • Input - Input delimited list

    • String1 - Value used as the delimiter

    • String2 - Which element from the delimited list to return

  • Returns: An element extract from the Input list, or NULL

toUpperCase

  • Description: Converts a provided string to UPPERCASE

  • Use Case:

  • Expects:

    • Input

  • Returns: Input, in UPPERCASE