Chapter 1. JavaScript Reference

See Mozilla's JavaScript Reference for a reference to the language itself.

The three types of JavaScript functions listed below provide common behaviour for RDFa-aware DOM manipulation. These functions are used within Callimachus edit templates.

1.1. calli.createResource

1.1.1. Description

Allows the user to choose or create a resource for a dropzone by using a dialogue box. If no src is provided the href attribute of the event.target will be used.

1.1.2. Signature

calli.createResource( event, [src] )

Parameter Description
event HTML click event
src (optional) URL of the page to display in the dialogue.

1.1.3. Example


<a href="Person?create" title="Create a Person"
      onclick="return calli.createResource(event)"
      class="ui-icon ui-icon-newwin" />

1.2. calli.deleteResource

1.2.1. Description

Issues a HTTP DELETE request to the current resource (i.e. current form action target). If the request is successful the browser page is replaced by either the

  • redirect page, or the
  • parent resource page, when a redirect page is not specified.

1.2.2. Signature

calli.deleteResource( event, [redirect] )

Parameter Description
event HTML click event
redirect (optional) URL to redirect browser to

1.2.3. Example


<button type="button" onclick="calli.deleteResource(event)" class="btn btn-danger">Delete</button>

1.3. calli.saveResourceAs

1.3.1. Description

Assigns a URI to a the resource in a form, if no @resource or @about is present on the form. This method will prompt the user to confirm a namespace and fileName if the event is not a submit event or if the namespace for the resource cannot be determined. When the user confirms the namespace and fileName, the form is automatically submitted.

1.3.2. Signature

calli.saveResourceAs( event, [fileName, [create]] )

Parameter Description
event
  • HTML form submit or
  • HTML click event
fileName (optional) Suggested local part of newly crated resource
create (optional) URI of the class of resource to create

1.3.3. Example


<form method="POST" action="" enctype="application/rdf+xml" typeof="foaf:Person"
    onsubmit="return calli.saveResourceAs(event,calli.slugify($('#label').val()))">

1.4. calli.selectResource

1.4.1. Purpose

Allows the user to select a resource for a dropzone by using a folder view dialogue box.

1.4.2. Signature

calli.selectResource( event, [src] )

Parameter Description
event HTML click event
src (optional) URL of the page in the dialogue

1.4.3. Example


<a href="/scheme/medimus/top" title="Browse Mediums"
    onclick="return calli.selectResource(event)"
    class="ui-icon ui-icon-folder-open" />

1.4.4. Detailed logic

Here is how the method operates in more detail.

IF ... THEN ...
no src is provided the href attribute of the event.target will be used
the Select button is clicked the subject of the current page is dropped onto event.target as a s:text/uri-list

1.5. calli.addResource

1.5.1. Description

Adds a resource to the parentNode or to a container element. The control element must have a unique id.

1.5.2. Signature

calli.addResource (event, [container] )

Parameter Description
event HTML click event
container (optional) CSS selector of container element

1.5.3. Example


<div class="control-group">
    <label for="altLabel" class="control-label">Alternate label</label>
    <div id="altLabel-control" class="controls">
        <input type="text" id="altLabel" property="skos:altLabel" content="?alt" value="{?alt}" class="auto-expand" />
        <a href="javascript:void(0)" title="More" onclick="return calli.addResource(event)" class="ui-icon ui-icon-plus" />
    </div>
</div>


<div class="control-group">
    <label for="adr" class="control-label">Address <a href="javascript:void(0)" title="Another Address"
        onclick="return calli.addResource(event,'#adr')" class="ui-icon ui-icon-plus" /></label>
    <div id="adr" rel="vcard:adr" class="controls">
        <div typeof="vcard:Address">
            <input type="text" placeholder="street address" value="{vcard:street-address}" />
            <input type="text" placeholder="extended address" value="{vcard:extended-address}" />
            <input type="text" placeholder="po box" value="{vcard:post-office-box}" />
        </div>
    </div>
</div>

1.6. calli.insertResource

1.6.1. Description

Inserts an RDFa resource into a dropzone. The new resource URI is read from the text/uri-list of the dropped data.

1.6.2. Signature

calli.insertResource( event )

Parameter Description
event HTML drop event

1.6.3. Example


<div id="related" dropzone="link string:text/uri-list" class="control-group"
        ondrop="return calli.insertResource(event)">
    <label class="control-label">Related</label>
    <div rel="skos:related" class="controls vbox">
        <span resource="?related" typeof="skos:Concept" class="ui-state-highlight ui-corner-all">
            <span property="skos:prefLabel" />
        </span>
    </div>
</div>

// Or, create your own pseudo event
calli.insertResource(jQuery.extend(jQuery.Event('drop'),
  {target:$('#id-of-dropzone')[0],dataTransfer:{getData:function(){return url_of_resource}}}
));

1.7. calli.removeResource

1.7.1. Description

Removes an RDFa resource from the page.

1.7.2. Signature

calli.removeResource( event )

Parameter Description
event HTML click event

1.7.3. Example


<span about="?medium" typeof="skos:Concept" class="ui-state-highlight ui-corner-all">
  <span property="skos:prefLabel" />
  <a href="{?medium}" title="Remove" onclick="return calli.removeResource(event)" class="ui-icon ui-icon-close" />
</span>

1.8. calli.error

Presents the given string (or the message or the description property of the given object) to the user using the calli:error-alert template of the layout.


try {
    throw "error message";
} catch (e) {
    calli.error(e);
}

1.9. calliSubmit

