Modules Overview


sml:AddUserDictionaryWord (sm:Module)

Adds a given word to the user dictionary used for spell-checking (see sml:CheckSpelling).

 
  Template Module

Arguments

sml:word (xsd:string): The word to add.

sml:AppendText (sm:Module)

Appends a given text (possibly containing template expressions, sml:template) to the value of a given variable (sml:variable) and binds the concatenation of the old value plus the new text to the same variable. This can be used to incrementally build up a string.

 
  Template Module

Arguments

sml:template (xsd:string): The (template) string to append to the variable value.
sml:variable (xsd:string): The name of the variable to append to.

sml:ApplyConstruct (sm:Module)

Runs one or more SPARQL Construct queries on the input triples. The output RDF will consist of the constructed triples and (unless sml:replace is true) the input triples.

 
  Template Module

Arguments

sml:constructQuery: The SPARQL Construct queries that deliver the triples that shall be added.
sml:replace: [Optional] If set to true, the output triples will only contain the constructed triples. If no values or false are specified, the output will be the union of the input triples and the constructed triples.

sml:ApplySHACLRules (sm:Module)

Applies the SHACL rules inference engine on the input graph. This assumes that the input graph (or, if provided, the given shapes graph) contains one or more SHACL rules. The output graph is by default the union of the input graph plus the inferred triples, unless sml:replace is set to true.

 
  Template Module

Arguments

sml:focusNode: [Optional] If specified then only those rules will be executed that are attached to shapes that target the given focus node. Only the inferences for that focus node will be produced.
sml:replace (xsd:boolean): [Optional] Specifies whether the resulting inferred triples shall replace the input. If false, the union of inferred triples and old triples are returned.
sml:shapesGraph (rdfs:Resource): [Optional] An optional shapes graph, defaults to the input graph.

sml:ApplyTopSPIN (sm:Module)

Applies the TopSPIN rules inference engine on the input graph. This assumes that the input graph contains one or more SPIN rules (stored using the property specified under sml:predicate, which defaults to spin:rule).

 
  Template Module

Arguments

sml:flatten (xsd:boolean): [Optional] If set to true, the engine will copy all input triples into a single in-memory graph, and then operate on that (faster) graph. In some cases, this option has improved performance by a factor of 8. Note that this option may not make sense if one of the input graphs is a (large) database. Setting this option to true will also lead to ignore the value of sml:replace, and only the flattened graph will be forwarded into the next steps of the script (i.e. sml:replace=true).
sml:predicate (rdf:Property): [Optional] The predicate to get the rules from. Usually spin:rule, but can be any SPIN property (subPropertyOf spin:query)
sml:replace (xsd:boolean): [Optional] Specifies whether the resulting inferred triples shall replace the input. If false, the union of inferred triples and old triples are returned. Note that this flag is not supported if sml:flatten = true.
sml:singlePass (xsd:boolean): [Optional] Specifies whether only a single pass over all rules shall be made. By default (false), TopSPIN will iterate until no further inferences have been made.

sml:AssertTrue (sm:Module)

Evaluates an ASK condition and stops the execution of the script and reports an error if the condition is false. This module is particularly useful for web services that simply cannot execute if unexpected situations are encountered. The module will simply pass through all variable bindings and RDF triples if no errors are found.

 
  Template Module

Arguments

sml:askQuery (sp:Ask): The ASK query that must return true.
sml:text (xsd:string): [Optional] the error message

sml:BindBySelect (sm:Module)

Runs a SPARQL select query and binds all result variables of the first matching result set. The input RDF is simply passed through to the next module. For example, if you run SELECT ?name ?age WHERE { my:Person my:name ?name ; my:age ?age } then the variables name and age will be bound as output variables.

 
  Template Module

Arguments

sml:selectQuery: A SPARQL Select query that is executed over the input triples. The result variables of the first result row will be bound in the succeeding modules.

sml:BindByXPath (sm:Module)

Evaluates an XPath on a given XML node (or document) and binds the first result to a given variable.

 
  Template Module

Arguments

sml:datatype (rdfs:Datatype): [Optional] The datatype of the result variable (xsd:string if left blank).
sm:outputVariable (xsd:string): The name of the variable to bind.
sml:xml: The XML document or node to operate on.
sml:xpath (xsd:string): The XPath to process.

sml:BindLiteralVariable (sm:Module)

Binds the output variable with a constant of a given datatype, or with a value derived from one or more other input variable values. The template could be as simple as {?varName} to insert the variable's value or more complex such as {?firstName} {?lastName}. This module can also be used to convert the datatype, e.g. to convert a xsd:string into a xsd:float.

 
  Template Module

Arguments

sml:datatype (rdfs:Datatype): The target datatype, e.g. xsd:string or xsd:int. Default: xsd:string.
sm:outputVariable: The name of the output variable.
sml:template: the template string

sml:BindWithConstant (sm:Module)

Binds a variable with a given RDF node.

 
  Template Module

Arguments

sm:outputVariable: The name of the variable that will hold the constant. Default: text.
sml:value: The constant value (either a resource or a literal).

sml:BranchByAsk (sm:Module)

Runs a SPARQL Ask query and, depending on the resulting boolean, either continues with the sm:if or the sm:else branch. Both branches can be sub-scripts, and the sm:if and sm:else should point to the entry points of those sub-scripts. Those entry modules will be passed the same RDF triples and variable bindings as passed to theBranchByAsk module itself. The result of the execution will be the target module (last module in the sub-script) of the selected branch. All variable bindings of the result module will also be passed on as output to the next module(s). Both branches must have exactly one target module. If a branch is empty then the module's input will be passed on unchanged.

 
  Template Module

Arguments

sml:askQuery: The SPARQL Ask query that delivers true (sm:if) or false (sm:else) to determine the branching condition.
sm:else: The start of the child script that shall be executed if the ask query evaluates to false.
sm:if: The start of the child script that shall be executed if the ask query evaluates to true.

sml:CatchExceptions (sm:Module)

Runs a sub-script (sm:body) and catches any errors (Java Exceptions) that happened within it. Normally, the SPARQLMotion engine exits on hitting any Exception, but this module provides a level of error handling. If an error occurs, then the result variable (sm:outputVariable) will contain the error message, and the result graph will be the same as the input of the module itself. Otherwise, the output graph will be the last module of the nested body script, and any variable bindings from the body will be applied to the next modules. As an option, the full stack trace can be bound to a variable as well.

 
  Template Module

Arguments

sm:body (sm:Modules): The head of the script to execute. Must have a single end module.
sm:outputVariable (xsd:string): The name of the output variable that shall hold the error message.
sml:stackTraceVariable (xsd:string): [Optional] The name of a variable that shall contain the full stack trace.

sml:CheckSpelling (sm:Module)

Runs a SPARQL select query and binds result variables for each matching result set. Strings bound to variables in the SELECT clause will be passed to a TBL spellchecker, which will parse the string into individual words and return triples representing each word from the string not in the dictionary. Each word returned is represented as an instance of the class http://topbraid.org/spellcheckresults#SpellResult with properties inputString, foundError, mispelledWords, and suggestions, all with the same prefix as SpellResult, http://topbraid.org/spellcheckresults#. The value of the suggestions property is an rdf:Bag with five suggested replacements for the word. In the checked content, terms in all upper-case such as acronyms are ignored.

The spellcheck dictionary is included with TopBraid Live (both Personal and Enterprise Server). Words can be added to the dictionary through the sml:UpdateUserWordDictionary module.

 
  Template Module

Arguments

sml:selectQuery (sp:Select): The SELECT query that delivers all the literals that shall be spell checked.

sml:CloneVariable (sm:Module)

Clones a given variable value and assigns it to a new output variable. The input variable will keep its value.

