-In addition to the existing standards dedicated to representation or querying, Semantic Web programmers could really benefit from a dedicated programming language enabling them to directly define functions on RDF terms, RDF graphs or SPARQL results.
-This is especially the case, for instance, when defining SPARQL extension functions.
-
-We propose a function definition language on top of SPARQL filter language by introducing a function clause. It enables users to define and use simple extension functions directly in (extended) SPARQL. The body of functions is written using SPARQL filter language augmented with additional statements. The language can be seen as a kind of SPARQLScript w.r.t SPARQL in the spirit of JavaScript w.r.t HTML.
-
-
-
-LDScript is provided with extension datatypes that enable programmers to manipulate RDF objects such as graphs and triples as well as
-XML and JSON objects in a seamless way.
-
-
-
-
-
-The example below defines and uses the factorial function. Function definitions occur just after query definition.
-
-
-
-The language is built on top of SPARQL filter language extended with the statements defined in this proposition.
-
-The objects of the language are SPARQL variables and RDF terms: URI, literal, blank node.
-The language objects can also be RDF triple and graph as well as SPARQL query solution (mapping) and solution sequence (mappings).
-A list datatype is also introduced whose elements can be any of the objects listed above, including lists. List elements do not need to be of the same kind or of the same datatype.
-Triple, graph, mapping, mappings and list are managed as RDF literals with extension datatypes: dt:triple, dt:graph, dt:mapping, dt:mappings and dt:list. Their content is accessed by pattern matching and they are iterable.
-
-We call LDScript terms the union of RDF terms and LDScript literals with extension datatype in the dt: namespace.
-
-
-
-This @public annotation exports function definitions in the SPARQL interpreter in such a way that future SPARQL queries can use them within current runtime session.
-
-
-The result of a select (resp. construct) query is a dt:mappings (resp. dt:graph) datatype extension literal. These datatypes act as "pointers" to the underlying data structure that implements the result of the query.
-
-
-
-At runtime, variables that are bound in LDScript stack and that are projected in the select clause of a query are dynamically bound in the where clause. They are bound using an extended values clause that is generated dynamically. It is extended because it accepts blank node values in addition to URI and literals.
-In the example below, we call us:foo(v), the value of ?x is v in the stack and an appropriate values clause is dynamically generated.
-
-
-It is worth noticing that, as any statement, a SPARQL query can be embedded in an anonymous function.
-
-
-The dynamic let statement is a variant of the let statement where the scope of the declared variable is not only the body but also the functions that are called in the body (and recursively). In the example below, variable x in anonymous function is bound by the dynamic let.
-
-
-
-If the left argument is a list of variables, each variable is bound to the corresponding query solution (a mapping) in order.
-
-
-
-If the left argument is a list of list of variables, each variable is bound to the value of the corresponding variable (with same name) in the first query solution.
-
-
-
-Variables in-scope in the where clause that are bound in LDScript stack are bound in the where clause using an extended values clause generated at runtime.
-The query above is evaluated as shown below if the value of ?x is v in the stack.
-
-
-Local variables are defined by let (var = exp), for (var in exp), function us:fun(var) while
-set(var = exp) sets the value of a variable to the result of the expression.
-
-
-
-
-
-Global variables are defined by set(var = exp) when var is not a local variable at that time.
-
-
-
-
-The runtime scope of a global variable is the runtime scope of the outermost query within which the variable is defined, including functions and subqueries.
-When LDScript is used with STTL, the scope of a global variable is the whole STTL transformation.
-
-
-When a global variable is defined in a function, the global variable definition remains valid outside the function when the function resumes, until the outermost query resumes.
-
-
-
-A local variable definition temporarily hides a global variable with the same name within the lexical scope of the statement that defines the local variable.
-
-
-
-A global variable cannot be referenced directly in a SPARQL query,
-however it can be accessed by means of a function call that returns the value of the global variable. In other words, global variables belong to LDScript, not to SPARQL.
-
-
-
-
-
-
-
-
-
-
-The access to the content of extension datatypes can be done by declarative pattern matching.
-
-
-
-Iterable datatypes can be mapped to a list of variables, by pattern matching, using the let statement.
-
-
-
-Pattern matching with dt:mapping datatype is done by variable name and not by position.
-In the example below, variable x is bound to the value of variable x in current mapping.
-
-
-
-
-Extended datatypes can be accessed with pattern matching that focuses on first element(s), rest of the elements and last element(s).
-For this purpose, LDScript introduces two Pattern Matching operators: "." and "|" that can be combined.
-
-
-
-The "." operator enables to identify last element(s) of an extension datatype. In the example below, z variable matches the last element whereas x variable matches the first element.
-If there is only one element, the first and the last element are the same. If the extended datatype is empty, the variables remain unbound but the statement does not fail.
-
-
-
-It is possible to match several elements among the first ones and/or several elements among the last ones, as shown below. If there are not enough elements, some variables remain unbound.
-
-
-
-The "|" operator enables LDScript to match a sublist of elements, after the first element(s). In the example below, the rest variable is bound with the sublist starting after the two first elements. The sublist may be empty if there are not enough elements.
-
-
-
-It is possible to combine the two operators. In the example below, the sublist starts after the first two elements and stops before the last two elements. If there are not enough elements, the sublist may be empty.
-
-
-
-The "." and "|" operators can be used with these datatypes:
-dt:list, dt:map, dt:graph, dt:triple, dt:path, dt:mappings.
-
-
-
-
-LDScript extension datatypes can be iterated and mapped to a list of variables using the for statement.
-
-
-
-
-A mappings datatype is iterated as mapping elements.
-Pattern matching with mapping element is done by variable name and not by position.
-In the example below, variable x and y are bound to the values of variable x and y in current mapping.
-
-
-
-This statement resumes the execution of a function and returns its result.
-
-
-
-This statement returns an error.
-The execution of the LDScript expression resumes and returns an error. An error can be trapped by the coalesce statement as in SPARQL.
-
-
-This statement checks that the evaluation of an expression does not produce an error and returns a boolean accordingly.
-It is a generalization of the bound statement with any expression as argument.
-
-
-A second order function is a function whose first argument evaluation returns a function (a function URI or an anonymous function) and which calls this function with the other arguments.
-Second order functions are funcall, apply, map and reduce. They are useful in the context of Linked Data because the name URI of a function to be applied on resources can be determined by a SPARQL query.
-We use the abstract function type to denote either the URI of a function or an anonymous function.
-
-
-
-
-This statement applies a function which is the result of the evaluation of an expression.
-The first argument of the statement is an expression that must return either the URI of a function or an anonymous function.
-
-
-
-
-This statement applies a binary function iteratively to a list of arguments and produces one final result.
-The first argument of the statement is an expression that must return the URI of a function or an anonymous function.
-When the list is empty, if there is a function definition with the same name and zero argument, this function is called and its result is returned.
-
-
-
-
-Second order functions are available with the rq: prefix and can be combined.
-
-
-
-Return a xsd:string representation of the content of an extension datatype in the dt: namespace.
-
-
-Execute a SPARQL query whose text is the result of an expression, with possibly a list of variable value bindings.
-
-
-The xt:load function implements URI dereferencing, it returns the RDF graph resulting from the parsing of an RDF document.
-
-
-The sequence evaluates its arguments in sequence and returns the result of the last argument.
-If an argument returns an error, the sequence returns an error.
-
-
-
-The first argument MUST returns a graph with datatype dt:graph.
-The focus statement evaluates other arguments with the graph as current dataset.
-
-
-LDScript implementations MAY provide functions to evaluate SHACL shapes on the current focus graph.
-The result of shape functions is the validation report graph.
-
-
-
-
-Generate XML, JSON or RDF text format for SPARQL Query Results. The RDF format is the same as the one returned by the xt:tograph function.
-
-
-
-The objects of the language are RDF terms and LDScript terms.
-
-RDF terms are, as usual, URI, Blank Node and Literal with XSD datatype.
-
-LDScript terms are RDF graph and triple, SPARQL query solution sequence (called mappings), SPARQL query solution (called mapping) and SPARQL property path solution (called path).
-LDScript terms include list whose elements are LDScript objects and map whose keys and values are LDScript objects.
-LDScript terms also include datatypes for XML and JSON objects. The XML datatype is provided with (a subset of) the DOM API.
-
-
-
-LDScript objects other than RDF terms are implemented by means of literals with specific extension datatypes in the dt: namespace: dt:list, dt:map, dt:xml, dt:json, dt:graph, dt:triple, dt:path, dt:mappings, dt:mapping.
-Hence, they are implemented as RDF terms (i.e. RDF literals with extension datatypes) and their content can be accessed by specific statements as shown below.
-These datatypes are iterable by means of the for and map statements.
-By extension, we call LDScript terms the objects of the language.
-
-
-
-
-
-The XML datatype is provided with a subset of the DOM API.
-Implementations MAY provide more functions from the DOM API.
-
-
-
-
-
-There are two datatypes for RDF entities, dt:graph for RDF graph and dt:triple for RDF triple.
-
-
-
-
-The dt:graph datatype is provided with functions.
-Function xt:size returns the number of triples of a graph.
-
-
-
-
-Function xt:union computes a graph that is the union of two graphs. The arguments are LDScript terms with dt:graph datatype and the result is returned as a LDScript term with dt:graph datatype.
-
-
-
-The dt:triple datatype is provided with functions to access the subject, the property and the object. Implementations MAY provide a function to access the named graph when triples are quads.
-
-
-
-There are datatypes for SPARQL entities: dt:mappings for SPARQL Query solution sequence, dt:mapping for SPARQL Query solution and dt:path for Property Path solutions.
-
-
-
-
-
-The dt:mappings datatype is provided with functions that
-perform SPARQL algebra operations on SPARQL query solutions of select-where queries. The results are returned as literals with dt:mappings datatype.
-
-
-LDScript statements MAY be available within extended SPARQL Query Filter Constraints.
-
-
-
-This statement defines an extension aggregate which computes the list of values of the expression and returns a dt:list literal.
-
-
-
-The dt:path datatype is provided for the case where the implementation gives access to Property Path solutions.
-In the example below, SPARQL is extended with path variables, the $path variable is bound to the property path that relates ?x and ?y.
-The datatype of the value of $path is dt:path. It is conceptually equivalent to dt:list(dt:triple).
-
-
-
-When a variable has for value an RDF graph, the variable can be used in a named graph pattern which is evaluated on the content of the graph. The example below shows this case with variable ?g.
-
-
-
-
-In an ontology, properties may be defined as functions of other properties. For example, the surface can be defined as the product of the length and the width.
-
-
-A SPARQL interpreter may define a set of events and emit events during quering processing.
-A SPARQL interpreter may be provided with an event manager that traps events.
-If a SPARQL query is provided with appropriate function definitions for the events, the event manager calls these functions.
-
-The association between an event and a function is done by an annotation wich is an identifier prefixed by the '@' character. The function name is free whereas the annotation name is fixed.
-
-
-
-LDScript can be use to manage predefined queries by means of anonymous functions.
-
-
-
-
-This statement defines an extension aggregate. The first expression (e.g. aggregate(?n)) is the expression to aggregate. The aggregate function computes the list of values of this expression. The second expression (e.g. us:median(?list)) is the function to be applied to the list of values. In the example below, the aggregate computes the median of the values.
-
-
-Dedicated programming language enabling Semantic Web programmers to define functions on RDF terms, triples and graphs or SPARQL query results can facilitate the development and improve the reuse and maintenance of the code produced for Linked Data.
-We propose to extend SPARQL with LDScript, a script language that enables users to define extension functions.
-Its main characteristics are:
-
-
-
-In the future we wish to provide a second implementation on top of another Semantic Web Factory.
-We wish to provide a compiler to Java language and work on performance.
-We would like to design a type checker and investigate Linked Functions.
-
-
-
-
-K. L. Clark, F. G. McCabe.
-Ontology oriented programming in go!
-Applied Intelligence. Springer.
-Volume 24, Issue 3, 2006.
-
-
-
-
-Eyal Oren, Renaud Delbru, Sebastian Gerke, Armin Haller, Stefan Decker.
-ActiveRDF: object-oriented semantic web programming.
-International Conference on World Wide Web, WWW 2007, Banff, Alberta,
-Canada, 2007.
-
-
-
-Greg Williams.
-Extensible SPARQL functions with embedded javascript.
-In ESWC Workshop on Scripting for the Semantic Web, SFSW,
-Innsbruck, Austria, volume 248 of CEUR Workshop Proceedings, 2007.
-
-
-
-Diego Berrueta, Jose E. Labra, and Ivan Herman.
-XSLT+SPARQL: Scripting the Semantic Web with SPARQL embedded into XSLT stylesheets.
-4th Workshop on Scripting for the Semantic Web
-2008
-
-
-
-
-Axel Polleres,
-Thomas Krennwallner , Nuno Lopes, Jacek Kopecký, Stefan Decker.
-XSPARQL Language Specification.
-W3C Member Submission
-2009
-
-
-
--
-
-Bernhard Schandl.
-Functions over RDF Language Elements.
-International Semantic Web Conference, ISWC 2009.
-
-
-
-
-
-
-Sven Groppe, Jana Neumann, and Volker Linnemann.
-SWOBE - embedding the semantic web languages RDF, SPARQL and SPARUL into java for guaranteeing
-type safety, for checking the satisfiability of queries and for the determination
-of query result types.
-ACM Symposium on Applied
-Computing (SAC), Honolulu, Hawaii, USA, 2009.
-
-
-
-Holger Knublauch.
-SPIN JavaScript Functions (SPINx)
-SPIN JavaScript Functions (SPINx)
-2010
-
-
-
-
-V. Eisenberg.
-Ruby on Semantic Web.
-IEEE 27th International Conference on Data Engineering.
-2011
-
-
-
-
-Holger Knublauch.
-SPIN - SPARQL Syntax.
-Member Submission, W3C, 2011.
-http://www.w3.org/Submission/2011/SUBM-spin-sparql-20110222/.
-
-
-
-
-Espen Suenson, Johan Lilius, Ivan Porres.
-OWL Web Ontology Language as a Scripting Language for Smart Space Applications
-Rule-Based Reasoning, Programming, and Applications
-Springer Berlin Heidelberg
-Berlin, Heidelberg
-2011
-
-
-
-Olivier Corby, Alban Gaignard, Catherine Faron-Zucker, and Johan Montagnat.
-KGRAM Versatile Data Graphs Querying and
-Inference Engine
-In Proc. IEEE/WIC/ACM International Conference on Web
-Intelligence, Macau, December 2012.
-
-
-
-SPARQL 1.1 Query Language,
-Steve Harris, Andy Seaborne.
-W3C Recommendation, March 2013
-
-
-
-David Mizell, Kristyn J. Maschhoff, Steven P. Reinhardt.
-Extending SPARQL with graph functions.
-IEEE International Conference on Big Data (Big Data).
-2014
-
-
-
-
-Martin Leinberger, Stefan Scheglmann, Ralf Lämmel, Steffen Staab, Matthias Thimm, Evelyne Viegas.
-Semantic Web Application Development with LITEQ.
-International Semantic Web Conference, ISWC, Riva del Garda, Italy.
-2014.
-
-
-
-
-RDF 1.1 Concepts and Abstract Syntax,
-Graham Klyne, Jeremy J. Carroll, Brian McBride.
-W3C Recommendation, February 2014
-
-
-
-Maurizio Atzori.
-Toward the web of functions: Interoperable higher-order functions in
-SPARQL.
-13th International Semantic Web Conference, ISWC, Riva del Garda, Italy, volume 8797 of LNCS, 2014.
-
-
-
-Olivier Corby and Catherine Faron-Zucker.
-A Transformation Language for RDF based on SPARQL.
-Web Information Systems and Technologies - Selected Extended
-Papers from WEBIST 2015. Springer-Verlag, Lecture Notes in Business
-Information Processing, 2015. Best paper nominee.
-
-
-
-Gabriel Ciobanu, Ross Horne, Vladimiro Sassone
-Minimal type inference for Linked Data consumers. J. Log. Algebr. Meth. Program.
-84(4): 485-504 (2015)
-
-
-
-
-Florian Weber, Andreas Bihlmaier, Heinz Worn.
-Semantic Object-Oriented Programming (SOOP)
-INFORMATIK, Lecture Notes in Informatics (LNI)
-2016
-
-
-
-
-Olivier Corby, Catherine Faron-Zucker and Fabien Gandon,
-LDScript: a Linked Data Script Language,
-International Semantic Web Conference, ISWC, spotlight paper,
-2017 October, Vienna, Austria.
-
-
-
-Martin Leinberger, Ralf Lämmel, Steffen Staab.
-The Essence of Functional Programming on Semantic Data.
-Programming Languages and Systems: 26th European Symposium on Programming, ESOP 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS, Uppsala, Sweden, April, 2017.
-
-
-
-Maxime Lefrançois, Antoine Zimmermann, and Noorani Bakerally.
-A SPARQL extension for generating RDF from heterogeneous formats.
-14th European Semantic Web Conference, ESWC,
-Portoroz, Slovenia, volume 10249 of LNCS, 2017.
-
-
-
-Chi Zhang, Jakob Beetz, Bauke de Vries.
-BimSPARQL: Domain-specific functional SPARQL extensions for querying RDF building data
-Semantic Web Journal, 2017.
-
-
-
-Jean-Baptiste Lamy.
-Owlready: Ontology-oriented programming in Python
-with automatic classification and high level constructs
-for biomedical ontologies.
-Technical Report
-2017
-
-
-
-
-René Schubotz, Christian Vogelgesang, Torsten Spieldenner.
-SPARQλ: SPARQL as a function.
-Conference: Future of Information and Communication Conference (FICC) 2019, San Francisco, USA.
-2019
-
-
-
-Philipp Seifer, Martin Leinberger, Ralf Lämmel, and Steffen Staab.
-Semantic Query Integration With Reason.
-Programming journal.
-2019
-
-
-
-
-Kurt Cagle
-Extending MarkLogic SPARQL with Javascript
-2018
-
-
-
-
-Ben De Meester, Tom Seymoens, Anastasia Dimoua, Ruben Verborgh.
-Implementation-independent function reuse,
-2020
-Future Generation Computer Systems
-
-
-
-
-Extensions in ARQ
-Jena documentation
-
-
-
-PL/SQL documentation
-
-
-
-Geospatial Extensions for RDF and SPARQL
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/v5.0.0/_static/extensions/rule.html b/v5.0.0/_static/extensions/rule.html
deleted file mode 100644
index 695d04b96..000000000
--- a/v5.0.0/_static/extensions/rule.html
+++ /dev/null
@@ -1,171 +0,0 @@
-
-
-
-A rule base consists of a list of rules.
-The rule engine evaluates a rule base as follows.
-It considers all the rules, in order in the rule base.
-For each rule, it executes the where clause and if there are solutions, it instantiates the triple patterns of the construct clause with every solution to form a set of triples.
-Then, it inserts these triples into the current dataset.
-In order to enhance tracability, triples infered by the rule engine are inserted in the kg:rule named graph in the dataset.
-The rule engine iterates the cycle above on the entire rule base, possibly several times, until no new triple is generated.
-Termination is ensured provided that two conditions are verified: no new graph nodes are inserted and no new properties are created. In this case, termination is ensured because the rule engine engine stops after saturation.
-
-
-
-The query below enables users to retrieve triples infered by the rule engine.
-
-
-
-This document defines the syntax and semantics of the STTL language. STTL stands for SPARQL Template Transformation Language. In STTL transformations describe rules for transforming an RDF source graph into a text result. STTL is designed as an extension of the SPARQL 1.1 Query Language to build on standards and ease its adoption.
-
-
-
-
-RDF provides us with a general purpose graph-oriented data model to represent and interchange data on the Web. However, the transformation and presentation of RDF data is still an open issue. Among the initiatives to answer this question there are extensive works for providing RDF with several varied syntaxes (XML, N-Triples, Turtle, RDFa, TriG, N-Quads, JSON-LD) and for linking it to other data sources (R2RML, CSV-LD, etc.). With the multiplication of data sources and data formats, developers of the Web of data now spend a lot of time and energy to build transformations to present RDF data to users and transform data from one source to another. Moreover, RDF is more and more used as a syntax to represent other languages (e.g. SPIN) and we consider that RDF can then be viewed as a pivot language to represent the abstract syntax trees of expressions of other languages.
-
-
-For this reason, we propose the SPARQL Template Transformation Language (STTL) that enables Semantic Web developers to write specific yet compact RDF transformers toward other languages and formats. This document defines the syntax and semantics of STTL. A transformation expressed in STTL describes rules for transforming an RDF source graph into a text result. STTL is an extension of SPARQL 1.1 Query Language. To some extend STTL is to RDF what XSLT is to XML. An STTL engine takes an RDF graph and a transformation (a set of templates) as input and generates a textual output format as a character stream. Output format may be unstructured text such as natural language, or structured text such as Turtle, HTML, XML, Latex, CSV, etc. If the RDF graph represents the Abstract Syntax Tree of another language, e.g. SPIN, the transformation engine may generate a concrete syntax, e.g. SPARQL.
-
-
-
-
-
-
-STTL is related with SPARQL, RDF and somehow with XSLT.
-
-XSLT is a language for transforming XML documents into other XML documents.
-
-STTL is similar to XSLT as it is a language for transforming RDF graphs into text formats such as RDF documents. However, STTL operates on the graph model of RDF, not on its syntax (that is, not on its RDF/XML syntax).
-
-
-
-
-STTL is built on top of SPARQL 1.1 Query Language. It is an extension of SPARQL with an additional template query form and a set of extension functions.
-
-
-
-
-
-
-STTL uses the prefix and namespaces shown below, which are omitted in the rest of the document:
-
-
-
-A transformation is a set of templates.
-
-A template is a declarative rule with a condition part and a format part.
-
-A template is applied on a focus node. A focus node is an RDF term of the RDF graph that is currently processed by a transformation engine.
-
-
-
-In the process of finding the applicable template, more than one template may be eligible. However, in the general case, only one template will be applied. The first template in the transformation is chosen except if templates have priorities. In this case, the template with the highest priority is chosen.
-
-
-
-
-
-
-
-
-The example below lists all the triples linking URI in the current RDF graph in NTriple format.
-
-
-
-A template can have a name (an URI) and parameters.
-In the example shown below, the name of the template is ex:display and the parameter list is (?x).
-
-
-
-
-The data model used by STTL is the same as the one used by SPARQL: RDF Dataset.
-The data model used by STTL is the RDF Dataset resulting from the parsing of the input RDF document(s) whatever their syntax is: RDF/XML, Turtle, N3, JSON-LD or RDFa.
-
-If the triple store is provided with an entailment regime (e.g. RDFS), STTL exploits the entailments in the same way than SPARQL.
-
-
-
-
-The result of a transformation is a text, that is a character stream.
-The text can be structured (HTML, RDF/XML, XML, etc.), it can represent statements of a language (e.g. Turtle, SPARQL, OWL functional syntax, etc.), it can be natural language, etc.
-
-
-
-
-
-
-
-In the process of finding the applicable template, more than one template may be eligible. In the
-general case, only one template will be applied. If no indication is given the first template applied
-following the order of the .rq files or the RDF document.
-Alternatively, if the possible templates have specified priorities, the template with the highest priority is chosen.
-
-
-
-
-
-
-A template in a transformation may apply other templates. This is done using the st:apply-templates extension function. Below is an example of template which generates the functional syntax of an OWL allValuesFrom restriction statement.
-
-
-
-In order to apply templates, the language provides a set of SPARQL extension functions. Running a transformation engine on a set of templates is done by an initial call to st:apply-templates-with in a SPARQL query (or a template) where the st-uri argument is the URI of the transformation. This function can also be used to apply another transformation within a transformation. Hence a complex transformation can be split into simpler ones.
-
-The uri argument of st:call-template is the name of a template.
-The term argument is the focus node, it is an RDF term.
-
-
-
-In some cases, it is necessary to apply several templates in order to transform a focus node. In this case, the st:apply-templates-all function may be used. The result of st:apply-templates-all is the concatenation of the results of all the templates that succeed.
-
-
-
-SPARQL functions can be used in the template clause.
-
-
-
-STTL provides a "hook" to define extension functions that are available within a transformation.
-
-To do so, STTL provides a simple formalism to define SPARQL extension functions.
-The function clause enables users to define a function with an URI as name and a list of parameter variables.
-The body of the function is defined using SPARQL filter language.
-
-
-
-As there are no natural root nodes in a graph, we provide the possibility to define a specific start template that determines the nodes to start with. The start template, if any, is the st:start named template. Otherwise, the first template of the transformation that succeeds is applied.
-
-
-
-STTL provides a mechanism to attach a priority to templates. In the case where several templates may be applied, the one with the highest priority is chosen.
-
-In the case where several templates may succeed, it may be necessay to sort templates according to an explicit priority. Smaller numbers represent higher priority.
-
-
-
-Pragma enables to define priority. It
-may be used in the future to define new features.
-
-
-
-Format enable to specify a string pattern with text variables (%s) and a list of expressions. Text variables are replaced by the values of expressions.
-
-
-
-
-Syntax of the RDF document for tranformations is given in RDF/XML format.
-Each template must define its prefix and namespaces.
-
-
-
-SPARQL Templates are compiled as select-where SPARQL queries where variables in the template clause are replaced by a call to the st:process extension function. Its default behaviour is to call st:turtle.
-When st:process is bound to st:apply-templates in the profile, it implements the recursive call to the transformation engine. This function plays a similar role as the xsl:apply-templates clause in XSLT.
-Its behavior consists in executing templates one by one from the set of templates until one of them succeeds. The result of the st:apply-templates function call is the result of this successful template execution.
-
-
-
-A template succeeds if the evaluation of the where clause returns solution(s) and if the evaluation of the template clause does not raise an error. An error may be caused by an unbound variable.
-
-
-
-The focus node is the node that the transformation engine is processing at the current time.
-It is bound to a distinguished ?in variable the value of which is determined at run time by a process equivalent to the one shown below where the st:getFocusNode() function
-represents the focus node value determined from the environment.
-
-
-
-is compiled into a select-where SPARQL query as shown below. The st:concat function is similar to the SPARQL concat function.
-
-
-
-Executing a template consists first in executing the where part which results in a solution sequence (i. e. variable bindings).
-
-Then the select clause is executed, providing a solution sequence extended with the projected variable ?out.
-This is standard SPARQL query execution.
-
-To finish, an additional group_concat(?out) aggregate operation is performed on the SPARQL solution sequence, resulting into one solution where all values of the ?out variable are concatenated into a string value. This is the final result of the template and this is the result returned by the st:apply-templates function.
-Hence, it is possible to implement a STTL engine on top of a SPARQL interpreter using extension functions.
-
-
-
-
-
-SPARQL Template Transformation Language aims at generating presentation format for RDF graphs. It is designed as an extension of SPARQL 1.1 Query Language.
-STTL is available in the Corese Semantic Web Factory and it is used in the Corese Web server.
-Preliminary works show that STTL can also be used to perform constraint checking with templates that return boolean values instead of text.
-
-
-
-
-