Description

KnockoutJS supports templates that are rendered by the library based on the value of observable properties. If the observable property changes, the template is re-rendered with the updated values. SemanticKO extends this support to the use of RDF nodes bound to DOM nodes. If the RDF node changes, the template is also recomputed. At the moment, SemanticKO only supports jQuery Template as the template engine. SemanticKO also introduces an additional function sko.each that makes possible to use the results of a SPARQL query as the source values that will be used to render the template for each result.

In this example a template that will generate the li DOM nodes for a ul node are generated rendering the example5-template template. This template is rendered for each occurrence of the query {?subject a foaf:Person}. Queries used in the sko.each function must contain only the graph pattern of a SPARQL queries and the binding that will be returned must be named ?subject. The value of this URI is then bound to the $value variable of the jQuery template.

Output

View

Data (Turtle)

View Model