This module can be useful to "rename" an existing variable so that it has a matching name that is expected by modules downstream in the script. For example, if you have a variable ?xmlFile but a next module expects an input argument ?xml (via an argument sml:xml), then you can use sml:CloneVariable to bind ?xml with the value of ?xmlFile. Note that in many (most?) cases, you can achieve the same by using inline SPARQL expressions: in TBC use "Add SPARQL expression" from the context menu of the property name and enter an expression such as ?xmlFile at the sml:xml property.

 
  Template Module

Arguments

sml:inputVariable (xsd:string): The name of the input variable that shall be cloned.
sm:outputVariable (xsd:string): The name of the output variable that will be created.

sml:CollectGarbage (sm:Module)

Collects "garbage" to clean up memory from RDF models that are no longer used. Currently, this requires specifying the base URI of a graph that has been previously loaded. Note that the use of this module is not safe in a multi-user setting, and should only be used if you know what you are doing.

 
  Template Module

Arguments

sml:baseURI (xsd:string): The base URI of the RDF model to "forget".

sml:ConcatenateText (sm:Module)

Executes a SPARQL Select query and creates a single long text string by concatenating all result variable bindings. This can be used, for example, to create a single "fullName" value from "firstName" and "lastName" properties (in which case the order of variables in the SELECT clause is relevant. Another use case is to build a single long string from multiple property values of the same kind, e.g. to concatenate all text bodies of all RSS items in a newsfeed. The resulting text can then be further processed by text processing modules such as text miners.

 
  Template Module

Arguments

sm:outputVariable: The name of the output variable that will contain the concatenated text string. Default: text.
sml:selectQuery (sp:Select): The SPARQL Select query that will deliver the individual values that shall be concatenated.
sml:separator: [Optional] An optional separator that will be inserted between the text units.

sml:ConstructNTFile (sm:Module)

Executes a CONSTRUCT query in a streaming fashion and writes all resulting triples into a given N-Triples file. The resulting file can then be used as input to databases, e.g. using the TDB import wizard of TopBraid Composer. This module has a smaller memory foot-print than sml:ApplyConstruct, in which all constructed triples need to fit into memory.

 
  Template Module

Arguments

sml:constructQuery: The SPARQL Construct queries that deliver the triples that shall be added.
sml:replace (xsd:boolean): [Optional] True to overwrite the NT file. False to append.
sml:targetFilePath (xsd:string): The path to the target file path.

sml:ConvertDDLToRDF (sm:Module)

Converts a SQL script containing DDL statements, such as "CREATE TABLE", to RDF. The input is given as a text string. The output will use classes and properties from the EDG Data Models schema.

 
  Template Module

Arguments

sml:baseURI (rdfs:Resource): [Optional] URIs for schema elements such as tables, columns, etc. will be created from this base URI. If not present, an example URI will be used.
sml:databaseName (xsd:string): [Optional] An optional database name or catalog name that will be used as a prefix for schema elements when generating URIs and labels
sml:datatypesBaseURI (xsd:string): If specified, URIs for datatype definitions will be breated from this base URI instead of the sml:baseURI.
sml:text (xsd:string): The input SQL script
sml:withDatatypeLinks (xsd:boolean): [Optional] If true (the default), triples connecting columns to their datatypes are generated.
sml:withDatatypes (xsd:boolean): [Optional] If true (the default), datatypes are imported.
sml:withSchema (xsd:boolean): [Optional] If true (the default), schema elements such as tables and columns are imported.

sml:ConvertDatatype (sm:Module)

Replaces all triples that have a given property as predicate (specified by sml:predicate) by converting its object literals into a different RDF datatype (specified as sml:datatype).

 
  Template Module

Arguments

sml:datatype (rdfs:Datatype): The datatype (e.g. xsd:string) of the new triples. If the datatype is rdfs:Resource and the lexical form of the old value is a valid URI, then the resulting triple will point to a resource with that URI.
sml:predicate (rdf:Property): The predicate of the triples that shall be replaced.

sml:ConvertJSONToRDF (sm:Module)

Takes a JSON object or array (represented as text) and converts it to RDF triples with the same structure. The result graph will only contain the generated triples - the input graph will be ignored and may need to be passed on with a separate sm:next relationship. The graph uses the namespace prefix.

This module operates in two modes. By default it will use the "json" namespace (http://topbraid.org/json#) for properties and create blank nodes of type json:Object. However, if sml:service is set it will look for GraphQL shapes and walk them in parallel to the JSON object tree.

The conversion will start at the JSON root and does a recursive walk through of the JSON objects and arrays. Each JSON object becomes a resource. Each attribute of the JSON object is mapped into a property. In the simple case, it will pick a property from the json namespace, e.g. attribute "firstName" becomes a property json:firstName. In simple mode, the values of those properties depend on the JSON attribute value and arrays are converted to rdf:Lists, JSON objects recursively become new blank nodes. Numbers, booleans and strings become corresponding RDF literals. In GraphQL mode, the shapes define how the mapping is performed and the root node must be a JSON object.

Optionally, the module can bind a new variable pointing at the root object of the new JSON data structure in RDF. This does not work if the provided JSON string is an Array with multiple entries.

 
  Template Module

Arguments

sml:keepRootObject (xsd:boolean): [Optional] In GraphQL mode (sml:service is provided) then the root object is typically just a container derived from the Query. By default, the triples of this root object will not be kept. Set to true to keep these triples in the result graph.
sm:outputVariable (xsd:string): [Optional] The name of the result variable (defaults to "root") that will contain the root object of the converted JSON code.
sml:service (graphql:Schema): [Optional] A GraphQL service object providing information on how to map the JSON to RDF using SHACL shapes.
sml:text (xsd:string): The JSON input text, either a JSON object or array.

sml:ConvertRDFToXML (sm:Module)

Converts RDF into XML using the Semantic XML (sxml) ontology for the round-tripping. The resulting XML will be bound to the specified output variable. Note that this requires the RDF model to contain an SXML root document element - this function does not work with arbitrary RDF data! For more, see Help > Import and Export > Creating, Importing, Querying, Saving XML documents with Semantic XML.

 
  Template Module

See Also

Arguments

sml:document (sxml:Document): [Optional] The sxml:Document to use - if unspecified it will pick one found in the model, which will be unpredictable if multiple sxml:Document instances exist.
sml:fullNamespaces (xsd:boolean): [Optional] If set to true then the converter will no longer trim xmlns attributes of their / or # endings.
sml:isAttributeUnqualified: [Optional] Indicates if the attributes in the RDF are unqualified. Default is false.
sm:outputVariable: The name of the variable that will hold the resulting XML data. Default: xml.

sml:ConvertSpreadsheetToRDF (sm:Module)

Creates an RDF graph from a tab-separated spreadsheet which is specified from a given string variable. In a typical use case, this will be used after sml:ImportTextFile, which binds the variable text which is also the default input variable of this module. For very large files that cannot be loaded into memory, the module provides the option to specify a file directly using sml:sourceFilePath.

Note that TopBraid supports multiple spreadsheet importer algorithms, including Semantic Tables and the Excel cell importer (sml:ImportExcelCellInstances). This module provides the functionality that is accessible through the TopBraid Composer Spreadsheet import wizard (Help > Import > Import Tab-Delimited Spreadsheet File).

 
  Template Module

See Also

Arguments

sml:className: [Optional] The optional name of the target class. If this value is unspecified, then cell (0, 0) of the spreadsheet is used instead. This value can be a localname, a qname or a URI string. If it doesn't exist, then it is created.
sml:encoding: [Optional] The canonical name of the text encoding of the spreadsheet file. If no value for this property is given, then the default JRE encoding is used. If an encoding value is given for this property, then the spreadsheet file will be evaluated using this value. The supported encodings can be found at the website: <http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html>
sml:importToInputGraph (xsd:boolean): [Optional] If set to true, then the import will attempt to reuse properties defined in the input RDF graph for the column-to-property mapping.
sml:instancePattern: [Optional] The naming pattern for the generated instances. This can contain static characters or placeholders for columns. For example Person-%1 will create names that consist of the static string "Person-" and then the value of the first column.
sml:propertyPrefix: [Optional] The prefix that shall be used for the generated property names. Only used if no qname is specified for a column property and if a new graph is created from the spreadsheet, i.e. importToInputGraph value is false.
sml:schemaNamespace: The base namespace of the target schema.
sml:sourceFilePath: [Optional] An optional file path to the spreadsheet. If this is specified then the module will directly do streaming loading from the given file. This should make it possible to handle files of arbitrary size.
sml:text: [Optional] The spreadsheet's text that shall be converted. If sml:sourceFilePath is set then this value is ignored.
sml:useUnderscore: [Optional] If true, it replaces special characters, i.e. characters that cannot be imported by default to create a resource URI, with an underscore. If false, these characters are ignored during import.
sml:useVerbatim (xsd:boolean): [Optional] If true, it imports special characters, i.e. characters that cannot be imported by default to create a resource URI. If false, these characters are ignored during import.

sml:ConvertStringToSPINRDF (sm:Module)

Converts a SPARQL query (in textual form) to a SPIN RDF syntax resource. The resulting output graph will contain exactly the triples of the SPIN query. These triples can then be used, for example, to analyze the structure of a SPARQL query dynamically. The inverse operation can be achieved using the SPARQL function smf:convertSPINRDFToString.

 
  Template Module

Arguments

sml:text (xsd:string): the SPARQL query in textual form; with or without namespace prefixes
sml:uri: [Optional] the URI of the query to create (either xsd:string or resource)

sml:ConvertTextToRDF (sm:Module)

Converts a text in one of the RDF serializations into an RDF graph. In a typical scenario, the text would be passed into the script as external (web service) input. The result of this module is (by default) the input RDF triples plus the parsed triples, unless sml:replace is set to true.

 
  Template Module

Arguments

sml:noStringSubstitution (xsd:boolean): [Optional] True to skip the usual string templating mechanism in SPARQLMotion, e.g. {?str} will remain verbatim. This should always be used unless the content of the file is safely known in advance, or in cases where the value is {?str} from a pre-bound variable in the script.
sml:replace (xsd:boolean): [Optional] True to return only the parsed triples. Defaults to the union of the new triples and the input graph.
sml:serialization (sml:RDFSerialization): [Optional] The optional serialization format, given as an instance of sml:RDFSerialization: sml:Turtle (default), sml:RDFXML, sml:NTriple, sml:JSONLD, etc.
sml:text: The text to parse.

sml:ConvertTextToRDFList (sm:Module)

Takes a comma-separated list of URIs as input and creates an rdf:List from it which is then visible to all modules downstream. The rdf:List will be a blank node (or rdf:nil) and the provided output variable will point to it. Note that the RDF output of this module consists of the rdf:List triples only, i.e. the input triples are not passed through.
Among others, this module can be used by web services that take lists as input.

 
  Template Module

Arguments

sm:outputVariable (xsd:string): the name of the output variable that will contain the rdf:List
sml:text (xsd:string): the comma-separated list of URIs

sml:ConvertXMLByXSLT (sm:Module)

Converts an XML document into another XML document using XSLT. The source XML document is either a XML or string variable. The target XML document is a string variable. XSLT script is provided as a string.

Any property other than the expected arguments (sm:outputVariable, sml:template, sml:xml, rdfs:label, and rdf:type) can be used to specify additional parameters for the XSL transformer. The local name of the property will be the parameter name. The values must be string literals. For example, set arg:myParam to "{?myValue}" and the value of the variable ?myValue will be set as parameter "myParam".

 
  Template Module

Arguments

sm:outputVariable: The generated XML string variable. The recommended module to export or return the value of this variable is sml:ExportToXMLFile or sml:ReturnXML.
sml:template: The string variable holding the XSLT script
sml:xml: The source XML variable

sml:ConvertXMLToRDF (sm:Module)

Converts an arbitrary XML input document into an RDF graph using the Semantic XML mapping approach. The input graph of this module may contain class definitions that have sxml: declarations attached to them and these will be used for the instances. For more, see Help > Import and Export > Creating, Importing, Querying, Saving XML documents with Semantic XML.

 
  Template Module

See Also

Arguments

sml:baseURI: The base URI of the new RDF (for the creation of the new class and property names).
sml:replace (xsd:boolean): [Optional] If true then the resulting output graph will not include the input graph, i.e. only the new triples will be returned.
sml:xml: The XML document that shall be converted to RDF. To avoid character encoding issues, we strongly recommend this value to be a reference to an already parsed XML document, and not a literal. In other words, use "Add SPARQL expression" from the drop down menu and enter ?varName and do not use a string value such as {?varName}. The actual document parsing should be handled by predecessing modules such as sml:ImportXMLFromURL.
sml:xmlType (xsd:string): [Optional] An (optional) type indicator for the Semantic XML conversion. Current supported values are "XHTML" (treats the input as HTML source, and may run a tidy algorithm in case the HTML is not well-formed XHTML).

sml:CopyFile (sm:Module)

Creates a copy of a given file within the workspace.

 
  Template Module

Arguments

sml:newFilePath (xsd:string): The path for the target file.
sml:oldFilePath (xsd:string): The path to the source file.

sml:CreateMatrix (sm:Module)

Creates a matrix (spreadsheet) and binds it as a text value to a given output variable.

The rows and columns of the matrix are specified by two SPARQL queries. These queries must deliver variable bindings to enumerate the resources that shall be used as rows and columns. The cell values are then computed using a third query (cellQuery) that should reference the bound variable names from the row and column queries.

 
  Template Module

Arguments

sml:cellQuery: A SPARQL Select query that is executed for each cell in the matrix. The query should reference the result variables of column and row queries (these will be bound automatically by the engine).
sml:columnQuery: A SPARQL Select query that delivers the resources or literals that define the columns. The query should have a single result variable, and this variable should be used in the cell query.
sm:outputVariable: The variable that will contain the resulting matrix as an xsd:string literal. Default: text.
sml:rowQuery: A SPARQL Select query that delivers the resources or literals that define the rows. The query should have a single result variable, and this variable should be used in the cell query.

sml:CreateSPINResultSet (sm:Module)

Converts the result set of a given SPARQL SELECT query (sml:selectQuery) to an SPIN result set (SPR table resource). The resulting resource can then be queried using the SPR functions. The output graph of this module contains only table triples.

 
  Template Module

See Also

Arguments

sm:outputVariable (xsd:string): The name of the output variable that will point to the new spr:Table resource.
sml:selectQuery: The SELECT query to evaluate.

sml:CreateSWPDocument (sm:Module)

Evaluates a given SWP document (sml:view) and assigns the resulting document to a given string variable (sm:outputVariable). The new variable can then be saved to a file or processed otherwise. All incoming variables of this SM module will be bound in the SWP expression.

Note that in order to insert an SWP view for a given resource (using ui:instanceView etc), you can use the snippet <ui:resourceView ui:resource="{= ?varName }" />.

Also note that in order to use HTML or SVG tags in the sml:view, you will need to import the html.ttl or svg.ttl from the SWP ontologies into the script.

 
  Template Module

Arguments

sm:outputVariable (xsd:string): The name of the output variable that will contain the resulting document (as a string).
sml:snippet (xsd:boolean): [Optional] True to only create a UISPIN snippet, e.g. without head/body.
sml:view (ui:Node): The UISPIN snippet to evaluate.

sml:CreateSpreadsheet (sm:Module)

Creates a spreadsheet text from all bindings of a SPARQL SELECT query. The resulting text will be bound to a variable and can then be saved to a file or further processed.

 
  Template Module

Arguments

sm:outputVariable: The name of the variable that will hold the resulting spreadsheet string. Default: text.
sml:selectQuery (sp:Select): The SPARQL Select query that delivers the rows of the spreadsheet. The columns will be the result variables of the query.
sml:separator (xsd:string): [Optional] The separator between each column. Default is the tab character, but a typical alternative is ",".

sml:CreateTDB (sm:Module)

Create a new TDB graph from the input RDF triples to a given Jena TDB database. Also loads and registers the new graph.

 
  Template Module

Arguments

sml:baseURI (xsd:string): The base URI for the TDB repository.
sml:replace (xsd:boolean): [Optional] True to overwrite any pre-existing database at this location.
sml:targetFilePath (xsd:string): The path to the TDB database.

sml:CreateWekaClassifier (sm:Module)

Creates a new Weka classifier (based on a shape definition) that is trained using the focus nodes of the shape and which can be used to "classify" the values of a given new instance using smf:wekaClassify.

After successful completion, the following modules can access the following output variables (in nested children when used from SWP):
- nodeExpressionTTL (xsd:string): the Turtle source code of a SHACL node expression representing the rule (decision tree). The root of that is the (only) node that has no incoming references.
- nodeExpressionError (xsd:string): an unexpected error that happened while the node expression was generated. Either this or nodeExpressionTTL are bound.

 
  Template Module

Arguments

sml:key (xsd:string): The identifier under which the resulting classifier can be accessed later.
sml:maxInstanceCount (xsd:integer): [Optional] The maximum number of instances to use as training data.
sml:path (xsd:string): [Optional] A string representation of the rdf:Property or property path that shall be classified, i.e. for which the classifier can suggest values. This must be exactly in the same syntax as the path string in the shape, e.g. needs to use the same prefixes for abbreviated property URIs. This can only be used for property paths that are marked as sh:maxCount 1 in the shape, because these are the only ones that are mapped to a single attribute in Weka. Either sml:path or sml:predicate must be given.
sml:predicate (rdf:Property): [Optional] The target predicate. Either this or sml:path must be given.
sml:shape (sh:NodeShape): The shape holding the definition of the properties and paths to define the attributes for weka. Use sh:maxCount 1 where possible.
sml:validate (xsd:boolean): [Optional] True to only use instances that conform to the constraints from the shape. Defaults to false (faster).

sml:DeleteFile (sm:Module)

 
  Template Module

Arguments

sml:filePath (xsd:string): The file to delete.

sml:DeleteSampleData (sm:Module)

Deletes sample data extracted by a JDBC schema import.

 
  Template Module

Arguments

sml:baseURI (xsd:string):
sml:sampleCount (xsd:integer):

sml:DeleteWekaClassifier (sm:Module)

Deletes a Weka classifier from the Maui server. This should be called whenever the classifiers produced by sml:CreateWekaClassifier are no longer needed.

 
  Template Module

Arguments

sml:key (xsd:string): The identifier under which the resulting classifier was created.

sml:Diff (sm:Module)

This module exposes the functionality known from TopBraid Composer under Model > Compare current RDF Model with... It returns a diff graph between an old graph and a new graph. This module is related to the old graph with sml:oldGraph and the new graph with sml:newGraph properties. The output is a collection of instances from the http://topbraid.org/diff namespace.

 
  Template Module

Arguments

sml:ignoreBlankNodes (xsd:boolean): [Optional] True to bypass comparison of blank nodes - which may take up a lot of time.
sml:newGraph (sm:Modules): The module representing the new graph. Must be a predecessor of the current module to ensure that the module has been executed before.
sml:oldGraph (sm:Modules): The module representing the old graph. Must be a predecessor of the current module to ensure that the module has been executed before.

sml:ExportToJMS (sm:Module)

Exports a string to a JMS queue. The text to export must be specified as value of the argument sml:text.

 
  Template Module

Arguments

sml:className (xsd:string): Fully qualified class name of JNDI Initial Context Factory for the JMS Queue.
sml:jmsConnectionFactory (xsd:string): [Optional] Connection Factory name for the JMS Queue
sml:jmsDestination (xsd:string): The name of the JMS queue to send the message to.
sml:text (xsd:string): The text to be submitted to the JMS queue.
sml:url (xsd:string): The URL of the JMS broker.
sml:userName (xsd:string): [Optional] JMS broker username.

sml:ExportToRDFFile (sm:Module)

Creates a new RDF file at the specified path inside the workspace and with the specified base URI. The serialization is derived from the file name according to TopBraid's conventions, e.g. files ending with .ttl will be written in Turtle format.

Note that if an existing file is overwritten (with matching base URI), and the graph of this file has already been loaded, then the system will not reload the new graph. I.e. if the URI specified in sml:baseURI is the same baseURI of a graph currently open in TBC or TBL, the old graph will remain open and the export will only have an effect after closing the other copies. A consequence of this is that you cannot overwrite a file and reload its new content within the same session, e.g. sml:ImportRDFFromWorkspace will still deliver the old graph. In order to modify an existing graph, the recommended approach is to use sml:PerformUpdate.

 
  Template Module

Arguments

sml:baseURI: The base URI under which the resulting file will be registered in the workspace.
sml:targetFilePath: [Optional] The path of the file to create. The path can be relative to the current script's folder (e.g., myFolder/test.rdf) or absolute to the workspace root /myProject/myFolder/test.rdf. Can be left blank if the base URI already has a representation in the workspace. In that case, the primary file in the workspace will be overwritten.

sml:ExportToSDB (sm:Module)

Writes the input triples to a specified Jena SDB database.

Note: This is a low-level system module. The preferred way of writing to databases is using sml:PerformUpdate.

 
  Template Module

Arguments

sml:baseURI (xsd:string): The base URI of the target SDB database. This will serve as a unique identifier of the triple store in TopBraid, and is typically also represented by an owl:Ontology.
sml:createGraph (xsd:boolean): [Optional] If set to true the exported graph will be output from the module. Otherwise the output graph remains unchanged from the input.
sml:databaseType (sml:DatabaseType): The database type, e.g. Oracle.
sml:graphName (xsd:string): [Optional] the named graph URI
sml:initialize (xsd:boolean): Indicates that the SDB database shall be initialized.
sml:password (xsd:string): [Optional] The password to log in with. Can be left empty if the built-in security mechanism (of Eclipse) shall be used.
sml:replace (xsd:boolean): Indicates whether all existing content of the SDB shall be overwritten.
sml:targetFilePath (xsd:string): [Optional] The (optional) path to a .sdb file that can later be opened from within TopBraid.
sml:url (xsd:string): The URL of the database.
sml:userName (xsd:string): [Optional] The user name to log in with.

sml:ExportToTDB (sm:Module)

Export the input RDF triples to a given Jena TDB database.

Note: This is a low-level system module. The preferred way of writing to databases is using sml:PerformUpdate.

 
  Template Module

Arguments

sml:baseURI (xsd:string): The base URI for the TDB repository.
sml:createGraph (xsd:boolean): [Optional] If set to true the exported graph will be output from the module. Otherwise the output graph remains unchanged from the input.
sml:replace (xsd:boolean): [Optional] True to overwrite any pre-existing database at this location.
sml:targetFilePath (xsd:string): The path to the TDB database.

sml:ExportToTextFile (sm:Module)

Saves text to a file. The text must be the value of the specified input variable.

 
  Template Module

Arguments

sml:encoding (xsd:string): [Optional] The file encoding such as UTF-8. If left blank, then the platform's default encoding will be used.
sml:replace (xsd:boolean): [Optional] Specifies whether this will overwrite a file with the same name (true) or whether it will append to an existing file (false).
sml:targetFilePath: The path to the file that shall be created. The path can be relative to the current script's folder (e.g., myFolder/test.txt) or absolute to the workspace root /myProject/myFolder/test.txt.
sml:text: The text that shall be written into the file.

sml:ExportToXMLFile (sm:Module)

Creates an XML file from the value of the input variable.

 
  Template Module

Arguments

sml:targetFilePath: The path to the output file. The path can be relative to the current script's folder (e.g., myFolder/test.xml) or absolute to the workspace root /myProject/myFolder/test.xml.
sml:xml: The XML document that shall be written to the file.

sml:ExportToZIPFile (sm:Module)

Saves files in sourceFilePath to a zip file in targetFilePath.

 
  Template Module

Arguments

sml:sourceFilePath (xsd:string): The sourceFilePath can be relative to the current script's folder (e.g. pathDir/data). Or it can be multiple absolute or relative workspace paths separated by comma. (e.g. /myProject/myFolder/data, pathDir/data)
sml:targetFilePath (xsd:string): The path to the file that shall be created. The path can be relative to the current script's folder (e.g. test.zip) or absolute to the workspace root (e.g. /myProject/myFolder/test.zip).

sml:ExtractJDBCSchema (sm:Module)

Creates a JDBC connection to the specifed database to extract schema. The output will use classes and properties from the EDG Data Models schema.

 
  Template Module

Arguments

sml:baseURI (rdfs:Resource): [Optional] URIs for schema elements such as tables, columns, etc. will be created from this base URI. If not present, an example URI will be used.
sml:databaseName (xsd:string): [Optional] An optional database name or catalog name that will be used as a prefix for schema elements when generating URIs and labels
sml:datatypesBaseURI (xsd:string): If specified, URIs for datatype definitions will be breated from this base URI instead of the sml:baseURI.
sml:password (xsd:string):
sml:sampleCount (xsd:integer): [Optional] The number of sample rows to be stored for profile
sml:url (xsd:string):
sml:userName (xsd:string):
sml:withDatatypeLinks (xsd:boolean): [Optional] If true (the default), triples connecting columns to their datatypes are generated.
sml:withDatatypes (xsd:boolean): [Optional] If true (the default), datatypes are imported.
sml:withSamples (xsd:boolean): [Optional]
sml:withSchema (xsd:boolean): [Optional] If true (the default), schema elements such as tables and columns are imported.
sml:withStats (xsd:boolean): [Optional]

sml:FilterByConstruct (sm:Module)

Uses SPARQL CONSTRUCT queries to enumerate triples that shall be dropped from the input triple stream. The output triples of this module contain all input triples except those enumerated by the construct query. For example, if you want to drop all rdfs:comment triples from the input graph, then use a query such as CONSTRUCT {?s rdfs:comment ?o} WHERE {?s rdfs:comment ?o}.

 
  Template Module

Arguments

sml:constructQuery: A SPARQL Construct query delivering the triples that shall be dropped.

sml:FilterByFilterGraph (sm:Module)

Filters input graphs with filter graphs. This module is linked to filter graph modules by sml:filterGraph property.

 
  Template Module

Arguments

sml:filterGraph (sm:Modules): The module that contains the triples that shall be filtered out. Must be one of the predecessors of this module, to make sure that it has been executed before.

sml:GenerateRandomData (sm:Module)

Generates random instances of classes as defined by the input triples using the datagen namespace (TopBraid/SHACL/datagen.ttl). The output graph of the module is the graph containing the generated triples.

 
  Template Module

Arguments

sml:namespace (xsd:string): [Optional] The default namespace to use for newly created instances.
sml:replaceInvalidValues (xsd:boolean): [Optional] True to post-process the values of the generated properties using SHACL, attempting to replace values that violate constraints. Activating this feature may cause significant performance degradation.
sml:targetGraph (rdfs:Resource): [Optional] An optional target graph to write the triples to. If unspecified, the new triples will be added into a newly created in-memory graph.

sml:GenerateReport (sm:Module)

Generates a report for a given focus node or the whole input graph. This module provides access to an extension mechanism of TopBraid, including a growing number of individual result generators. Each of these result generators has a unique ID that can be used by this module to select which generators to execute. The output graph of this module is a new graph consisting of the union of all individual results. The results are represented by subclasses of sh:AbstractResult.

 
  Template Module

Arguments

sml:focusNode: [Optional] An optional focus node. If specified then only results related to that focus node will be produced.
sml:ids (xsd:string): [Optional] A comma-separated list of IDs of individual result generators that shall be executed. By default, all generators are called (unless they are marked "passive" in their Java implementation). If IDs are provided then only those are executed (passive or not).
sml:ignoreImports (xsd:boolean): [Optional] True to only run this on resources that appear as subject in a triple from the base graph. In other words, focus nodes defined only in imported graphs will be skipped.
sml:result (rdfs:Resource): The resource that shall hold the sh:result triples in the results graph.

sml:ImportAndSplitTextFile (sm:Module)

Performs a streaming load over a text file and iterates over a selection of segments (divided by a given separator) inside of that text file. The body of this module will be executed for each matching segment, and the variable ?segment will be bound in each iteration.

This module uses the magic property smf:splitTextfile for the bulk of the work, and you can also use that magic property for finer-grained control of the iteration.

 
  Template Module

Arguments

sm:body: The body script of the template. Will be executed for each row of the result set.
arg:divider (xsd:string): The string dividing the segments in the text file, for example "," for comma-separated snippets.
arg:endIndex (xsd:integer): [Optional] The segment index to end with (first matching segment has index 1).
arg:sourceFilePath (xsd:string): The absolute path to the text file in the workspace (e.g., /myProject/myFolder/test.txt).
arg:startIndex (xsd:integer): [Optional] The segment index to start with (first matching segment has index 1).

sml:ImportCurrentRDF (sm:Module)

Depending on the context, this module delivers different results.

When called from TBC, this will return the RDF graph of the currently open file. In many use cases this will include the script itself, unless the script is a background service such as an sml:TrackChanges script.

When called from a user-defined SPARQLMotion/SPIN Function, this module will return the context graph, which is the graph that the surrounding SPARQL query will currently operate on.

When called as a TopBraid Live (stand-alone) web service, this module will throw an exception because there is no current graph available.

 
  Template Module

sml:ImportDirectoryWithTika (sm:Module)

Each file in the specified directory (and sub-directories if 'recursive' is true) is parsed with Apache Tika. The path can be an absolute path in the workspace, an absolute path in the general file system, or a relative path in relation to the script's location. A graph is generated from the results in the namespace 'http://topbraid.org/document#'. This graph will contain all available metadata, and all parseable text.

 
  Template Module

Arguments

sml:html (xsd:boolean): [Optional] If set to true, attempt to extract content as HTML markup instead of plain text.
sml:path (xsd:string): The source path.
sml:recursive (xsd:boolean): [Optional] True to walk the path recursively.

sml:ImportExcelCellInstances (sm:Module)

Loads an Excel file into instances of the TopBraid spreadsheets ontology - each non-empty cell becomes an instance of ss:Cell. In a typical scenario, the resulting cell instances are passed into other modules (such as sml:ApplyConstruct) to convert the raw data into a more useful format. This module provides the functionality that is accessible from TBC, as described in Help > Import > Import Excel File into Spreadsheet Ontology.

This module is distinct from the Semantic Tables importer, which can be used with sml:ImportRDFFormWorkspace to also import Excel files. The latter is better suited for spreadsheets consisting of regular tables, while this module here is optimized for cases in which the Excel file is not well-structured and each individual cell has a different meaning or role.

 
  Template Module

See Also

Arguments

sml:sourceFilePath (xsd:string): The path to the Excel source file in the workspace. The path can be relative to the current script's folder (e.g., myFolder/test.xls) or absolute to the workspace root /myProject/myFolder/test.xls.

sml:ImportFileFromURL (sm:Module)

Downloads any file from a given URL and saves it to a location indicated by the targetFilePath argument. The destination directory is created if it does not exist. If the destination file exists, then this method will overwrite it.

 
  Template Module

Arguments

sml:targetFilePath (xsd:string): The path the file will be downloaded to
sml:url (xsd:string): The URL to download the file from

sml:ImportFileWithTika (sm:Module)

Imports a document from a workspace file (sourceFilePath) or from the web (sourceURL), and parses it with Apache Tika. The output graph will contain all available metadata, and all parseable text.

 
  Template Module

Arguments

sml:html (xsd:boolean): [Optional] If set to true, attempt to extract content as HTML markup instead of plain text.
sml:overrideFileName (xsd:string): [Optional] An optional file name that Tika may use to determine what parser to use, etc.
sml:resultURI: [Optional] The URI to use for the document in the output graph. If unspecified, the sourceURL or a file:/// URI representing sourceFilePath will be used.
sml:sourceFilePath (xsd:string): [Optional] The file to be imported. The path can be an absolute path in the workspace, or a relative path in relation to the script's location.
sml:sourceURL: [Optional]

sml:ImportJSONFromGraphQLService (sm:Module)

Executes a GraphQL query against a given service, possibly including variable bindings. The resulting JSON is then bound to a variable downstream.

 
  Template Module

Arguments

sml:arguments (xsd:string): [Optional] A JSON object with name-value pairs for the arguments.
sm:outputVariable (xsd:string): [Optional] The name of the output variable, defaulting to "json".
sml:password (xsd:string): [Optional] The password to use for authentication - leave empty to rely on the password stored in secure storage. Only used if sml:userName is set.
sml:query (xsd:string): The GraphQL query string.
sml:url (xsd:string): The URL of the GraphQL service.
sml:userName (xsd:string): [Optional] The user name for authentication.

sml:ImportRDFFromURL (sm:Module)

Gets RDF data from a given URL. The URL may just point to an RDF file on the web, or call a web service with REST-style parameters to receive RDF back. No other format beside RDF/XML or Turtle is supported by this module - use sml:ImportRDFFromWorkspace for other file types.

 
  Template Module

Arguments

sml:password (xsd:string): [Optional] Password for basic authentication, if specified this module will make a BASIC auth HTTP call to the server
sml:serialization (sml:RDFSerialization): [Optional] The serialization type expected from the server. Defaults to RDF/XML if not specified.
sml:url: The URL of the RDF source. May contain variable bindings such as {?varName}.
sml:userName (xsd:string): [Optional] User name for BASIC Authentication, if specified this module will make a BASIC auth HTTP call to the server

sml:ImportRDFFromWorkspace (sm:Module)

Loads an RDF file from the workspace, based on its base URI (or a path to the file). If the file is already open, it will reuse the currently open model (including any changes that it has compared to the persistent version). The system will use which ever physical file has been registered for the given base URI. This is the recommended module to load any file type supported by TopBraid, including file serializations (Turtle, RDF/XML and N-TRIPLE), data connectors, XML files (Semantic XML), Excel .xls or .xlsx files (Semantic Tables), etc. If the file being opened is a file, the file is loaded into memory. If it is a data connector (RDF or relational back-end), the data source is opened, but no data is loaded into memory. The output graph of this module is the loaded graph only, i.e. other input modules are not passed on.

 
  Template Module

Arguments

sml:baseURI (xsd:string): [Optional] The (optional) base URI of the model to open. Either this baseURI must be specified or the sourceFilePath. If both are present then the baseURI has priority.
sml:ignoreImports (xsd:boolean): [Optional] Indicates whether owl:imports shall be ignored. If false, then the union of the base graph plus its (transitive) imports will be returned.
sml:sourceFilePath (xsd:string): [Optional] An (optional) file path pointing to the file that shall be opened. The system will look up the base URI of that file and then open that base URI. This means that if the workspace contains multiple copies of that base URI then it may actually load a different file than the one specified here (it will always use the primary file).

sml:ImportSDB (sm:Module)

Connects to an existing Jena SDB database.

Note: This is a low-level system module. The preferred way of operating on existing SDBs is using sml:ImportRDFFromWorkspace.

 
  Template Module

Arguments

sml:databaseType (sml:DatabaseType): The database type, such as Oracle.
sml:graphName (xsd:string): [Optional] the named graph URI
sml:password (xsd:string): [Optional] The password of the connection. Can be left empty if the built-in security mechanism (of Eclipse) shall be used.
sml:url (xsd:string): The database URL.
sml:userName (xsd:string): [Optional] The user name of the connection.

sml:ImportSystemTriples (sm:Module)

Imports the RDF Schema and OWL system triples, including the definitions of owl:Class, rdf:type, rdfs:label, rdfs:seeAlso etc. An example use case where this is needed is if you want to query for the rdfs:label of any property including system properties. Another use case is if you want to walk the class hierarchy (using rdfs:subClassOf) including metaclasses and other system classes.

 
  Template Module

sml:ImportTDB (sm:Module)

Opens a Jena TDB database stored in the workspace at a given path.

Note: This is a low-level system module. The preferred way of operating on existing TDBs is using sml:ImportRDFFromWorkspace.

 
  Template Module

Arguments

sml:dataPath (xsd:string): The path to the TBD data files. This is usually the .tdb connector file name plus .data.

sml:ImportTextFile (sm:Module)

Imports a text file into the xsd:string variable sm:outputVariable.

 
  Template Module

Arguments

sml:encoding (xsd:string): [Optional] The file encoding such as UTF-8. If left blank, then the platform's default encoding will be used.
sm:outputVariable (xsd:string): The name of the variable that will contain the text of the file as an xsd:string literal. Default: text.
sml:sourceFilePath (xsd:string): The path to a text file. The path can be relative to the current script's folder (e.g., myFolder/test.txt) or absolute to the workspace root /myProject/myFolder/test.txt.

sml:ImportTextFromURL (sm:Module)

Imports a text stream from a URL and writes the result string into a given output variable. Among others, this module can be used to read JSON from REST-based web services.

 
  Template Module

Arguments

sm:outputVariable (xsd:string): The output variable to contain the text.
sml:password (xsd:string): [Optional]
sml:securePasswordURL (xsd:string): [Optional] If this argument has a value and no sml:password has been provided then the system will look for a secure storage password for the given user name/URL combination.
sml:url (xsd:string): The URL to load from.
sml:userName (xsd:string): [Optional]

sml:ImportXHTML (sm:Module)

Opens an HTML document from a URI, using Tidy to convert it to XHTML (XML). The url must point to the URL of the file. The URL may contain variables from the input modules. The resulting XML will be assigned to the specified output variable.

 
  Template Module

Arguments

sm:outputVariable: The name of the variable that will contain the XHTML as an XML document. Default: xml.
sml:url: The URL of the HTML page. May contain variables such as {?varName}.

sml:ImportXMLFile (sm:Module)

Loads an XML file, specified by a file path and binds the resulting document as an XML DOM tree to the specified output variable. This module is often the starting point of XML processing steps such as XSLT transformations or XPath queries.

 
  Template Module

See Also

Arguments

sml:ignoreDoctype (xsd:boolean): [Optional] An (optional) indicator to ignore the XML document type. This will allow for opening documents offline where the DTD or schema may not be available.
sm:outputVariable (xsd:string): The name of the variable containing the XML data. Default: xml.
sml:sourceFilePath (xsd:string): The path to the XML file in the workspace. The path can be relative to the current script's folder (e.g., myFolder/test.xml) or absolute to the workspace root /myProject/myFolder/test.xml.

sml:ImportXMLFromURL (sm:Module)

Gets XML from a given URL and binds the resulting XML document to a specified output variable. Note that this could either be used to load static XML files from the web, or to call web services that return XML.

 
  Template Module

Arguments

sml:ignoreDoctype (xsd:boolean): [Optional] An (optional) indicator to ignore the XML document type. This will allow for opening documents where the DTD or schema may not be available.
sm:outputVariable: The output variable that will hold the loaded XML. Default: xml.
sml:password (xsd:string): [Optional] The password if using BASIC authentication. If specified this module will attempt to make an HTTP basic auth call before pulling the XML from the source. Leave empty if calling a server without authentication.
sml:url: The URL to the XML file. May contain variables such as {?varName}.
sml:userName (xsd:string): [Optional] The username if using BASIC authentication. If specified this module will attempt to make an HTTP basic auth call before pulling the XML from the source. Leave empty if calling a server without authentication.

sml:IterateOverArguments (sm:Module)

In scripts that are called as web service, this module can be used to iterate over all arguments of the web service. In each iteration, the body will be executed with two variable bindings: the argument name (?argName) and argument value (?argValue), both as xsd:string literals. The result of the module itself will be the union of the results of all body iterations, comparable to sml:IterateOverSelect. In a typical scenario, the body would consist of sml:ApplyConstruct modules that turn the raw arguments into some more meaningful data structure, that is then further processed by the rest of the script.

 
  Template Module

Arguments

sm:body: The body to execute with the two variable bindings (?argName and ?argValue).

sml:IterateOverSQL (sm:Module)

Repeats a given sub-script for each matching result set of a given SQL Select query. The system will do a mapping of SQL values to suitable XSD datatypes.

The start of the sub-script is specified by the body property, and the input RDF of the body is the same as the input of the iteration module itself. The result variables of the Select query will be bound in each iteration of the loop.

The result of this module are the accumulated triples from the end nodes of the body scripts. No internal variable bindings of the body will be used outside of the body.

 
  Template Module

Arguments

sm:body: The body of the iteration loop.
sml:databaseType (sml:DatabaseType): The type of the database.
sml:password (xsd:string): [Optional] The (optional) password to log into the database. Can be left empty if the built-in security storage mechanism (of Eclipse/Equinox) shall be used.
sml:sql (xsd:string): The SQL SELECT query to send to the database.
sml:url (xsd:string): The URL of the database.
sml:userName (xsd:string): [Optional] The user name for the database.

sml:IterateOverSelect (sm:Module)

Repeats a given sub-script for each matching result set for the SPARQL Select query in the module's selectQuery property.

The start of the sub-script is specified by the body property. There can only be one body property that invokes a single sub-script. The sub-script must have one target module -- that is, the sub-script cannot have multiple termination points.

The input RDF for each iteration is the same as the input of the iteration module itself. The result variables of the Select query will be bound inside the body in each iteration of the sub-script. Also, if the sml:IterateOverSelect module itself receives input variable bindings, and the value of these variables are changed inside the body sub-script (e.g. using sml:AppendText or sml:BindLiteralVariable), then the end value of each iteration will be used in the sub-script itself, and thus also passed into the next iteration's body. This allows scripts to incrementally modify variables. The property sml:iterationVariable can be used to name a variable that will keep an iteration count.

The result of this module are the accumulated triples from the end node of the body sub-script. No internal variable bindings of the body will be used outside of the body, unless they have had values before (see above).

In many cases, a better alternative to creating "loops" is to use SPARQL directly, and embed some of the control logic into the WHERE clause, possibly through a CONSTRUCT or UPDATE query.

It is possible to run the iterations in separate threads, e.g. to reduce the amount of time spent waiting on external network resources. This mode, activated by setting sml:maxThreadCount > 2, has some limitations (see description of sml:maxThreadCount) and should be considered by experienced users only.

 
  Template Module

Arguments

sm:body: The body of the iteration loop.
sml:iterationVariable (xsd:string): [Optional] The name of a variable which will contain the iteration index in each loop, starting with 0.
sml:maxThreadCount (xsd:integer): [Optional] Can be used to have the engine execute multiple iterations in parallel threads. The values should be between 2 and a reasonable max value such as 10. If set > 1, the engine will spawn off a new thread for each iteration. Note that some features of SPARQLMotion may not be available in this mode, and that care should be taken when using this feature. In particular, sml:ImportCurrentRDF (when used from TBE) will not work.
sml:selectQuery: A SPARQL Select query that determines the variable bindings for the body in each iteration.

sml:IterateOverXPath (sm:Module)

Evaluates an XPath on a given XML document (or node) and executes a given body for each binding. The outputVariable will be bound in each iteration of the loop, bound to the XML node. The main use case of this module is in combination with sml:BindByXPath: IterateOverXPath walks through a list of top-level nodes and sml:BindByXPath is then used to extract individual values in each iteration.

 
  Template Module

Arguments

sm:body: The body to execute in each iteration.
sm:outputVariable (xsd:string): The name of the variable that will be bound in each iteration.
sml:xml: The XML node (document or element) to operate on.
sml:xpath (xsd:string): The XPath to evaluate.

sml:IterateWhile (sm:Module)

Repeats a sub-script (specified as body) as long as a SPARQL ASK query returns true. The output of each iteration is the input to the next. The output of the whole module is the result of the last iteration. No variable bindings are passed into or out of the body.

 
  Template Module

Arguments

sml:askQuery: An ASK query that is executed prior to each iteration. If the query returns false, the iteration stops and the most recent result graph will be returned.
sm:body: The start of the script that shall be executed as body in each iteration. The body must end with a single target module.

sml:Merge (sm:Module)

This module type can be used to merge the variables and RDF triples from multiple input modules. The same is done by any other SPARQLMotion script that has multiple input modules. So while the sml:Merge module basically does not do anything at all, it can be useful to create a clean structure in your script, particularly if you have a case when you want to merge multiple graphs and then have multiple outgoing sm:next links from the merged graph.

 
  Template Module

sml:ModifyPrefixes (sm:Module)

Can be used to add or delete namespace prefix declarations from the input RDF stream so that these new prefixes are visible down stream of this module.

 
  Template Module

Arguments

sml:addedPrefix: Namespaces to add, in the format "prefix namespace", i.e. the prefix must be followed by a space. Example: "my http://my.com#".
sml:deletedPrefix: The prefix(es) to delete, e.g. "my".

sml:PerformUpdate (sm:Module)

Performs a SPARQL UPDATE call to insert and/or delete triples. This module differs from sml:ApplyConstruct (and other module types) by making persistent changes when the script runs. Therefore this module should be used carefully.

The default graph of the WHERE clause is the input graph of the module, i.e. the result of its predecessors. However, these cannot be modified using INSERT or DELETE. Instead, a named graph needs to be provided there, e.g. using the GRAPH keyword in the INSERT or DELETE clauses.

Only one instance of sml:updateQuery will be executed. For multiple SPARQL UPDATE statements use multiple PerformUpdate instances.

EVN/EDG users note that performing an update on a graph under teamwork control (urn:x-evn-...) does not execute EVN-specific side effects: no edit rules will fire and no change history entry may be created. You should always use ui:update in conjunction with sml:CreateSWPDocument to modify such graphs.

 
  Template Module

Arguments

sml:updateQuery (sp:Update): The SPARQL 1.1 UPDATE request to perform. Only one instance of this property will be executed.

sml:PostRequest (sm:Module)

Sends a POST request to a web server and binds the result stream with the outputVariable. The request will include variable bindings for all non-system properties of this module. For example, you can set arg:test to some value that will be mapped to the name-value-pair \"test\". The recommended way of doing this is to subclass the sml:PostRequest class and declare the additional arguments as spin:constraints. The user is allowed to send either the arguments or the content through the variable sml:content. If a variable starts with "httpHeader_" then the value will be used as HTTP request header with the partial name after the _.

 
  Template Module

Arguments

sml:content (xsd:string): [Optional] The content to send.
sml:contentType (xsd:string): [Optional] The type of the content to be sent.
sml:encoding (xsd:string): [Optional] The file encoding such as UTF-8. If left blank, the HTTP default (ISO-8859-1) will be used.
sm:outputVariable (xsd:string): The name of the output variable to bind the result with.
sml:password (xsd:string): [Optional] The password to use for authentication - leave empty to rely on the password stored in secure storage. Only used if sml:userName is set.
sml:url (xsd:string): The URL to post to.
sml:userName (xsd:string): [Optional] The user name for authentication.

sml:RefreshWorkspace (sm:Module)

Refreshes the TopBraid workspace so that changes to files made outside of TopBraid's control become known to the system, and all registries are updated. This is a low-level operation that should be used with care, ideally when no other processes are running.

 
  Template Module

sml:ReleaseLock (sm:Module)

Releases any exclusive system lock that was identified by the URI given as an argument and received previously using sml:RequestLock.

 
  Template Module

See Also

Arguments

sml:uri: the lock URI (either xsd:string or resource)

sml:RemoveUserDictionaryWord (sm:Module)

Removed a given word from the user dictionary used for spell-checking (see sml:CheckSpelling).

 
  Template Module

Arguments

sml:word (xsd:string): The word to remove.

sml:RenameFile (sm:Module)

 
  Template Module

Arguments

sml:filePath (xsd:string): The path to the file that shall be renamed.
sml:newFileName (xsd:string): The new name of the file (excluding the path).

sml:RenameResources (sm:Module)

"Renames" a given set of resources so that all the triples they appear in are changed to a use a different URI to downstream modules. Old and new resources are specified by a SELECT query that has two result variables: "old" (the resources to rename) and "new" to specify a new URI (either as a literal or URI resource).

Note that this module does not change the actual input graph, but only installs a filter above it. This filter may slow down succeeding operations, and you may want to "assert" the new graph (e.g., with a sml:ApplyConstruct) following this module.

 
  Template Module

Arguments

sml:selectQuery (sp:Select): A SELECT query with two result variables, "new" and "old".

sml:RequestLock (sm:Module)

Requests an exclusive system lock identified by the URI given as an argument. This will make sure that the following modules in the script can proceed without risking interrupts or concurrent modification exceptions for the duration of the lock. When another thread attempts to request a lock with the same URI, the module will wait until the lock is released and then continue execution. The lock will be released if the script terminates or sml:ReleaseLock is reached.

Please use this module with care and release the lock as quickly as possible to avoid contention issues. Other concurrent requests may need to wait until the script has been finished.

 
  Template Module

See Also

Arguments

sml:uri: the lock URI (either xsd:string or resource)

sml:ResetSPINCaches (sm:Module)

Clears any cached results from SPIN functions marked as spin:cachable. This can be used to reset the cache after "background data" has been changed by a script. If such updates only happen periodically, spin:cachable can improve overall performance.

 
  Template Module

sml:ReturnNode (sm:Module)

Returns an RDF node as a result of a script. This module is typically used as exit point of a user-defined SPIN function and web service. The sm:returnModule of the function will point to this.

 
  Template Module

Arguments

sml:result: the result, usually passed in from a previous module

sml:ReturnRDF (sm:Module)

Represents the exit point of a function that returns RDF. The function can be referenced from the outside (e.g., as a web service) by its URI or local name. The RDF triples will be serialized into Turtle, JSON-LD or RDF/XML.

 
  Template Module

Arguments

sml:baseURI (xsd:string): [Optional] The base URI of the graph to serialize.
sml:serialization (sm:ValueType): The serialization format - must be sml:JSONLD, sml:RDFXML or sml:Turtle.

sml:ReturnSPARQLResults (sm:Module)

Runs a SPARQL Select query and returns its result in the standard SPARQL output formats XML, JSON, CSV or TSV.

 
  Template Module

Arguments

sml:selectQuery: The SELECT query to execute.
sml:serialization (sm:ValueType): [Optional] the serialization format such as XML or JSON

sml:ReturnSWPDocument (sm:Module)

Creates an SWP document using the current variable bindings and returns the resulting document as HTML, XML, SVG or text to the caller of the web service.

Note that in order to insert a SWP view for a given resource (using ui:instanceView etc), you can use the snippet <ui:resourceView ui:resource="{= ?varName }" />.

Also note that in order to use HTML or SVG tags in the sml:view, you will need to import the html.ttl or svg.ttl from the SWP ontologies into the script.

 
  Template Module

Arguments

sml:mimeType (xsd:string): [Optional] Overrides the default mime type returned by the UISPIN engine.
sml:snippet (xsd:boolean): [Optional] True to only create a UISPIN snippet, e.g. without head/body.
sml:view (ui:Node): A UISPIN document to render. This document may reference the bound variables of this module.

sml:ReturnText (sm:Module)

Represents the exit point of a function that returns text (mimetype: text). The function can be referenced from the outside (e.g., as a web service) by its URI or local name.

 
  Template Module

Arguments

sml:fileName: [Optional] The (optional) file name of the result stream.
sml:mimeType: [Optional] The (optional) mime type of the result stream.
sml:text: [Optional] The text that shall be returned.

sml:ReturnXML (sm:Module)

Represents the exit point of a function that returns XML. The function can be referenced from the outside (e.g., as a web service) by its URI or local name.

 
  Template Module

Arguments

sml:mimeType: [Optional] The (optional) mime type of the result stream.
sml:xml: The XML document that shall be returned.

sml:SendEMails (sm:Module)

Sends one or more emails. In a typical scenario, previous steps such as sml:ApplyConstruct have created instances of email:Message. The body of the emails could be created using sml:CreateUISPINDocument. A SPARQL Select query is then used to select those messages that shall be sent out, based on the given server parameters.

 
  Template Module

Arguments

sml:selectQuery (sp:Select): [Optional] A SPARQL Select query that binds instances of email:Message to send out. If left blank, all instances of email:Message in the input graph will be sent.
sml:smtpServer (email:Server): [Optional] The SMTP server that shall be used to send the emails from. If no server has been specified, the default SMTP server from the TBL server configuration will be used.

sml:SerializeSPARQLResults (sm:Module)

Executes a SPARQL SELECT query and serializes its result to either XML or JSON format.

 
  Template Module

Arguments

sm:outputVariable (xsd:string): The name of the output variable that will contain the result.
sml:selectQuery (sp:Select): The SELECT query to execute.
sml:serialization (sm:ValueType): [Optional] The serialization format.

sml:ValidateGraph (sm:Module)

Performs validation of the given input graph using SHACL shapes. Also includes SPIN constraints, although this may change in the future. The result graph consists of SHACL result instances such as sh:ValidationResult.

 
  Template Module

Arguments

sml:focusNode: [Optional] The focus node that should be validated - no other resource will be validated if present.
sml:generateSuggestions (xsd:boolean): [Optional] True to include dash:suggestions into the output graph.
sml:ignoreImports (xsd:boolean): [Optional] True to only validate the resources that appear as subject in a triple from the base graph. In other words, focus nodes defined only in imported graphs will be skipped by the SHACL engine.
sml:ignoreSPLConstraints (xsd:boolean): [Optional] True to skip checking spl:Argument and spl:Attribute constraints. This can sometimes boost performance.
sml:shapesGraph (rdfs:Resource): [Optional] The shapes graph to use. Defaults to the data graph.

sml:ValidateXMLAgainstXSD (sm:Module)

Validates an existing XML document against a given XML Schema. The XML Schema must be present in the workspace. The output of this module is a new graph containing instances of sxml:XSDValidationError or sxml:XSDValidationWarning. The rdfs:labels of those will contain more information on the error.

 
  Template Module

Arguments

sml:schemaFilePath (xsd:string): The path to an XSD file. The path can be relative to the current script's folder (e.g., myFolder/test.xsd) or absolute to the workspace root /myProject/myFolder/test.xsd.
sml:xml: The XML document that shall be validated. If this is represented as a string, then the errors will contain line numbers. Note that the output of modules such as sml:ImportXMLFromFile is not a string but an XML DOM, producing no line numbers.