1.2.3
true
The optional string returned as result string if no match occurs. If this string is empty and no match occurs, then the result string is unbound.
the input string
The match expression
regex
The replacement expression
An input string is converted into a result string by applying a match and replacement expressions.
For example, the input string "semantic web" with the match expression "([A-z]+) ([A-z]+)" and the replacement expression "The $1 life" returns the string "The semantic life".
An optional input string is returned, if no match occurs. If this string is empty and no match occurs, then the result string is unbound.
Converts an input string into lower title case.
For example, "semantic web" becomes "semantic Web".
An optional matching expression can be given to only convert the matched characters.
the input string
The match expression
true
lowerTitleCase
the subject in the match triple, or an unbound variable for a wildcard
countMatches
the object in the match triple, or an unbound variable for a wildcard
the predicate in the match triple, or an unbound variable for a wildcard
Counts all occurences of a triple pattern based on subject (?arg1), predicate (?arg2) and object (?arg3) input. Any of those can be unbound variables.
Evaluates a condition and depending on the outcome either returns the true argument or the false argument. This is comparable to Java's ... ? ... : ... notation.
if
The condition that shall be evaluated. If true then return the ?arg2 argument, otherwise return ?arg3.
the result if the condition is true
the result if the condition is false
lowerCamelCase
the input string
The match expression
true
Converts an input string into lower camel case.
For example, "semantic web" becomes "semanticWeb".
An optional matching expression can be given to only convert the matched characters.
The template of the input string. This must conform to the pattern language implemented by the Java SimpleDateFormat class (http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html).
the input text
Converts a string in a semi-structured format into a xsd:date, xsd:dateTime or xsd:time literal. The input string must be in a given template format, e.g. "yyyy.MM.dd G 'at' HH:mm:ss z" for strings such as 2001.07.04 AD at 12:08:56 PDT.
parseDate
the class to get the cardinality at
maxCardinality
Gets the maximum cardinality of a property at a class. The function checks for locally defined owl:maxCardinality restrictions on the class or its superclasses. If none is found, it will check if the property is functional and, if so, return 1. Otherwise it will return null.
the property to get the cardinality of
trim
the text to trim
Creates a new string value by trimming an input string. Leading and trailing whitespaces are deleted.
buildStringFromRDFList
Builds a string from the members of a given rdf:List (?arg1). The function iterates over all members of the list (which must be well-formed according to the RDF syntax rules). For each member, a string template (?arg2) is applied where the expression {?member} will be substituted with the current member. Optionally, a separator (?arg3) can be inserted between the list members in the result string, e.g. to insert a comma.
the head of the rdf:List to convert to string
the template string
the separator to insert between each string
true
deriveURI
uri
the additional string that will be appended to the right of {?arg1}
the URI resource that constitutes the left part of the new URI
Constructs a new URI resource by concatenating a string constant {?arg2} to the URI of a given resource {?arg1}. Example:
smf:deriveURI(owl:Thing, "-Child") = owl:Thing-Child
The input string
titleCase
true
The match expression
Converts an input string to title case.
For example, "germany" becomes "Germany".
An optional matching expression can be given to only convert the matched characters.
the sub string to search for
Gets the last index of the first occurence of a certain substring in a given search string. Returns null if the substring is not found.
the string to search in
lastIndexOf
convertSPINRDFToString
true
true to embed HTML markup into the output
Converts a SPARQL query encoded in SPIN RDF format to a SPARQL string in textual form. The SPIN query must be well-formed in the context graph at execution time, and the provided argument must be the root of the expression (e.g., an instance of sp:Select).
the root of the SPIN RDF query
Creates a random xsd:double between 0 and 1.
random
the SPARQL select query string to execute
countResults
Runs an nested SPARQL query and counts its results. Note that the nested query will reuse the variable bindings from its surrounding.
definedIn
The input resource
Returns the base URI of the ontology that the input resource is defined in.
definedInFile
The input resource
Returns the workspace file path of the ontology that the input resource is defined in, if it exists.
Same as smf:buildString, but with the side effect of printing the string into the Error Log of TopBraid Composer. This can be used as an efficient debugging aid. The result of the function is the evaluated template.
the template string to print
trace
Converts an input string into upper case.
For example, "semantic web" becomes "SEMANTIC WEB".
An optional matching expression can be given to only convert the matched characters.
The input string
true
The match expression
upperCase
true
An (optional) country code such as "au" to aid the search.
Attempts to convert a textual address (?arg1) into a comma-separated pair of lat/long values. The implementation currently uses the Google API (http://code.google.com/apis/maps/documentation/geocoding/) to do the actual work.
The address as a raw string, e.g. "1600 Amphitheatre Parkway, Mountain View, CA".
geo code
The type of the duration: It can be one of: "ms", "s", "m", "h", "d", "mon", "y", "c".
The end date
duration
The begin date
Returns the duration between two dates in terms of one of the given "types". "type" is a string constant, which indicates the type of duration. It can be:
String value - Explanation
ms - milliseconds
s - seconds
m - minutes
h - hours
d - days
mon - months
y - years
c - centuries
the property to get the cardinality of
minCardinality
Gets the minimum cardinality of a property at a class. The function checks for locally defined owl:minCardinality restrictions on the class or its superclasses. If none is found, it will return null.
the class to get the minimum cardinality at
the label to get a DBpedia resource for
Attempts to get a DBPedia page for a string.
dbpedia
the end index; if not bound, use the length of text - 1
subString
Extracts a substring from an input string. This is similar to afn:substr but more robust against null values.
the start index (0 is the first character); if not bound, then the function will return null
the input string
Constructs a new URI resource by inserting the existing variable bindings into a template. The template can mention variable names in curly braces, such as "my:Instance-{?index}" would create "my:Instance-42" is ?index has the value 42. As an alternative to variable names, the function can take additional arguments after the template, the variables of which can be accessed using {?1}, {?2} etc. For example: smf:buildURI("my:Instance-{?1}-{?2}", ?day, ?month) would insert day and month at places {?1} and {?2}.
The URI template such as "<http://my.com/Instance-{?index}>". If the template contains a full URI, then it must be wrapped by <...>, otherwise the system will treat it as a qname.
buildURI
true
The match expression
the input string
camelCase
Converts an input string into camel case.
For example, "semantic web" becomes "SemanticWeb".
An optional matching expression can be given to only convert the matched characters.
buildString
Constructs a new string by inserting the existing variable bindings into a template. The template can mention variable names in curly braces, such as "Hello {?index}" would create "Hello 42" is ?index has the value 42. As an alternative to variable names, the function can take additional arguments after the template, the variables of which can be accessed using {?1}, {?2} etc. For example: smf:buildString("Hello-{?1}-{?2}", ?day, ?month) would insert day and month at places {?1} and {?2}.
the template string
hasAllObjects
an rdf:List containing the match objects
the match predicate
the match subject
Checks whether a given subject/predicate combination has all values enumerated from a given rdf:List. In other words, for each member ?object of the rdf:List, the triple (?arg1, ?arg2, ?object) must be in the model to return true. If the list is empty, true will also be returned.
the argument or variable to evaluate
isBound
Checks whether the input expression evaluates to a bound variable. This is similar to the built-in bound function of SPARQL, but bound expects a variable as argument and therefore can not be used to evaluate arbitrary nested functions.
htmlString
Converts an input string to an HTML string - i.e. special characters are converted.
the input string
currentTimeMillis
Returns the current time in milliseconds. See System.currentTimeMillis() in Java.
the text to set the language of
the language of the result literal; may be empty to delete any existing language
Creates a new string literal with a given language from an existing value. For example, smf:setLanguage("House", "en") becomes "House"@en.
setLanguage
Converts an input string into lower case.
For example, "SEMANTIC Web" becomes "semantic web".
An optional matching expression can be given to only convert the matched characters.
the input string
true
The match expression
lowerCase
The command to execute.
Executes a named system command with an optional number of arguments.
exec
prefix
qname
<
sep
:
prefix
0
The resource to get the prefix of.
Gets the prefix of a given resource (?arg1). Returns nothing if the argument is a URI that cannot be abbreviated with a prefix.
Calls another SPARQL function specified by a URI resource (?arg1), with additional arguments passed into from ?arg2 onwards. This can be used to dynamically call functions, the URI of which is now known statically. The result of the function call will be passed on as result of the invoke call.
The URI resource defining the function to call.
invoke
Evaluates the expressions starting with the first argument, and returns the first result that is bound. This can be used to implement complex if ... then ... else if ... else if ... else patterns. The implementation does lazy evaluation, i.e. the arguments will only be evaluated if needed. The function declares no arguments, but any number of arguments is allowed at run time.
first bound
the property to get the range of
Gets the local range of a property at a class. The function first checks for locally defined owl:allValuesFrom restrictions on the class or its superclasses. If none is found, it will try to use the global rdfs:range of the property. If this does not exist either, it will return null.
localRange
the class to get the local range at
true
The optional serialization format of the output. By default, it is N3. This value should be an instance of "sml:RDFSerialization" from sparqlmotionlib.owl ontology. For example: sml:RDFXML.
convertRDFToText
Converts the current RDF graph to text. Optionally the serialization of the RDF graph as text can be given. By default, the serialization is N3.
generate label
A URI resource or string literal that is used to generate a label. For URI resources, the local name will be used, the full string otherwise.
Can be used to derive a "human-readable" label from a resource URI or local name. For example, with the input ex:firstName this will return "first name". The result can then be used in the rest of the SPARQL query, e.g. to create an rdfs:label.
true
An (optional) string template, that may include any of the following special commands:
- {date} inserts the current date
- {name} inserts the generated label
- {name:lower-case} inserts the label as lower case
- {name:upper-case} inserts the label as upper case
- {name:title-case} insert the label as title case
Any other characters will be inserted as they appear.
Creates a new literal from an existing literal, but with a different datatype. This can, for example, be used to convert between floating point values and int values.
cast
the target datatype, e.g. xsd:integer
the "old" literal that shall be converted
generateUUID
Generates a new unique ID as a string literal. This is often useful for creating "random" URIs and other identifiers.
the node (literal or resource) that shall be rendered into a string
name
Gets a human-readable string representation from an RDF node. If it's a literal, the function will return the literal's lexical text. If it's a resource the system will use the rdfs:label (if exists) or otherwise use the qname.
the URI resource to get the qname of
the sub string to search for
indexOf
Gets the index of the first occurence of a certain substring in a given search string. Returns null if the substring is not found.
the string to search in
the URI to convert
Converts a given URI string to an RDF resource with that URI.
resource
Gets the qname of a resource, using the defined namespace abbreviations. In contrast to the official specs, this function will drop the : character if it's the first character in the string. If the resource does not have a suitable prefix abbreviation, the function will return the URI wrapped by <...>.
qname