Overview

This shows the development of the topic-edit template from v1.1 to v1.2.

List of Possible Topic States Query

The query below returns a list of states available to a topic. This query will be used to populate a drop down in the topic edit form.

The relationship for a folder to its members is cali.hasComponent. Concepts should be displayed using the skos:prefLabel property.


# topic-state-list.rq
#
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX calli: <http://callimachusproject.org/rdf/2009/framework#>

SELECT ?resource ?label {
    <topic-state/> calli:hasComponent ?resource .
    ?resource skos:prefLabel ?label
} ORDER BY ?label

topic-edit v1.1

Description

Use your own relationship namespace term, such as xmlns:meeting.

Code


<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:meeting="http://localhost:8080/schema/">
<head>
    <title resource="?this">{rdfs:label}</title>
</head>
<body resource="?this" onload="comparison=calli.copyResourceData('#form')">
    <div class="container">
        <div class="page-header">
            <h1 property="rdfs:label" />
        </div>
        <form id="form" method="POST" action="" enctype="application/sparql-update" resource="?this" class="row"
                onsubmit="calli.submitUpdate(comparison,event)">
            <fieldset class="col-sm-4">
                <div class="form-group">
                    <label for="label">Label</label>
                    <input type="text" id="label" value="{rdfs:label}" class="form-control" required="required"
                        onchange="calli.updateProperty(event, 'rdfs:label')" />
                </div>
                <div class="form-group">
                    <label for="comment">Comment</label>
                    <textarea id="comment" class="form-control"
                        onchange="calli.updateProperty(event, 'rdfs:comment')">{rdfs:comment}</textarea>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary">Save</button>
                    <button type="button" class="btn btn-default" onclick="location.replace('?view')">Cancel</button>
                    <button type="button" class="btn btn-danger" onclick="calli.deleteResource(event)">Delete</button>
                </div>
            </fieldset>
        </form>
    </div>
</body>
</html>

topic-edit v1.2

Description

Add a dropdown field to select the state of a topic. It will display the available states by listing all the concepts in the folder created earlier. The pragma ?select of RDF Queries will return a select element populated with the query result set.

Code


<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:skos="http://www.w3.org/2004/02/skos/core#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:meeting="http://localhost:8080/schema/">
<head>
    <title resource="?this">{rdfs:label}</title>
</head>
<body resource="?this" onload="comparison=calli.copyResourceData('#form')">
    <div class="container">
        <div class="page-header">
            <h1 property="rdfs:label" />
        </div>
        <form id="form" method="POST" action="" enctype="application/sparql-update" resource="?this" class="row"
                onsubmit="calli.submitUpdate(comparison,event)">
            <fieldset class="col-sm-4">
                <div class="form-group">
                    <label for="label">Label</label>
                    <input type="text" id="label" value="{rdfs:label}" class="form-control" required="required"
                        onchange="calli.updateProperty(event, 'rdfs:label')" />
                </div>
                <div class="form-group">
                    <label for="comment">Comment</label>
                    <textarea id="comment" class="form-control"
                        onchange="calli.updateProperty(event, 'rdfs:comment')">{rdfs:comment}</textarea>
                </div>
                <div class="form-group">
                    <label for="state" class="control-label">State</label>
                    <xi:include href="topic-state-list.rq?select&amp;rel=meeting:state&amp;id=state" />
                    <div rel="meeting:state" resource="?state" />
                    <script type="text/javascript">
                        $('div[rel="meeting:state"]').filter(calli.selectEachResourceIn('#state')).remove();
                    </script>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary">Save</button>
                    <button type="button" class="btn btn-default" onclick="location.replace('?view')">Cancel</button>
                    <button type="button" class="btn btn-danger" onclick="calli.deleteResource(event)">Delete</button>
                </div>
            </fieldset>
        </form>
    </div>
</body>
</html>