A metadata displayer - Example 1
When doing things with SHAME you always need a annotation profile consisting of a graph pattern and a form template. From these two a SHAME form is constructed via a form creator. In this example we will see how already existing data, i.e. a Dublin Core title and description, can be presented (i.e. not edited).
Graph Pattern
The following graph pattern (expressed in QEL) matches all Dublin Core titles and descriptions to respective variable T and D. It further requiers that all matches to the T and D variable should be regular strings.
@base <http://kmr.nada.kth.se/shame/example>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix qel: <http://www.edutella.org/qel#>.
?(X,T,D)- qel:s(X, dc:title, T), qel:nodeType(T, qel:Literal),
qel:s(X, dc:description, D), qel:nodeType(D, qel:Literal).
The value model
This RDF/XML value model says that the resource http://slashdot.org has the title 'Slashdot' and a description that says 'News for Nerds. Stuff that matters.".
<rdf:RDF
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:dc='http://purl.org/dc/elements/1.1/'
>
<rdf:Description rdf:about='http://slashdot.org/'>
<dc:title>Slashdot</dc:title>
<dc:description>News for Nerds. Stuff that matters.</dc:description>
</rdf:Description>
</rdf:RDF>
Applying the graph pattern above will yield a variable binding set:
| ...example#X | ...example#T | ...example#D |
|---|---|---|
| http://slashdot.org/ | Slashdot | News for Nerds. Stuff that matters. |
Form template
This form basically says how the data bound to the three variables X, T and D in the variable binding set above should be presented. After the initial XML header accompanied with namespace declarations the form template is defined followed by its structure,i.e. a tree of formitems. Each formitem consists of a label (given by a qualified dc:title) and a reference to a variable. The tree structur of the formitems above consists of a groupformitem at the top pointing to the root resource, variable X, and below it two textformitems refering the dc:title, variable T, and dc:description, variable D, respectively.
<?xml version='1.0' encoding='ISO-8859-1' ?>
<rdf:RDF
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
xmlns:form='http://kmr.nada.kth.se/rdf/form#'
xmlns:dc='http://purl.org/dc/elements/1.1/'>
<form:Form rdf:about='http://kmr.nada.kth.se/shame/example#form'>
<rdf:li>
<form:GroupFormItem>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang='sv'>Resurs</rdf:li>
<rdf:li xml:lang='en'>Resource</rdf:li>
<rdf:li xml:lang='de'>Ressource</rdf:li>
</rdf:Alt>
</dc:title>
<form:variable rdf:resource='http://kmr.nada.kth.se/shame/example#X'/>
<rdf:li>
<form:TextFormItem>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang='sv'>Titel</rdf:li>
<rdf:li xml:lang='en'>Title</rdf:li>
<rdf:li xml:lang='de'>Titel</rdf:li>
</rdf:Alt>
</dc:title>
<form:variable rdf:resource='http://kmr.nada.kth.se/shame/example#T'/>
</form:TextFormItem>
</rdf:li>
<rdf:li>
<form:TextFormItem>
<rdf:type rdf:resource='http://kmr.nada.kth.se/rdf/form#MultiLine'/>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang='sv'>Beskrivning</rdf:li>
<rdf:li xml:lang='en'>Description</rdf:li>
<rdf:li xml:lang='de'>Beschreibung</rdf:li>
</rdf:Alt>
</dc:title>
<form:variable rdf:resource='http://kmr.nada.kth.se/shame/example#D'/>
</form:TextFormItem>
</rdf:li>
</form:GroupFormItem>
</rdf:li>
</form:Form>
</rdf:RDF>
Running the example
You can try the example in the SHAME application suite or directly in the CVS. See the Readme-examples.txt for more information about example 1.
The resulting SHAME form
