Info |
---|
The information in this document refers to functions that are available in the latest version of the RML Mapper feature. |
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
Code Block |
---|
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
Code Block |
---|
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
Code Block |
---|
fnml:functionValue [ # The object is the result of the function
rr:predicateObjectMap [
rr:predicate fno:executes ; # Execute the function
rr:objectMap [ rr:constant grel:toCamelCase ] # 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
]
] |
toKebabCase
Description: Returns as value as kebab-case
Required Parameters:
Input - Input text
Returns: Input as kebab-case
Code Block |
---|
fnml:functionValue [ # The object is the result of the function
rr:predicateObjectMap [
rr:predicate fno:executes ; # Execute the function
rr:objectMap [ rr:constant grel:toKebabCase ] # 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
]
] |
toScreamingSnakeCase
Description: Returns as value as SCREAMING_SNAKE_CASE
Required Parameters:
Input - Input text
Returns: Input as SCREAMING_SNAKE_CASE
Code Block |
---|
fnml:functionValue [ # The object is the result of the function
rr:predicateObjectMap [
rr:predicate fno:executes ; # Execute the function
rr:objectMap [ rr:constant grel:toScreamingSnakeCase ]# 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
]
] |
toSnakeCase
Description: Returns as value as snake_case
Required Parameters:
Input - Input text
Returns: Input as snake_case
Code Block |
---|
fnml:functionValue [ # The object is the result of the function
rr:predicateObjectMap [
rr:predicate fno:executes ; # Execute the function
rr:objectMap [ rr:constant grel:toSnakeCase ] # 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
]
] |
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
Code Block |
---|
fnml:functionValue [ # The object is the result of the function
rr:predicateObjectMap [
rr:predicate fno:executes ; # Execute the function
rr:objectMap [ rr:constant grel:unixEpochConverter ] # 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
] ;
rr:predicateObjectMap [
rr:predicate grel:valueParameter2 ; # Expected input type
rr:objectMap [ rr:constant "days" ] # Input value param, string constant as defined in ""
]
] |
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
Code Block |
---|
fnml:functionValue [ # The object is the result of the function
rr:predicateObjectMap [
rr:predicate fno:executes ; # Execute the function
rr:objectMap [ rr:constant grel:existsThen ] # 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
] ;
rr:predicateObjectMap [
rr:predicate grel:valueParameter2 ; # Expected input type
rr:objectMap [ rr:constant "value not null" ] # Input value param, string constant as defined in ""
]
] |
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
Code Block |
---|
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:constant "null,\N" ] # Input value param, string constant as defined in "" ] ] |
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
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:findAndReplace ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; rr:objectMap [ rr:constant "Bert,\],Venus,%20" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter3 ; rr:objectMap [ rr:constant "Bret,,Pluto, " ] ] ] |
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.
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:removeAllDoubleQuotes ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ] |
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
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:translateToISODate ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Date},6,4,"; rr:termType rr:Literal; ]; ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; rr:objectMap [ rr:template "{Date},3,2"; rr:termType rr:Literal; ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter3 ; rr:objectMap [ rr:template "{Date},0,2,"; rr:termType rr:Literal; ] ] ]; rr:datatype xsd:date; rr:termType rr:Literal; |
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
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:extractCharactersFromEnd ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; rr:objectMap [ rr:constant "0" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter3 ; rr:objectMap [ rr:constant "5" ] ] ] |
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
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:extractCharactersFromStart ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; rr:objectMap [ rr:constant "0" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter3 ; rr:objectMap [ rr:constant "5" ] ] ] |
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
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:retrieveValueFromDelimitedList ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; rr:objectMap [ rr:constant "," ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter3 ; rr:objectMap [ rr:constant "1" ] ] ] |
toUpperCase
Description: Converts a provided string to UPPERCASE
Use Case:
Expects:
Input
Returns: Input, in UPPERCASE
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:toUpperCase ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ] |
toLowerCase
Description: Converts a provided string to lowercase
Use Case:
Expects:
Input
Returns: Input, in lowercase
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:toLowerCase ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "{Name}" ] ] ] |
concat
Description: Combines 2 provided strings, into 1 string
Use Case:
Expects:
Input1
Input2
Returns: Input1Input2
Code Block |
---|
//This is unverified fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:concat ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "Part1" ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter2 ; rr:objectMap [ rr:template "Part2" ] ] ] |
random
Description: Returns a randomly generated UUID
Use Case:
Expects: None
Returns: A randomly generated UUID
Code Block |
---|
//This is unverified fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:random ] ] ] |
toUpperCaseURL
Description: Ensures that a provided string is a URL, and converts it to one if it isn’t (Prepends HTTP:// where necessary),
Use Case:
Expects:
Input
Returns: Input1 in UPPERCASE converted to a URL
Code Block |
---|
fnml:functionValue [ rr:predicateObjectMap [ rr:predicate fno:executes ; rr:objectMap [ rr:constant grel:toUpperCaseURL ] ] ; rr:predicateObjectMap [ rr:predicate grel:valueParameter ; rr:objectMap [ rr:template "http://example.com/{Name}" ] ] ] |
Default Mapper Functions
DBpedia Spotlight annotate
Returns the DBpedia URLs of the detected entities in the input text
Function IRI: http://example.com/idlab/function/dbpediaSpotlight
Label | IRI |
---|---|
input string | |
endpoint url string |
Read local file as string
Returns the content of a local file as string
Function IRI: http://example.com/idlab/function/readFile
Label | IRI |
---|---|
input path |
True condition
Returns the value if the given boolean is true, else null
Function IRI: http://example.com/idlab/function/trueCondition
Label | IRI |
---|---|
boolean encoded as string | |
input string |
decide
Returns a given value if input is equal to another given value
Function IRI: http://example.com/idlab/function/decide
Label | IRI |
---|---|
input string | |
expected input string | |
result string |
escape
Escapes a string, with a mode parameter.
Function IRI: http://users.ugent.be/~bjdmeest/function/grel.ttl#escape
getMIMEType
Returns the MIME Type of a filename
Function IRI: http://example.com/idlab/function/getMIMEType
Label | IRI |
---|---|
input string |
Label | IRI |
---|---|
input value | http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter |
listContainsElement
Returns true if the string is found in the list
Function IRI: http://example.com/idlab/function/listContainsElement
Label | IRI |
---|---|
list | |
input string |
mqlKeyUnquote
mqlKeyUnquote
Function IRI: http://users.ugent.be/~bjdmeest/function/grel.ttl#string_mqlKeyUnquote
not equal
Returns true if strings are not equal.
Function IRI: http://example.com/idlab/function/notEqual
This function does not take any arguments.
startsWith
startsWith
Function IRI: http://users.ugent.be/~bjdmeest/function/grel.ttl#string_startsWith
stringContainsOtherString
Returns true if a string is found in a delimited string.
Function IRI: http://example.com/idlab/function/stringContainsOtherString
Label | IRI |
---|---|
input string | |
other input string | |
delimiter |
toLowercase
Returns the input with all letters in lower case.
Function IRI: http://users.ugent.be/~bjdmeest/function/grel.ttl#toLowerCase
Label | IRI |
---|---|
input value | http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter |
toUppercase
Returns the input with all letters in upper case.
Function IRI: http://users.ugent.be/~bjdmeest/function/grel.ttl#toUpperCase
Label | IRI |
---|---|
input value | http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter |
toTitlecase
toTitlecase
Function IRI: http://users.ugent.be/~bjdmeest/function/grel.ttl#string_toTitlecase
Label | IRI |
---|---|
input value | http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter |
toUpperCaseURL
Returns an uppercase, valid url.
Function IRI: http://example.com/idlab/function/toUpperCaseURL
Label | IRI |
---|---|
input string |
Label | IRI |
---|---|
input value | http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter |