Description

A create template is an HTML 5 form that determines how RDF resources are created. Each create template is associated with a Callimachus class, and developers may script create templates by applying these patterns.

Initial create template code

Here is the default code generated for a new create template.

 1. <?xml version="1.0" encoding="UTF-8" ?>
 3. <html xmlns="http://www.w3.org/1999/xhtml"
 4.     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
 5.     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 6.     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
 7. <head>
 8.     <title>New Resource</title>
 9. </head>
10. <body>
11.     <h1>New Resource</h1>
12.     <form method="POST" action="" enctype="application/rdf+xml" typeof=""
13.             onsubmit="return calli.saveResourceAs(event,calli.slugify($('#label').val()))">
14.         <fieldset>
15.             <div class="control-group">
16.                 <label for="label" class="control-label">Label</label>
17.                 <div class="controls">
18.                     <input type="text" id="label" value="{rdfs:label}" class="auto-expand" required="required" autofocus="autofocus" />
19.                 </div>
20.             </div>
21.             <div class="control-group">
22.                 <label for="comment" class="control-label">Comment</label>
23.                 <div class="controls">
24.                     <textarea id="comment" class="auto-expand">{rdfs:comment}</textarea>
25.                 </div>
26.             </div>
27.             <div class="form-actions">
28.                 <button type="submit" class="btn btn-success">Create</button>
29.             </div>
30.         </fieldset>
31.     </form>
32. </body>
33. </html>

Code Analysis

Lines Element Purpose
1 xml Specifies the character encoding to be UTF-8.
4-6 html element Declares the namespaces used to identify resources in this page.
8,11 title, h1 Contains placeholders for the name of the type of resources being created.
12 form HTML form that will update the RDF database when the user presses the submit button.
15-26 input field classes Placeholders for input fields.
28 button Create button submits the data.