Example 2 - A metadata editor
Constructing an editor with SHAME is largely similar to constructing a displayer, in fact the graph pattern and the form template could be exactly the same. So, we reuse both of them from the metadata displayer example but we add a couple of extra lines to the form template just to show some extra features.
Graph Pattern
The same as in the metadata displayer example.
The value model
The same as in the metadata displayer example.
Form template
The form model below is to a large extent the same as in the metadata displayer example. We will only discuss what is new, that is, the red parts. The LanguageControlled type specifies that in addition to the plain string value a language can be choosen. The max and min multiplicity specifies how many occurences of values for a variable that should be allowed. In practise the multiplicity controlls the behaviour of the add and remove buttons visible in the screenshots below.
<?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'>
<form:query rdf:resource='http://kmr.nada.kth.se/shame/example#query'/>
<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'/>
<form:minMultiplicity>1</form:minMultiplicity>
<form:maxMultiplicity>1</form:maxMultiplicity>
<rdf:li>
<form:TextFormItem>
<rdf:type rdf:resource='http://kmr.nada.kth.se/rdf/form#LanguageControlled'/>
<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:minMultiplicity>1</form:minMultiplicity>
<form:maxMultiplicity>3</form:maxMultiplicity>
<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#LanguageControlled'/>
<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:minMultiplicity>1</form:minMultiplicity>
<form:maxMultiplicity>1</form:maxMultiplicity>
<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 2.
The resulting SHAME form
In the screenshoots below there is no add and remove buttons (+ and - buttons) on the resource itself and the description, this is due to the fact that they both have a max and min multiplicity of one. I.e. the buttons is not present since otherwise they would allow the user to break the multiplicity constraints.
|
|
|
|
|
|