An edit template is an HTML form and determines how resources from a Callimachus class are modified by the user. Each edit template is associated with a Callimachus class, and developers may script Edit templates by using these patterns and functions.

Initial edit template code

Here is the default code generated when a new edit template is created.

 1:<?xml version="1.0" encoding="UTF-8" ?>
 2:<html xmlns=""
 3:    xmlns:xsd=""
 4:    xmlns:rdf=""
 5:    xmlns:rdfs=""
 6:    xmlns:dcterms="">
 8:    <title resource="?this">{rdfs:label}</title>
10:<body resource="?this" onload="comparison=calli.copyResourceData('#form')">
11:    <div class="container">
12:        <hgroup class="page-header">
13:            <h1 property="rdfs:label" />
14:        </hgroup>
15:        <form id="form" role="form" method="POST" action="" enctype="application/sparql-update" resource="?this" class="row"
16:            <fieldset class="col-sm-4">
17:                <div class="form-group">
18:                    <label for="label">Label</label>
19:                    <input type="text" class="form-control" id="label" value="{rdfs:label}" required="required"
                           onchange="calli.updateProperty(event, 'rdfs:label')" />
20:                </div>
21:                <div class="form-group">
22:                    <label for="comment">Comment</label>
23:                    <textarea id="comment" class="form-control"
                           onchange="calli.updateProperty(event, 'rdfs:comment')">{rdfs:comment}</textarea>
24:                </div>
25:                <div class="form-group">
26:                    <button type="submit" class="btn btn-primary">Save</button>
27:                    <button type="button" onclick="window.location.replace('?view')" class="btn btn-default">Cancel</button>
28:                    <button type="button" onclick="calli.deleteResource(event)" class="btn btn-danger">Delete</button>
29:                </div>
30:            </fieldset>
31:        </form>
32:    </div>

Code analysis

Lines Element Purpose
1 xml Specifies the character encoding to be UTF-8.
2-6 html Declares the namespaces used to identify resources in this page.
8 title Assigns the page title the label of the current resource.
10 body Sets the RDF subject for elements inside the body element.
13 h1 Displays the label of the current resource.
15 form Form used to update the RDF data for the current resource.
16-30 input fields Sample input fields.
26-28 buttons Buttons used to submit, cancel changes or delete the current resource.