Skip to main content
Fig. 4 | Journal of Cheminformatics

Fig. 4

From: Advanced SPARQL querying in small molecule databases

Fig. 4

Example of a velocity template. For a given compound, the example template generates an HTML list of its chemical or other roles. Each item in the list is a hyperlink to the represented role. The visualized compound is referenced by the $entity Velocity variable that is set by the system before the template is evaluated. The body of the #sparql directive contains a query that returns the roles of the compound and their names. The query is parametrized using the $entity reference. Before the query is submitted, the reference is replaced by its value. The query results are returned by the database engine and stored in the $roles Velocity variable specified as a parameter of the directive. Individual results are processed by the #foreach directive. It sequentially stores a result into the $role Velocity variable and processes its body. The $role Velocity variable is used to access values of SPARQL variables; the reference to the role entity ($role.ROLEDEF) and to the name of the role ($role.NAME) are accessible inside the body. These references are used by the #url directive to produce links to the roles. The #escapeHTML macro escapes characters in the name value to be placed into HTML

Back to article page