The calliSubmit event is triggered from forms with enctype="application/rdf+xml", enctype="application/sparql-update", editor forms, or method="PUT" (if the form's @enctype matches the input[type=file] @accept attribute).

Event property Description Example
type Event type always "calliSubmit"
resource URI of the resource that will be created or edited "http://example.com/this-resource"
payload request body rdf+xml string, sparql-update string, file object
preventDefault() Stops the form from submitting

1.10. calliDelete

Triggered when the calli.deleteResource function is called.

Event function Description Example
type Event type always "calliDelete"
resource URI of the resource that will be deleted "http://example.com/this-resource"
location The DELETE request URL "http://example.com/this-resource?edit"
preventDefault() Stops the resource from being deleted

1.11. calliRedirect

Triggered when the submit or delete operation is successful.

Event property Description Example
type Event type always "calliRedirect"
resource URI of the resource that was created, edited, or deleted "http://example.com/this-resource"
location The redirect target "http://example.com/this-resource?view"
cause submit, calliSubmit, or calliDelete event object {type:"calliSubmit"}
preventDefault() Cancels the redirection

Chapter 2. XProc Reference

XProc is a W3C recommended XML Pipeline Language.

Callimachus provides the following steps that can be used by importing the /callimachus/library.xpl file. <p:import href="/callimachus/library.xpl" />

2.1. calli:decode-text

The calli:decode-text step removes encoding of text. This step behaves like p:unescape-markup, but only decodes it and does not convert text to XML.


<p:declare-step type="calli:decode-text">
    <p:input port="source" sequence="true" primary="true" />
    <p:option name="content-type" select="'text/plain'"/>
    <p:option name="encoding"/>
    <p:option name="charset"/>
    <p:output port="result" sequence="true" />
</p:declare-step>
Option Description Example
content-type The content-type of the data to be decoded application/sparql
charset The character set of the encoded text UTF-8
encoding

One of the following encodings

  • base64
  • base32
  • hex
  • binary
  • quoted-printable
  • www-form-urlencoded
base64

2.2. calli:render-html

The calli:render-html step populates a template using RDF data. The data is retrived using the calli:sparql step.


<p:declare-step name="render-html" type="calli:render-html">
    <p:serialization port="result" media-type="text/html" method="html" doctype-system="about:legacy-compat" />
    <p:input port="source" sequence="true" primary="true" />
    <p:input port="parameters" kind="parameter" primary="true" />
    <p:input port="query" sequence="false" />
    <p:input port="template" sequence="false" />
    <p:output port="result" sequence="true" primary="true" />
    <p:option name="output-base-uri" select="''" />
    <p:option name="endpoint" select="''" />
</p:declare-step>

The RDF data can be provided in the source port as RDF/XML or with the provided SPARQL endpoint.

The SELECT query (and its parameters) are used to select the (exactly one) variable and zero or more bindings. The actualy SPARQL Query sent to the endpoint will be created as a combination of the provided query and the properties and relationships referenced in the template.

2.3. calli:sparql

The calli:sparql step produces application/sparql-results+xml from RDF data.


<p:declare-step type="calli:sparql">
    <p:input port="source" sequence="true" primary="true" />
    <p:input port="query" sequence="true" />
    <p:input port="parameters" kind="parameter" primary="true"/>
    <p:option name="output-base-uri" />
    <p:option name="endpoint" />
    <p:output port="result" sequence="true" />
</p:declare-step>

The RDF data can be provided in the source port as RDF/XML or with the provided SPARQL endpoint.

The SELECT parameters are populated in the query before evaluating the query against the data source.


Chapter 3. XQuery Reference

XQuery is a W3C recommended XML Query Language.

Callimachus provides the following functions that can be used by importing the /callimachus/layout-functions.xq file. import module namespace calli = "http://callimachusproject.org/rdf/2009/framework#" at "/callimachus/layout-functions.xq";

3.1. calli:head-nodes

Copies the XML nodes from the template's <head> element.


<head>
    {calli:head-nodes()}
</head>

3.2. calli:body-attributes

Copies the template's body attributes. It is important that this function be called directly after an element start tag, although some whitespace is permitted.


<head>
    {calli:head-nodes()}
</head>
<body>
    {calli:body-attributes()}
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    </div>
</body>

3.3. calli:body-sidebar

Returns a copy of the given element with the template's /html/body/div[@id='sidebar'] contents inside, or nothing, if no sidebar exists in the template.


{calli:body-sidebar(<div class="sidebar pull-right" />)}

3.4. calli:body-hgroup

Copies the template's h1 or hgroup element.


<body>
    {calli:body-hgroup()}
</body>

3.5. calli:body-nodes

Copies the templates body XML nodes that follow the h1, hgroup, and sidebar elements (or all nodes if none exist).


<div class="tab-content">
    {calli:body-nodes()}
</div>

3.6. calli:head-links

Copies the @href and other links from the template's <link> element that include a @title. The attributes are copied to the first given element and the @title is used as the content. The second given element is also returned if the template has titled <link> elements at all.


<menu type="list">
    {calli:head-links(<li><a /></li>,<li class="divider" />)}
</menu>

3.7. calli:styles-href

Adds an @href, of the default style sheet, to the given element.


{calli:styles-href(<link rel="stylesheet" />)}

3.8. calli:scripts-src

Adds @src, of the default script bundle, to the given element.


{calli:scripts-src(<script type="text/javascript" />)}

3.9. calli:lookup-form

Returns an HTML search form, searching the current realm, with the given string as a placeholder.


<div class="navbar-search pull-right hidden-logout">{calli:lookup-form('Lookup...')}</div>

3.10. calli:breadcrumb-links

Creates a placeholder for breadcrumbs that will use the given link element, an optional divider, and active element. @href and text content will be added to the given link element.


<nav class="breadcrumb">{calli:breadcrumb-links(<a class="muted"/>, <span class="divider">&#187;</span>, <span class="active"/>)}</nav>

3.11. calli:activate-nav

Create a placeholder element that will add @class="active" and remove @href and @onclick, to any <a> element with a @href of the query string (starting with '?').


{calli:activate-nav(<nav class="nav-tabs">
    <a href="?view">View</a>
    <a href="?edit">Edit</a>
</nav>)}

3.12. calli:lastmod-time

Create a place holder element that will subsitute the <time> element within the given element with the last modification timestamp of the resource, or nothing if unknown.


<footer>
    {calli:lastmod-time(<p>This resource was last modified at <time class="abbreviated"/></p>)}
</footer>

3.13. calli:error-alert

Creates an error template that will be used by calli.error. An error message is appended to a copy of the given element.


{calli:error-alert(<div class="alert alert-error alert-block">
    <button type="button" class="close" data-dismiss="alert">×</button>
    <h4>Oops!</h4>
</div>)}

3.14. calli:generator-p

Appends markup about Callimachus to the given element.


<footer>
    {calli:generator-p(<p class="pull-right" />)}
</footer>

3.15. calli:home-href

Adds an @href to the given element that links to the home folder's directory target.


<header>
    {calli:home-href(<a>Callimachus</a>)}
</header>

3.16. calli:folder-href

Adds an @href to the given element for the view page of the home folder.


<menu type="list" class="dropdown-menu">
    <li>{calli:folder-href(<a>Home folder</a>)}</li>
</menu>

3.17. calli:changes-href

Adds an @href to the give element that links to the recent changes for the current realm.


<menu type="list" class="dropdown-menu">
    <li>{calli:folder-href(<a>Home folder</a>)}</li>
    <li>{calli:changes-href(<a>Recent changes</a>)}</li>
</menu>

3.18. calli:view-href

Adds @href to the given element that links to the view page of the current resource.


<nav class="nav-tabs">
    {calli:view-href(<a>View</a>)}
    {calli:edit-href(<a>Edit</a>)}
    {calli:discussion-href(<a>Discussion</a>)}
    {calli:describe-href(<a>Describe</a>)}
    {calli:history-href(<a>History</a>)}
</nav>

3.19. calli:edit-href

Adds @href to the given element that links to the edit page of the current resource.


<nav class="nav-tabs">
    {calli:view-href(<a>View</a>)}
    {calli:edit-href(<a>Edit</a>)}
    {calli:discussion-href(<a>Discussion</a>)}
    {calli:describe-href(<a>Describe</a>)}
    {calli:history-href(<a>History</a>)}
</nav>

3.20. calli:discussion-href

Adds @href to the given element that links to the discussion page of the current resource.


<nav class="nav-tabs">
    {calli:view-href(<a>View</a>)}
    {calli:edit-href(<a>Edit</a>)}
    {calli:discussion-href(<a>Discussion</a>)}
    {calli:describe-href(<a>Describe</a>)}
    {calli:history-href(<a>History</a>)}
</nav>

3.21. calli:describe-href

Adds @href to the given element that links to the describe page of the current resource.


<nav class="nav-tabs">
    {calli:view-href(<a>View</a>)}
    {calli:edit-href(<a>Edit</a>)}
    {calli:discussion-href(<a>Discussion</a>)}
    {calli:describe-href(<a>Describe</a>)}
    {calli:history-href(<a>History</a>)}
</nav>

3.22. calli:history-href

Adds @href to the given element that links to the history page of the current resource.


<nav class="nav-tabs">
    {calli:view-href(<a>View</a>)}
    {calli:edit-href(<a>Edit</a>)}
    {calli:discussion-href(<a>Discussion</a>)}
    {calli:describe-href(<a>Describe</a>)}
    {calli:history-href(<a>History</a>)}
</nav>

3.23. calli:whatlinkshere-href

Adds @href to the give element that links to the what-links-here page of the current resource.


{calli:whatlinkshere-href(<a>What links here</a>)}

3.24. calli:relatedchanges-href

Adds @href to the given element that links to the related changes page of the current resource.


{calli:relatedchanges-href(<a>Related changes</a>)}

3.25. calli:permissions-href

Adds @href to the given element that links to the permission page of the current resource.


{calli:permissions-href(<a>Permissions</a>)}

3.26. calli:introspect-href

Adds @href to the given element that links to the introspect page of the current resource.


{calli:introspect-href(<a>Introspect resource</a>)}

3.27. calli:login-href

Adds attributes to the given element that are needed to activate the login process.


<menu type="toolbar">
    <li class="hidden-login">{calli:login-href(<a>Sign in</a>)}</li>
</menu>

3.28. calli:profile-href

Adds attributes to the given element that will link to the current user's identifier/profile page. The content of the element will be replace.


{calli:profile-href(<a>My account</a>)}

3.29. calli:logout-href

Adds attributes to the given element that will initiate the logout sequence when clicked.


{calli:logout-href(<a>Sign out</a>)}

Chapter 4. SPARQL Reference

SPARQL is a W3C recommended query language for RDF.

4.1. keyword:phone

All of the words in the values of the listed properties will also be indexed using the predicate keyword:phone that can be used to search for resources by label word.


PREFIX keyword:<http://www.openrdf.org/rdf/2011/keyword#>

SELECT ?resource
WHERE {
    ?resource keyword:phone ?soundex
    FILTER sameTerm(?soundex, keyword:soundex("example"))
    FILTER EXISTS { ?resource ?p ?term FILTER regex(?term, keyword:regex("example")) }
}

4.2. keyword:soundex

The keyword:soundex SPARQL function converts the given string into a soundex code (comatible with keyword:phone).

4.3. keyword:regex

The keyword:regex SPARQL function provides a accent/case-insensitive regular expression that can be used to further filter the match.

4.4. List of searched labels

The following RDF properties may be searched.

Common QName URI
og:title http://ogp.me/ns#title
dc:title http://purl.org/dc/elements/1.1/title
dcterms:title http://purl.org/dc/terms/title
gr:legalName http://purl.org/goodrelations/v1#legalName
rss:title        http://purl.org/rss/1.0/title
fb:type.object.name        http://rdf.freebase.com/ns/type.object.name
sioc:name http://rdfs.org/sioc/ns#name
gn:alternateName http://www.geonames.org/ontology#alternateName
gn:name http://www.geonames.org/ontology#name
gn:officialName http://www.geonames.org/ontology#officialName
gn:shortName        http://www.geonames.org/ontology#shortName
rdfs:label http://www.w3.org/2000/01/rdf-schema#label
skos:altLabel http://www.w3.org/2004/02/skos/core#altLabel
skos:hiddenLabel http://www.w3.org/2004/02/skos/core#hiddenLabel
skos:prefLabel http://www.w3.org/2004/02/skos/core#prefLabel
vcard:additional-name        http://www.w3.org/2006/vcard/ns#additional-name
vcard:family-name http://www.w3.org/2006/vcard/ns#family-name
vcard:fn http://www.w3.org/2006/vcard/ns#fn
vcard:given-name http://www.w3.org/2006/vcard/ns#given-name
vcard:label http://www.w3.org/2006/vcard/ns#label
vcard:nickname http://www.w3.org/2006/vcard/ns#nickname
vcard:organization-name http://www.w3.org/2006/vcard/ns#organization-name
vcard:organization-unit http://www.w3.org/2006/vcard/ns#organization-unit
skosxl:literalForm http://www.w3.org/2008/05/skos-xl#literalForm
foaf:name        http://xmlns.com/foaf/0.1/name

Chapter 5. Callimachus REST API

Most Callimachus features may be accessed via REST API calls, which makes it easy to integrate Callimachus with other applications.

This chapter provides a summary of features available via REST, examples of usage, and programmatic guidance for developers.

5.1. About the Callimachus REST API

REpresentational State Transfer (REST) is a resource-oriented architectural style commonly used on the World Wide Web.

RESTful manipulation of resources in Callimachus requires some caveats. Readers may think of some kinds of content as "file" oriented, such as a HTML or plain text file, a JPEG image or a Javascript document, and other types of more conceptual content as "data" or "metadata", such as a user, group, menu definition or concept. Callimachus' REST API makes similar distinctions between Binary Large Object (BLOB) content and RDF content; however, the distinctions are not always as you might expect. How should we treat an RDF document that is uploaded to Callimachus, represented as a "file" in Callimachus' folder interface and yet whose contents are stored in an RDF database? Appendices B: BLOB Resource Types and C: RDF Resource Types list the various content types in Callimachus and associates them with the appropriate segments of the API. Please read carefully :)

Examples are provided that use a fictitious Callimachus authority (http://example.com:8080), fictitious URL paths, and fictitious parameters. This is intentional to encourage you to discover the correct URLs in accordance with this documentation. Any specific URL patterns we might otherwise document would be subject to change in future releases. Keep in mind that the service URLs may be on different hosts than the requested URI. You will thus not be able to copy-and-paste the examples directly into your browser; you will need to change the examples to match your environment. Examples requiring authentication show a username of "john"; your name may be different, so you will need to modify them as appropriate for your Callimachus username.

Examples show HTTP requests and responses, including relevant headers. Examples are also given that use the curl command-line utility, which is available for all major operating systems. See http://curl.haxx.se/ for details on curl.

NB: Callimachus includes (as of version 0.15) a script to clear its server-side cache. It is possible under some circumstances (e.g. removing triples from blank resources using the sparql endpoint) for the server-side cache to become stale. A systems administrator may run the command <installation directory>/bin/callimachus-reset.sh (or .bat) if server-side caching problems are suspected.

5.1.1. Authentication

Some functionality may only be accessed by authenticated users. Which functionality is restricted may be controlled by Callimachus' permissions system. However, by default the SPARQL endpoint and Create/Update/Delete functions are so restricted.

Callimachus uses HTTP Digest access authentication curl commands for authenticated commands require the --digest and --user parameters:

curl --digest --user john …

5.1.2. Correct URL Discovery

The URLs in the examples below are completely fictitious. HTTP does not transmit fragment identifiers, so the use of "#rel=..." in the examples below is mainly intended as a identifier of where the correct URL can be found or should be put. The correct URL itself can be discovered using an HTTP OPTIONS request or from an earlier response.

5.2. Browsing content

Callimachus supports iterative resource-oriented discovery of folder and "file" resources. Callimachus folders may be discovered and traversed using the REST API. Each folder may be introspected to discover its contents. Contents of folders may be either file-like resources (Binary Large Objects or BLOBs) or RDF resources (in RDF/XML or Turtle formats). BLOBs are stored in a BLOB store and RDF is stored in an RDF database. Folders are virtual constructs so you do not need to know what kind of resource you are dealing with; the interface abstracts one away from that information. The various resource types are described in Appendices.

General metadata regarding a Callimachus instance may be found by requesting an HTTP OPTIONS response from the top-level URL:

OPTIONS http://example.com:8080/ HTTP/1.1

The equivalent curl command is:

curl -i --digest --user john -X OPTIONS "http://example.com:8080/"

A typical response is shown below. Look specifically at the link: header:

HTTP/1.1 204 No Content
Age: 0
ETag: W/"274dde21-a038f4fe"
Last-Modified: Fri, 17 Feb 2012 15:24:45 GMT
Date: Fri, 17 Feb 2012 16:25:20 GMT
Cache-Control: public
access-control-allow-headers: Authorization,Host,Cache-Control,Location,Range,Accept,Accept-Charset,Accept-Encoding,
  Accept-Language,Content-Encoding,Content-Language,Content-Length,Content-Location,Content-MD5,Content-Type,
  If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since
access-control-allow-origin: *
allow: OPTIONS, TRACE, POST, GET, HEAD, DELETE, PUT
link: <http://example.com:8080/#rel=version-history>; rel="version-history"; type="application/atom+xml;q=0.5 text/html"
link: <http://example.com:8080/#rel=search>; rel="search"; type="application/opensearchdescription+xml"
link: <http://example.com:8080/#rel=describedby>; rel="describedby"; type="text/html"; title="RDF Describe"
link: <http://example.com:8080/#rel=contents>; rel="contents"; type="application/atom+xml;q=0.5"
link: <http://example.com:8080/#rel=..archive>; rel="http://callimachusproject.org/rdf/2009/framework#archive"
link: <http://example.com:8080/#rel=alternate&type=html>; rel="alternate"; type="text/html"
link: <http://example.com:8080/#rel=alternate&type=atom>; rel="alternate"; type="text/html application/atom+xml;q=0.5"
content-version: "274dde21"
vary: Accept,Access-Control-Request-Method
access-control-allow-methods: OPTIONS, TRACE, POST, GET, HEAD, DELETE, PUT
Accept-Ranges: bytes
Content-Length: 0
Server: Callimachus Server/Callimachus 0.15

To get a list of top-level resources, look for the Contents URL in the link: header with rel=”contents” (in this fictious case, http://example.com:8080/#rel=contents). Perform an HTTP GET on the URL using an Accept: header as noted in the type attribute (in this case, application/atom+xml), e.g.

GET http://example.com:8080/#rel=contents HTTP/1.1
Accept: application/atom+xml

The equivalent curl command is:

curl -H "Accept: application/atom+xml" "http://example.com:8080/#rel=contents"

Typical results will look like the following. Note that only the first one hundred resources are shown.

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:calli="http://callimachusproject.org/rdf/2009/framework#"
  xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:app="http://www.w3.org/2007/app">
        <id>http://example.com:8080/#rel=contents</id>
        <link href="http://example.com:8080/#rel=describedby" rel="describedby"/>
        <title>example.com:8080</title>
        <app:collection href="http://example.com:8080/#app:collection">
                <title>example.com:8080</title>
                <app:accept>text/plain</app:accept>
                <app:accept>application/rdf+xml</app:accept>
                <app:accept>text/turtle</app:accept>
                <app:accept>application/xhtml+xml</app:accept>
                <app:accept>application/font-woff</app:accept>
                <app:accept>application/sparql-query</app:accept>
                <app:accept>application/docbook+xml</app:accept>
                <app:accept>text/css</app:accept>
                <app:accept>text/xsl</app:accept>
                <app:accept>text/html</app:accept>
                <app:accept>image/gif</app:accept>
                <app:accept>image/vnd.microsoft.icon</app:accept>
                <app:accept>image/png</app:accept>
                <app:accept>image/svg+xml</app:accept>
                <app:accept>image/jpeg</app:accept>
                <app:accept>text/javascript</app:accept>
        </app:collection>
        <link href="http://example.com:8080/#rel=alternate&amp;type=atom" rel="alternate" type="application/atom+xml"/>
        <updated>2012-02-23T13:55:59.504Z</updated>
        <openSearch:totalResults>5</openSearch:totalResults>
        <link href="http://example.com:8080/#rel=search" rel="search" type="application/opensearchdescription+xml"/>
        <entry>
                <id>http://example.com:8080/.well-known/</id>
                <title>.well known</title>
                <updated>2012-02-17T15:02:22.556Z</updated>
                <icon>http://example.com:8080/callimachus/folder.png</icon>
                <link href="http://example.com:8080/auth/groups/users" rel="http://callimachusproject.org/rdf/2009/framework#reader" title="users"/>
                <link href="http://example.com:8080/auth/groups/staff" rel="http://callimachusproject.org/rdf/2009/framework#reader" title="staff"/>
                <link href="http://example.com:8080/auth/groups/admin" rel="http://callimachusproject.org/rdf/2009/framework#administrator" title="admin"/>
                <content src="http://example.com:8080/.well-known/"/>
                <link href="http://example.com:8080/.well-known/#rel=contents" rel="contents" type="application/atom+xml"/>
                <link href="http://example.com:8080/.well-known/#rel=..archive" rel="http://callimachusproject.org/rdf/2009/framework#archive" type="application/zip"/>
                <link href="http://example.com:8080/.well-known/#rel=alternate&amp;type=html" rel="alternate" type="text/html"/>
                <link href="http://example.com:8080/.well-known/#rel=describedby" rel="describedby"/>
                <link href="http://example.com:8080/.well-known/#rel=version-history" rel="version-history"/>
        </entry>
        <entry>
                <id>http://example.com:8080/callimachus/</id>
                <title>callimachus</title>
                <updated>2012-02-09T17:35:14.984Z</updated>
                <icon>http://example.com:8080/callimachus/folder.png</icon>
                <link href="http://example.com:8080/auth/groups/staff" rel="http://callimachusproject.org/rdf/2009/framework#reader" title="staff"/>
                <link href="http://example.com:8080/auth/groups/admin" rel="http://callimachusproject.org/rdf/2009/framework#administrator" title="admin"/>
                <content src="http://example.com:8080/callimachus/"/>
                <link href="http://example.com:8080/callimachus/#rel=contents" rel="contents" type="application/atom+xml"/>
                <link href="http://example.com:8080/callimachus/#rel=..archive" rel="http://callimachusproject.org/rdf/2009/framework#archive" type="application/zip"/>
                <link href="http://example.com:8080/callimachus/#rel=alternate&amp;type=html" rel="alternate" type="text/html"/>
                <link href="http://example.com:8080/callimachus/#rel=describedby" rel="describedby"/>
                <link href="http://example.com:8080/callimachus/#rel=version-history" rel="version-history"/>
        </entry>
        <entry>
                <id>http://example.com:8080/main-article.docbook</id>
                <title>main article</title>
                <updated>2012-02-06T01:27:09.545Z</updated>
                <icon>http://example.com:8080/callimachus/article.png</icon>
                <link href="http://example.com:8080/auth/groups/users" rel="http://callimachusproject.org/rdf/2009/framework#reader" title="users"/>
                <link href="http://example.com:8080/auth/groups/staff" rel="http://callimachusproject.org/rdf/2009/framework#editor" title="staff"/>
                <link href="http://example.com:8080/auth/groups/admin" rel="http://callimachusproject.org/rdf/2009/framework#administrator" title="admin"/>
                <link href="http://example.com:8080/main-article.docbook#rel=edit-media" rel="edit-media"/>
                <content src="http://example.com:8080/main-article.docbook" type="application/docbook+xml"/>
                <link href="http://example.com:8080/main-article.docbook#rel=alternate&amp;type=html" rel="alternate" type="text/html"/>
                <link href="http://example.com:8080/main-article.docbook#rel=describedby" rel="describedby"/>
                <link href="http://example.com:8080/main-article.docbook#rel=version-history" rel="version-history"/>
        </entry>
        <entry>
                <id>http://example.com:8080/sparql</id>
                <title>sparql</title>
                <contributor>
                        <name>James Leigh</name>
                        <uri>http://example.com:8080/user/james</uri>
                </contributor>
                <updated>2012-02-23T13:55:59.504Z</updated>
                <link href="http://example.com:8080/auth/groups/admin" rel="http://callimachusproject.org/rdf/2009/framework#administrator" title="admin"/>
                <content src="http://example.com:8080/sparql"/>
                <link href="http://example.com:8080/sparql#rel=alternate&amp;type=html" rel="alternate" type="text/html"/>
                <link href="http://example.com:8080/sparql#rel=describedby" rel="describedby"/>
                <link href="http://example.com:8080/sparql#rel=version-history" rel="version-history"/>
        </entry>
</feed>

The query above provided the contents and description of the top-level folder. The details may change in subsequent Callimachus releases. Resolving the URL of a folder will allow you to traverse the folder hierarchy.

Folders may be identified by the presence of an Atom feed with rel="contents" type="application/atom+xml" in a resource record. News readers may be used to track changes to Callimachus folders by subscribing to the alternate Atom feed (with rel="alternate" and type="application/atom+xml"), which will sort resources by last modified data. e.g.

<link href="http://example.com:8080/#rel=alternate&amp;type=atom" rel="alternate" type="application/atom+xml"/>

5.3. Bulk changes

The entire contents of Callimachus folders, including all BLOB and RDF resources, may be exported into a Callimachus Archive (CAR) file. A CAR file is a ZIP version 3 formatted file that contains Callimachus-specific metadata. Exporting a CAR file from a folder recursively creates an archive of that folder's contents (not the folder itself), including any subfolders.

Exportation of CAR files may be performed at runtime and may be used for "hot" backup of the contents of a Callimachus server. Please also note that exportation of large amounts of RDF content will increase server load and may best be scheduled during quiet usage periods.

5.3.1. Export

Performing an HTTP OPTIONS on a folder URL returns a link: header with rel=”...#archive”, a content type and the folder's Archive URL to be used to get an export of the folder's contents. Performing a GET on the Archive URL using an Accept: header as noted in the type attribute (generally application/zip) will download the folder's contents as a ZIP version 3 file containing Callimachus-specific content. This is called a Callimachus Archive (CAR) file.

To get an export of a folder called "/exportme/":

GET http://example.com:8080/exportme/#rel=..archive HTTP/1.1
Accept: application/zip
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john -H "Accept: application/zip" "http://example.com:8080/exportme/#rel=..archive" > exportme.car

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 200 OK
Content-Disposition:  attachment;filename="test-example.com.car"
Content-Type:  application/zip
Server:  Callimachus Server/Callimachus 0.15

<Binary ZIP file content here>

NB: CAR files contain a folder's contents, including any subfolders and their contents. CAR files do not contain a top-level folder; a new folder must be first created when importing CAR files.

5.3.2. Import

CAR files do not contain a top-level folder and must thus be imported into an existing folder. Create a folder before importing a CAR into it. It is not recommended to import CAR files into the top-level folder due to the presence of folders and resources necessary to the operation of Callimachus.

Performing an HTTP OPTIONS on a folder URL returns a link: header with rel=”...#archive”, a content type and the folder's Archive URL to be used to import the folder's contents. Performing an HTTP PUT with a Content-Type: header of application/zip and a body of a CAR file will replace the contents of a folder.

To replace the contents of a folder called "/importme/" with the CAR file exportme.car, first make the folder "/importme/" and then:

PUT http://example.com:8080/importme/#rel=..archive HTTP/1.1
Content-Type: application/zip
Authorization: Digest username="john", realm="http://example.com:8080/", ...

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 204 No Content
Server: Callimachus Server/Callimachus 0.15
...

5.3.3. Delete

Performing an HTTP OPTIONS on a folder URL returns a link: header with rel=”...#archive”, a content type and the folder's Archive URL to be used to delete the folder's contents. Performing an HTTP DELETE will delete the entire contents of a folder recursively, but it will not delete the folder itself.

To delete the contents of a folder called /deleteme/:

DELETE http://example.com:8080/deleteme/#rel=..archive
Authorization: Digest username="john", realm="http://example.com:8080/", ...

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 204 No Content
Server: Callimachus Server/Callimachus 1.0
...

5.4. CRUD operations on BLOB content

5.4.1. Overview

This describes how to create, retrieve, update and delete BLOB content in Callimachus. 

BLOB files in Callimachus may include text or HTML pages, images, CSS stylesheets, etc. See Appendix for supported file types. However, bulk RDF instance data is also loaded via files and is thus treated as a BLOB for the purposes of this API, even though Callimachus will load it into an RDF database after ingestion.

To perform CRUD operations on BLOB content, first retrieve the Atom contents feed for the folder you want to operate in. See the section on Browsing Content above for details.

Operations

5.4.2. Create

Content may be created in a folder by issuing an HTTP POST to the folder's URL provided in the app:collection element of the folder's Atom contents feed. The body of the POST consists of the contents of the file you wish to upload. The HTTP header Content-Type: must be set appropriately for the type of file. Take note of the acceptable file types in Appendix. The file name you wish to create must be provided in the HTTP request header Slug:, whose value should be URI safe. See slug syntax.

The app:collection tag lists the MIME types that are acceptable to your Callimachus server.

For example, let's say you wanted to create an image called mylogo.png in the top-level folder. If the image file is located in a file of that name in the present working directory:

POST http://example.com:8080/#app:collection HTTP/1.1
Slug: mylogo.png
Content-Type: image/png
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john --data-binary @mylogo.png -H "Content-Type: image/png" -H "Slug: mylogo.png" \
  "http://example.com:8080/#app:collection"

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 201 Created
Location:  http://example.com:8080/mylogo.png
Server:  Callimachus Server/Callimachus 0.15

NB: Callimachus Folders are RDF resources. See the section CRUD Operations on RDF Content for details on how to create folders.

5.4.3. Retrieve

Resources may be retrieved by performing an HTTP GET on the resource's edit media URL. A resource's edit media URL may be discovered by looking for the appropriate entry tag in the containing folder's Atom feed and then finding the link tag with rel="edit-media".

To retrieve the image created above:

GET http://example.com:8080/mylogo.png#rel=edit-media HTTP/1.1
Accept: image/png

The equivalent curl command is:

curl "http://example.com:8080/mylogo.png#rel=edit-media" > mylogo_copy.png

5.4.4. Update

Resources may be updated by performing an HTTP PUT on the resource's edit media URL. A resource's edit media URL may be discovered by looking for the appropriate entry tag in the containing folder's Atom feed and then finding the link tag with rel="edit-media".

The body of the PUT consists of the contents of the file you wish to upload. The HTTP header Content-Type: must be set appropriately for the type of the file.

To update the image created above:

PUT http://example.com:8080/mylogo.png#rel=edit-media HTTP/1.1
Content-Type: image/png
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john --upload-file "mylogo.png" -H "Content-Type: image/png" \
  "http://example.com:8080/mylogo.png#rel=edit-media"

Normal HTTP response codes are used to indicate success or failure of the request.

5.4.5. Delete

Resources may be deleted by performing an HTTP DELETE on the resource's edit media URL. A resource's URL may be discovered by looking for the appropriate entry tag in the containing folder's Atom feed and then finding the link tag with rel="edit-media".

To delete the image created above:

DELETE http://example.com:8080/mylogo.png#rel=edit-media HTTP/1.1
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john -I -X DELETE "http://example.com:8080/mylogo.png#rel=edit-media"

Normal HTTP response codes are used to indicate success or failure of the request. In this case, a successful delete is indicated by a 204 (No Content) response.

5.5. CRUD operations on RDF content

5.5.1. Overview

This describes how to create, retrieve, update and delete RDF content. 

Many resources in Callimachus are defined solely by RDF statements. These include folders, users, groups and concepts, but not bulk RDF instance data (see the section CRUD Operations on BLOB Content for those). See Appendix for supported RDF resource types.

Operations

5.5.2. Create

RDF resources are created by performing an HTTP POST to the URL enclosing folder's describedby URL with a Content-Type ofapplication/sparql-update and a body of a SPARQL INSERT DATA command. The response will include a Location: header with the URL of the resource created. The RDF data needs to include a supported rdf:type (see Appendix for details). This approach may only be used to insert one resource at a time (a single identified RDF Subject; additional resources may be inserted if they are blank nodes or hash URIs off of the identified Subject).

As a reminder, the enclosing folder's describedby URL may be found via its Atom feed (where the attribute rel=="describedby"). See the Browsing Content section for more details.

If you wanted to make a folder called "test" at the top level, first create a file with the appropriate SPARQL INSERT DATA query. We'll save this file with a name of "testcreate.ru":

BASE <http://example.com:8080/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX calli: <http://callimachusproject.org/rdf/2009/framework#>

INSERT DATA {
    <test/> a calli:Folder, </callimachus/Folder> ;
        rdfs:label "test" .
}

The HTTP POST looks like this:

POST http://example.com:8080/#rel=describedby HTTP/1.1
Content-Type: application/sparql-update
Authorization: Digest username="john", realm="http://example.com:8080/", ...

BASE <http://example.com:8080/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX calli: <http://callimachusproject.org/rdf/2009/framework#>

INSERT DATA {
    <test/> a calli:Folder, </callimachus/Folder> ;
        rdfs:label "test" .
}

The equivalent curl command is:

curl --digest --user john --data-binary @testcreate.ru -H "Content-Type: application/sparql-update" \
  "http://example.com:8080/#rel=describedby"

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 201 Created
Location:  http://example.com:8080/test/

5.5.3. Retrieve

Performing an HTTP OPTIONS on an RDF resource's created URI returns a link: header with rel=”decribedby” and the resource's DescribedBy URL. Performing an HTTP GET on the DescribedBy URL with an Accept: header of text/turtle or application/rdf+xml will return an RDF representation of the resource.

For a folder called "/test":

OPTIONS http://example.com:8080/test/ HTTP/1.1

The equivalent curl command is:

curl -I -X OPTIONS http://example.com:8080/test/

Results would look like:

HTTP/1.1 204 No Content
Link: <http://example.com:8080/test/#rel=version-history>; rel="version-history"; type="application/atom+xml;q=0.5 text/html"
Link: <http://example.com:8080/test/#rel=describedby>; rel="describedby"; type="text/html"; title="RDF Describe"
Link: <http://example.com:8080/test/#rel=contents>; rel="contents"; type="application/atom+xml;q=0.5"
Link: <http://example.com:8080/test/#rel=alternate&type=html>; rel="alternate"; type="text/html"
Link: <http://example.com:8080/test/#rel=..archive>; rel="http://callimachusproject.org/rdf/2009/framework#archive"
Link: <http://example.com:8080/test/#rel=alternate&type=atom>; rel="alternate"; type="text/html application/atom+xml;q=0.5"

Performing an HTTP GET on the DescribedBy URL returns the RDF. In this case, the Turtle format is requested. The result would be a Turtle document with the triples used in the Create section, above.

GET http://example.com:8080/test/#rel=describedby HTTP/1.1
Accept: text/turtle

The equivalent curl command is:

curl -H "Accept: text/turtle" "http://example.com:8080/test/#rel=describedby"

Normal HTTP response codes are used to indicate success or failure of the request.

5.5.4. Update

Performing an HTTP OPTIONS on an RDF resource's created URI returns a link: header with rel=”decribedby” and the resource's describedby URL. See also the discussion regarding HTTP 303 responses from a created URI in the Retrieve section, above. Performing an HTTP PATCH on the describedby URL with an Content-Type: header of application/sparql-update and a body of a SPARQL DELETE INSERT will update the resource.

NB: Updating a Folder, User, Group etc, has the potential to negatively impact internal Callimachus state: Be Careful!

To update the RDF definition of the "/test/" folder, first create a SPARQL DELETE INSERT query and put it into a file (in this case we'll call the file "testupdate.ru"). The contents of the file might look like this:

BASE <http://example.com:8080/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
​DELETE {
        </test/> rdfs:label ?label .
}
INSERT {
        </test/> rdfs:label "Test Folder" .
}
WHERE {
        </test/> rdfs:label ?label .
}

The HTTP command is then:

PATCH http://example.com:8080/test/#rel=describedby HTTP/1.1
Content-Type: application/sparql-update
Authorization: Digest username="john", realm="http://example.com:8080/", ...

BASE <http://example.com:8080/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

DELETE {
        </test/> rdfs:label ?label .
}
INSERT {
        </test/> rdfs:label "Test Folder" .
}
WHERE {
        </test/> rdfs:label ?label .
}

The equivalent curl command is:

curl --digest --user john -X PATCH --data-binary @testupdate.ru -H "Content-Type: application/sparql-update" \
  "http://example.com:8080/test/#rel=describedby"

Normal HTTP response codes are used to indicate success or failure of the request:

HTTP/1.1 204 No Content
Server: Callimachus Server/Callimachus 0.1
...

5.5.5. Delete

Performing an HTTP OPTIONS on an RDF resource's created URI returns a link: header with rel=”decribedby” and the resource's describedby URL. See also the discussion regarding HTTP 303 responses from a created URI in the Retrieve section, above. Performing an HTTP DELETE on the DescribedBy URL will delete the resource.

To delete the "/test/" folder:

DELETE http://example.com:8080/test/#rel=describedby HTTP/1.1
Authorization: Digest username="john", realm="http://example.com:8080/", ...

The equivalent curl command is:

curl --digest --user john -I -X DELETE "http://example.com:8080/test/#rel=describedby"

Normal HTTP response codes are used to indicate success or failure of the request. In this case, a successful delete is indicated by a 200 (OK) or 204 (No Content) response.

5.6. Searching content

Here we will explore two RESTful ways of searching for content using Callimachus:

5.6.1. Keyword searches

Keyword searches may be performed on certain RDF properties. See Appendix A for a list of RDF properties that may be searched.

An OpenSearch description document may be discovered by resolving the top-level OPTIONS and looking for the Search URL. Find the link:header with rel="search" (See the section Browsing Content for details). Search results are returned in an Atom document augmented with OpenSearch response elements.

Perform an HTTP GET on the Search URL. Provide an Accept: header including its associated content type. For example:

GET http://example.com/#rel=search HTTP/1.1
Accept: application/opensearchdescription+xml

The equivalent curl command is:

curl -H "Accept: application/opensearchdescription+xml" "http://example.com/#rel=search"

Which will result in:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>example.com</ShortName>
<Url type="application/atom+xml" template="http://example.com/#rel=search&amp;searchTerms={searchTerms}"/>
</OpenSearchDescription>

You may then perform a subsequent HTTP GET on the Template URL using the content type specified (in the Url tag's template and typeattributes), substituting your search terms for "{searchTerms}". Note that keyword searches require authentication. To actually perform a keyword search on, for example, the word "Callimachus":

GET http://example.com/#rel=search&searchTerms=Callimachus HTTP/1.1
Accept: application/atom+xml
Authorization: Digest username="john", realm="http://example.com/", ...

The equivalent curl command is:

curl --digest --user john -H "Accept: application/atom+xml" "http://example.com/#rel=search&searchTerms=Callimachus"

Results will look like:

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:calli="http://callimachusproject.org/rdf/2009/framework#"
  xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:app="http://www.w3.org/2007/app">
        <id>http://example.com/#rel=search&amp;searchTerms=Callimachus</id>
        <title>example.com:8080</title>
        <updated>2012-02-23T13:55:59.504Z</updated>
        <entry>
                <id>http://example.com/callimachus/images/callimachus-icon.ico</id>
                <link href="http://example.com/callimachus/images/callimachus-icon.ico#rel=alternate&amp;type=html" rel="alternate"
  type="text/html"/>
                <title>callimachus icon</title>
                <updated>2012-02-24T01:25:04.753Z</updated>
                <content src="http://example.com/callimachus/images/callimachus-icon.ico" type="text/xsl"/>
        </entry>
        <entry>
                <id>http://example.com/callimachus/callimachus-ontology.ttl</id>
                <link href="http://example.com/callimachus/callimachus-ontology.ttl#rel=alternate&amp;type=html" rel="alternate"
  type="text/html"/>
                <title>callimachus ontology</title>
                <updated>2012-02-24T01:24:55.979Z</updated>
                <content src="http://example.com/callimachus/callimachus-ontology.ttl" type="text/xsl"/>
        </entry>
        ...
</feed>

See the OpenSearch description for details on the OpenSearch description document syntax and the OpenSearch response elements.

5.6.2. SPARQL queries

The SPARQL Query Language may be used to query RDF content. Requesting Callimachus' SPARQL endpoint via an HTTP GET with an Accept: header of text/html or application/xhtml+xml (as a browser should) will return an HTML form suitable for human-centric queries. The SPARQL endpoint may also be directly used via REST calls as described below.

The location of the SPARQL endpoint may be discovered by resolving Callimachus' VoID description and parsing out its location.

GET http://example.com/.well-known/void HTTP/1.1
Accept: application/rdf+xml

Note that this and other responses may respond with an HTTP 303 (See Other) response directing you to another location via the Location:header:

HTTP/1.1 303 See Other
Location: http://example.com/.well-known/void#rel=describedby
Content-Length: 0
...

Resolve the URL provided there for the canonical location of the VoID description:

GET http://example.com/.well-known/void#rel=describedby HTTP/1.1
Accept: application/rdf+xml

The equivalent curl command is:

curl -L -H "Accept: application/rdf+xml" "http://example.com/.well-known/void"

A typical response looks like:

HTTP/1.1 200 OK
Age:  0
Etag:  W/"5811c8ee-7566acc1"
Last-Modified:  Fri, 24 Feb 2012 14:49:19 GMT
Date:  Fri, 24 Feb 2012 17:14:01 GMT
Content-Type:  application/rdf+xml
Cache-Control:  public,max-age=868
Access-Control-Allow-Origin:  *
content-version:  "5811c8ee"
Content-Encoding:  gzip
Vary:  Accept,Accept-Charset
Content-MD5:  jUThXJZm7pQvWlmF6OKTNw==
Accept-Ranges:  bytes
Content-Length:  423
Server:  Callimachus Server/Callimachus 0.15-SNAPSHOT

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:foaf="http://xmlns.com/foaf/0.1/"
        xmlns:void="http://rdfs.org/ns/void#"
        xmlns:audit="http://www.openrdf.org/rdf/2009/auditing#">

<rdf:Description rdf:about="http://example.com/.well-known/void">
        <audit:revision rdf:resource="http://example.com/change/t1358bd5c49cx0"/>
        <rdf:type rdf:resource="http://rdfs.org/ns/void#DatasetDescription"/>
        <rdfs:label>void</rdfs:label>
        <foaf:primaryTopic rdf:resource="http://example.com/.well-known/void#dataset"/>
</rdf:Description>

<rdf:Description rdf:about="http://example.com/.well-known/void#dataset">
        <rdf:type rdf:resource="http://rdfs.org/ns/void#Dataset"/>
        <foaf:homepage rdf:resource="http://example.com/"/>
        <void:sparqlEndpoint rdf:resource="http://example.com/sparql"/>
        <void:rootResource rdf:resource="http://example.com/"/>
        <void:openSearchDescription rdf:resource="http://example.com/#rel=search"/>
        <void:uriSpace rdf:resource="http://example.com/"/>
</rdf:Description>

</rdf:RDF>

The SPARQL endpoint URL is provided in the void:sparqlEndpoint tag.

Use the SPARQL Protocol to perform queries via REST. See the SPARQL Protocol specification for URL parameters and the SPARQL Query Language specification for details of the query language.

curl --digest --user john --data-urlencode query@test.rq -H accept:application/sparql-results+xml http://example.com/sparql
curl --digest --user john --data-urlencode update@test.ru http://example.com/sparql

5.7. BLOB Resource Types

Here are the BLOB resource types that you can use in Callimachus.

Resource type Content type
Article application/docbook+xml
Font application/font-woff
PDF application/pdf
NamedGraph application/rdf+xml (goes into RDF and BLOB store)
NamedQuery application/sparql-query
Page application/xhtml+xml
Pipeline application/xproc+xml
XQuery application/xquery
AnimatedGraphic image/gif
Photo image/jpeg
NetworkGraphic image/png
VectorGraphic image/svg+xml
IconGraphic image/vnd.microsoft.icon
Style text/css
HypertextFile text/html
Script text/javascript
TextFile text/plain
GraphDocument text/turtle (goes into RDF and BLOB store)
Transform text/xsl

5.8. RDF Resource Types

Here are the default RDF resource types used in Callimachus. Users can create their own RDF resource types by creating a Callimachus class.

Resource type Content type Required Property
SKOS Concept skos:Concept, </callimachus/1.0/types/Concept> skos:prefLabel
Folder calli:Folder, </callimachus/1.0/types/Folder> rdfs:label
Group calli:Party, calli:Group, </callimachus/1.0/types/Group> rdfs:label

NB: Classes require compilation and are not manipulatable via the REST API.