When talking about creating dynamic web pages from templates, it
is of interest how to request content from the data storage backend that
matches certain patterns, then filter, sort and format it in different ways
for the output.
The eniLINK platform with its base framework KOMMA are built on top of the
Linked Data principles, using triples in graph databases or triplestores as
the underlying information repository. As usual with triplestores, queries
are expressed in SPARQL as a set of triple patterns.
In effect, what a dynamic page request would need to to do is to bind
certain variables from such a SPARQL query to template elements or
attributes to create the final page. One would already know which variable
should be bound to which element or attribute and could, in other words,
add additional markup to these template elements to describe such bindings.
Say we meant to display a list of certain types of resources in our
triplestore, using some attribute as their description in the list. We would
query for the relevant types of resources with their values for the given
attribute, and bind those values to new elements on our final page.
We would need to write a SPARQL query with variables, and code that iterated
over the query result to generate our elements and bind the variable values
to the attributes for these elements.
Consider that we also knew where the variable was used in the SPARQL query,
or what it was bound from in terms of our triplestore, so why not also add
a description of that to the markup?
Considering our premise from above, we could have markup for
a list of resources of a certain type, say <foaf:Person>
one single resource of that type, bound to a variable, say ?person
a variable for the attribute <foaf:name> of ?person, say ?name
and the value of ?name as some content on the page.
Now… the good news is that there already is markup available that helps us
express triple patterns in terms of RDF types and properties from our
triplestore, as needed to construct the SPARQL query. It’s called RDFa
(Resource Description Framework in Attributes).
A key enabling technology behind these developments is the ability to add
structured data to HTML pages directly. RDFa (Resource Description Framework
in Attributes) is a technique that allows just that: it provides a set of
markup attributes to augment the visual information on the Web with
While the original intention of RDFa is the reverse of what we want to use it
for, the general idea of augmenting content with meta-information in RDF terms
applies, and has benefits, for our use-case as well.