<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="/wikid/docs/xsl/mwCollections/CollectionWikiPages/display.xsl" type="text/xsl"?>

<!--
This resource container holds the product of the resolution request
-->
<resource xmlns:config="info:sid/localhost:CollectionSimpleSchemas:config" xmlns:explain="http://explain.z3950.org/dtd/2.0/" xmlns:srw="http://www.loc.gov/zing/srw/" xmlns:wiki="info:sid/localhost:CollectionSimpleSchemas:wiki" xmlns:wr="http://errol.oclc.org/oai:xmlregistry.oclc.org:errol/WikiRepository" xmlns:xlink="http://www.w3.org/TR/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
This is an echo of the request information this stylesheet used to produce the resolution product
-->
<uri-context>
<srwIdentifier>info:sid/localhost:CollectionWikiPages:WikiDUpdateApis</srwIdentifier>
<collectionURI>info:sid/localhost:CollectionWikiPages</collectionURI>
<repository-identifier>CollectionWikiPages</repository-identifier>
<srwURL>http://alcme.oclc.org:80/wikid/search/WikiDb.localhost</srwURL>
<local-identifier>WikiDUpdateApis</local-identifier>
<action>display</action>
</uri-context>
<!--
This is the collection configuration record
-->
<record xmlns="info:sid/localhost:CollectionSimpleSchemas:config" xsi:schemaLocation="info:sid/localhost:CollectionSimpleSchemas:config http://alcme.oclc.org/metawiki/raw/info:sid/localhost:CollectionSimpleSchemas:config.xsd">
<repositoryName>Wiki Pages</repositoryName>
<localIdentifierType>userAssigned</localIdentifierType>
<adminEmail>mailto:jyoung@oclc.org</adminEmail>
<defaultXSL>no</defaultXSL>
<schemaURI recordPrefix="wiki">info:sid/localhost:CollectionSimpleSchemas:wiki</schemaURI>
<crosswalkSchemaURI recordPrefix="xhtml">info:sid/localhost:CollectionExternalSchemas:xhtml</crosswalkSchemaURI>
<defaultSchemaURI>info:sid/localhost:CollectionExternalSchemas:xhtml</defaultSchemaURI>
</record>
<!--
There is a local-identifier, so this URI must identify an item in a collection
-->
<!--
This is the searchRetrieveResponse for the item's Deposit record
-->
<content>
<searchRetrieveResponse xmlns="http://www.loc.gov/zing/srw/">
<version>1.1</version>
<numberOfRecords>1</numberOfRecords>
<resultSetId>cxspdq</resultSetId>
<resultSetIdleTime>300</resultSetIdleTime>
<records xmlns:ns1="http://www.loc.gov/zing/srw/">
<record>
<recordSchema>http://www.oclc.org/schemas/WikiRepository</recordSchema>
<recordPacking>xml</recordPacking>
<recordData>
<wr:Deposit xmlns="http://www.w3.org/TR/xhtml1/strict">
<wr:browserPath>http://alcme.oclc.org:80/wikid/docs/WikiRepository</wr:browserPath>
<wr:refID>info:sid/localhost:CollectionWikiPages:WikiDUpdateApis</wr:refID>
<wr:refIDPrefix/>
<wr:userName>anonymous</wr:userName>
<wr:collection>CollectionWikiPages</wr:collection>
<wr:relativePath>2006/04/13/16</wr:relativePath>
<wr:fullRefID>inf_3asid_2flocalhost_3aCollectionWikiPages_3aWikiDUpdateApis_5f20060413162418034</wr:fullRefID>
<wr:mimeType>text/xml</wr:mimeType>
<wr:sort>CollectionWikiPages:WikiDUpdateApis</wr:sort>
<wr:dateCreated>2006-04-13</wr:dateCreated>
<wr:datestamp>2006-04-13</wr:datestamp>
<wr:oldDate/>
</wr:Deposit>
</recordData>
<recordPosition>1</recordPosition>
</record>
</records>
<echoedSearchRetrieveRequest xmlns:ns2="http://www.loc.gov/zing/srw/">
<version>1.1</version>
<query>repos.hasDate = "hasdate" and oai.identifier exact "info:sid/localhost:CollectionWikiPages:WikiDUpdateApis"</query>
<xQuery>
<ns3:searchClause xmlns:ns3="http://www.loc.gov/zing/cql/xcql/">
<ns3:index>cql.any</ns3:index>
<ns3:relation>
<ns3:value>=</ns3:value>
</ns3:relation>
<ns3:term>huh?</ns3:term>
</ns3:searchClause>
</xQuery>
<startRecord>1</startRecord>
<maximumRecords>1</maximumRecords>
<recordPacking>xml</recordPacking>
<recordSchema>default</recordSchema>
</echoedSearchRetrieveRequest>
</searchRetrieveResponse>
<!--
This is the datestamp for the Deposit
-->
<datestamp>2006-04-13</datestamp>
<!--
This is the URL for the content
-->
<contentURL>http://alcme.oclc.org:80/wikid/docs/WikiRepository/2006/04/13/16/inf_3asid_2flocalhost_3aCollectionWikiPages_3aWikiDUpdateApis_5f20060413162418034</contentURL>
<!--
Here is the record content
-->
<record>
<record xmlns="info:sid/localhost:CollectionSimpleSchemas:wiki" xsi:schemaLocation="info:sid/localhost:CollectionSimpleSchemas:wiki http://alcme.oclc.org:80/wikid/raw/info:sid/localhost:CollectionSimpleSchemas:wiki.xsd">
<raw>= WikiD Update APIs =
There are several layers of APIs that get used for updating. Any of them ''could'' be accessed directly, but in general it is best to think of the WikiD and OpenURL layers as interoperable APIs and the others as replacable implementation details hidden behind a WikiD OpenURL Community Profile.
== WikiD ==
This update layer is modeled as a wiki "action". WikiD mechanically transforms these wiki-style requests into an OpenURL 1.0-compliant form and hands them off to an OpenURL resolver for processing. Typically, this service is invoked as an HTML FORM ACTION METHOD="POST".
 &lt;baseURL&gt;/C''''''ollectionWikiPages:N''''''onCollectionTest
 ?schemaURI=info'''''':sid/localhost:C''''''ollectionSimpleSchemas:wiki
 &amp;001.raw=test
 &amp;action=Create
** C''''''ollectionWikiPages:N''''''onCollectionTest: The shorthand collection/item identifer (referent) assigned to the record being edited.
** schemaURI: The CollectionSimpleSchemas or CollectionExternalSchemas identifier indicating the type of record that should be created. (To be honest, I don't know why I added this because this information can be deduced from the CollectionCollection record for the referent.)
** 001.raw: One or more key/value pairs containing the fields of the record to be created. The numeric prefix is a clue to WebEdit indicating the preferred order of elements in the record that will be created. The XSL stylesheet used by WebEdit to transform the data into a native XML form has the option of ignoring these clues. Nevertheless, the numeric prefixes are required, even if they are all the same. The remainder of the key's name should be chosen according to the semantic needs of the styleseheet.
** action: "Create", "Update", or "Delete"
== OpenURL update service ==
This update layer is a thin OpenURL "private data" service that invokes the WebEdit update API before returning the client to an appropriate target page. The OpenURL resolver is located at &lt;baseURL&gt;/resolver. Here is the XML ContextObject that gets generated for the example shown above:
 &lt;?xml version="1.0" encoding="UTF-8"?&gt;
 &lt;ctx:context-object xmlns:ctx="info'''''':ofi/fmt:xml:xsd:ctx"
 xmlns:xsi="http''''''://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="info'''''':ofi/fmt:xml:xsd:ctx
 http''''''://www.openurl.info/registry/docs/info'''''':ofi/fmt:xml:xsd:ctx"
 timestamp="2006-04-13T11:10:43Z"
 version="Z39.88-2004"&gt;
 &lt;ctx:referent&gt;
 &lt;ctx:identifier&gt;info'''''':sid/localhost:C''''''ollectionWikiPages:N''''''onCollectionTest&lt;/ctx:identifier&gt;
 &lt;/ctx:referent&gt;
 &lt;ctx:referrer&gt;
 &lt;ctx:identifier&gt;info'''''':sid/oclc.org:referrer/Wiki''''''D&lt;/ctx:identifier&gt;
 &lt;/ctx:referrer&gt;
 &lt;ctx:service-type&gt;
 &lt;ctx:private-data&gt;
 schemaURI=info%3Asid%2Flocalhost%3AC''''''ollectionSimpleSchemas%3Awiki&amp;amp;001.raw=test&amp;amp;action=Create
 &lt;/ctx:private-data&gt;
 &lt;/ctx:service-type&gt;
 &lt;ctx:referring-entity&gt;
 &lt;ctx:identifier&gt;http''''''://alcme.oclc.org/wikid/N''''''onCollectionTest&lt;/ctx:identifier&gt;
 &lt;/ctx:referring-entity&gt;
 &lt;/ctx:context-object&gt;
== WebEdit ==
See WebEdit for general information.

This update layer is a non-standards-based (but lightweight and open-source) web service that takes HTML form submittals, transforms them into a native XML representation, and hands them off to another web service (SRU Record Update in this case) for further processing. In theory, the WikiD and OpenURL service layers could be bypassed in favor of calling the WebEdit layer directly from the HTML FORM, but for various reasons this isn't feasible in the case of WikiD. For example, the addition of a Preview submit button (which WebEdit wouldn't recognize) next to an Update submit button (which WebEdit does recognize) would make this particularly awkward. It would also undermine the philosophy that WikiD is derived from an OpenURL Community Profile and that WebEdit is an implementation detail within that framework.

Furthermore, the Servlet for WebEdit was omitted from the WikiD distribution in favor of having the OpenURL service call the underlying methods directly from code. This is basically because the WebEdit Servlet ''thinks'' it knows what type of XML record it should produce from an HTML form submittal, but because WikiD can store arbitrary XML records in its database, the situation isn't quite so straightforward in this case. The workaround was to break WebEdit into two separate method calls. One method transforms HTML form submittals into a target XML record, and the other invokes the SRU Record Update layer. The Servlet blindly calls one after the other, but WikiD needs to step in between to Base64-encode the "native record" and embed it in a metadata record along with selected bits of information to satisfy the SRU Record Update requirement that all records in the database share a common XML Schema. (Although the current WebEdit Servlet doesn't account for this scenario, it could/should be enhanced to support it eventually.) WikiD, then, takes responsibility for knowing that the native record is subordinate to the metadata record. The advantage is that one database can be used to satisfy WikiD's need to store arbitrary XML records.
== SRU Record Update ==
This update layer is a standards-based update protocol (http://srw.cheshire3.org/docs/update/'''''') developed by the SRU Community (http://www.loc.gov/standards/sru/''''''). The web service is located at &lt;baseURL&gt;/WikiDb.localhost/Update.

Parameters to SRU Update are:
* request.recordIdentifier: The URI assigned to the record
* request.version: "1.0"
* request.operation: "info:srw/operation/1/create", "info:srw/operation/1/replace", or "info:srw/operation/1/delete"
* request.record: Something like this:
** record.recordSchema="info:oclc/schema/1/UpdateRepository-v1.1"
** record.recordPacking="string"
** record.recordData=:
 &lt;Deposit&gt;
 &lt;refID&gt;info'''''':sid/localhost:C''''''ollectionWikiPages:N''''''onCollectionTest&lt;/refID&gt;
 &lt;userName&gt;anonymous&lt;/userName&gt;
 &lt;collection&gt;C''''''ollectionWikiPages&lt;/collection&gt;
 &lt;mimeType&gt;text/xml&lt;/mimeType&gt;
 &lt;sort&gt;C''''''ollectionWikiPages:N''''''onCollectionTest&lt;/sort&gt;
 &lt;simpleObject&gt;PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pg0K
 PHJlY29yZCB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3Rh
 bmNlIiB4bWxucz0iaW5mbzpzaWQvbG9jYWxob3N0OkNvbGxlY3Rpb25TaW1wbGVTY2hlbWFzOndp
 a2kiIHhzaTpzY2hlbWFMb2N''''''hdGlvbj0iaW5mbzpzaWQvbG9jYWxob3N0OkNvbGxlY3Rpb25TaW1w
 bGVTY2hlbWFzOndpa2kgaHR0cDovL3lvdW5nLWoub2Eub2N''''''sYy5vcmc6NDM0Mi93aWtpZC9yYXcv
 aW5mbzpzaWQvbG9jYWxob3N0OkNvbGxlY3Rpb25TaW1wbGVTY2hlbWFzOndpa2kueHNkIj4NCjxy
 YXc+dGVzdDwvcmF3Pg0KPC9yZWNvcmQ+DQo=&lt;/simpleObject&gt;
 &lt;/Deposit&gt;

*** refID: The URI assigned to the record
*** userName: An identifier for the user who submitted the record
*** collection: The local identifier for a collection registered in CollectionCollection
*** mimeType: The mime type for the data stored in &lt;simpleObject&gt;
*** sort: Text that can be used for SRU sorting and presented in brief results lists.
*** simpleObject: A Base64-encoded XML record. WARNING! The XML namespace for this record MUST match the native schemaURI specified in the CollectionCollection registry for &lt;collection&gt;.
</raw>
</record>
</record>
</content>
<displayContent>
<html xmlns="http://www.w3.org/1999/xhtml">
<body><h1> WikiD Update APIs </h1>
There are several layers of APIs that get used for updating. Any of them <em>could</em> be accessed directly, but in general it is best to think of the <a href="WikiD">WikiD</a> and OpenURL layers as interoperable APIs and the others as replacable implementation details hidden behind a <a href="WikiD">WikiD</a> OpenURL Community Profile.
<h2> WikiD </h2>
This update layer is modeled as a wiki &quot;action&quot;. <a href="WikiD">WikiD</a> mechanically transforms these wiki-style requests into an OpenURL 1.0-compliant form and hands them off to an OpenURL resolver for processing. Typically, this service is invoked as an HTML FORM ACTION METHOD=&quot;POST&quot;.
<pre>
 &lt;baseURL&gt;/CollectionWikiPages:NonCollectionTest
 ?schemaURI=info:sid/localhost:CollectionSimpleSchemas:wiki
 &amp;001.raw=test
 &amp;action=Create</pre>

<ul>
<ul>
<li> CollectionWikiPages:NonCollectionTest: The shorthand collection/item identifer (referent) assigned to the record being edited.</li>
<li> schemaURI: The <a href="./CollectionSimpleSchemas">CollectionSimpleSchemas</a> or <a href="./CollectionExternalSchemas">CollectionExternalSchemas</a> identifier indicating the type of record that should be created. (To be honest, I don't know why I added this because this information can be deduced from the <a href="./CollectionCollection">CollectionCollection</a> record for the referent.)</li>
<li> 001.raw: One or more key/value pairs containing the fields of the record to be created. The numeric prefix is a clue to <a href="WebEdit">WebEdit</a> indicating the preferred order of elements in the record that will be created. The XSL stylesheet used by <a href="WebEdit">WebEdit</a> to transform the data into a native XML form has the option of ignoring these clues. Nevertheless, the numeric prefixes are required, even if they are all the same. The remainder of the key's name should be chosen according to the semantic needs of the styleseheet.</li>
<li> action: &quot;Create&quot;, &quot;Update&quot;, or &quot;Delete&quot;</li>
</ul>
</ul>

<h2> OpenURL update service </h2>
This update layer is a thin OpenURL &quot;private data&quot; service that invokes the <a href="WebEdit">WebEdit</a> update API before returning the client to an appropriate target page. The OpenURL resolver is located at &lt;baseURL&gt;/resolver. Here is the XML <a href="ContextObject">ContextObject</a> that gets generated for the example shown above:
<pre>
 &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
 &lt;ctx:context-object xmlns:ctx=&quot;info:ofi/fmt:xml:xsd:ctx&quot;
 xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
 xsi:schemaLocation=&quot;info:ofi/fmt:xml:xsd:ctx
 http://www.openurl.info/registry/docs/info:ofi/fmt:xml:xsd:ctx&quot;
 timestamp=&quot;2006-04-13T11:10:43Z&quot;
 version=&quot;Z39.88-2004&quot;&gt;
 &lt;ctx:referent&gt;
 &lt;ctx:identifier&gt;info:sid/localhost:CollectionWikiPages:NonCollectionTest&lt;/ctx:identifier&gt;
 &lt;/ctx:referent&gt;
 &lt;ctx:referrer&gt;
 &lt;ctx:identifier&gt;info:sid/oclc.org:referrer/WikiD&lt;/ctx:identifier&gt;
 &lt;/ctx:referrer&gt;
 &lt;ctx:service-type&gt;
 &lt;ctx:private-data&gt;
 schemaURI=info%3Asid%2Flocalhost%3ACollectionSimpleSchemas%3Awiki&amp;amp;001.raw=test&amp;amp;action=Create
 &lt;/ctx:private-data&gt;
 &lt;/ctx:service-type&gt;
 &lt;ctx:referring-entity&gt;
 &lt;ctx:identifier&gt;http://alcme.oclc.org/wikid/NonCollectionTest&lt;/ctx:identifier&gt;
 &lt;/ctx:referring-entity&gt;
 &lt;/ctx:context-object&gt;</pre>

<h2> WebEdit </h2>
See <a href="WebEdit">WebEdit</a> for general information.<p></p>
This update layer is a non-standards-based (but lightweight and open-source) web service that takes HTML form submittals, transforms them into a native XML representation, and hands them off to another web service (SRU Record Update in this case) for further processing. In theory, the <a href="WikiD">WikiD</a> and OpenURL service layers could be bypassed in favor of calling the <a href="WebEdit">WebEdit</a> layer directly from the HTML FORM, but for various reasons this isn't feasible in the case of <a href="WikiD">WikiD</a>. For example, the addition of a Preview submit button (which <a href="WebEdit">WebEdit</a> wouldn't recognize) next to an Update submit button (which <a href="WebEdit">WebEdit</a> does recognize) would make this particularly awkward. It would also undermine the philosophy that <a href="WikiD">WikiD</a> is derived from an OpenURL Community Profile and that <a href="WebEdit">WebEdit</a> is an implementation detail within that framework.<p></p>
Furthermore, the Servlet for <a href="WebEdit">WebEdit</a> was omitted from the <a href="WikiD">WikiD</a> distribution in favor of having the OpenURL service call the underlying methods directly from code. This is basically because the <a href="WebEdit">WebEdit</a> Servlet <em>thinks</em> it knows what type of XML record it should produce from an HTML form submittal, but because <a href="WikiD">WikiD</a> can store arbitrary XML records in its database, the situation isn't quite so straightforward in this case. The workaround was to break <a href="WebEdit">WebEdit</a> into two separate method calls. One method transforms HTML form submittals into a target XML record, and the other invokes the SRU Record Update layer. The Servlet blindly calls one after the other, but <a href="WikiD">WikiD</a> needs to step in between to Base64-encode the &quot;native record&quot; and embed it in a metadata record along with selected bits of information to satisfy the SRU Record Update requirement that all records in the database share a common XML Schema. (Although the current <a href="WebEdit">WebEdit</a> Servlet doesn't account for this scenario, it could/should be enhanced to support it eventually.) <a href="WikiD">WikiD</a>, then, takes responsibility for knowing that the native record is subordinate to the metadata record. The advantage is that one database can be used to satisfy <a href="WikiD">WikiD</a>'s need to store arbitrary XML records.
<h2> SRU Record Update </h2>
This update layer is a standards-based update protocol (<a href="http://srw.cheshire3.org/docs/update/">http://srw.cheshire3.org/docs/update/</a>) developed by the SRU Community (<a href="http://www.loc.gov/standards/sru/">http://www.loc.gov/standards/sru/</a>). The web service is located at &lt;baseURL&gt;<a href="/wikid/WikiDUpdateApis/WikiDb">/WikiDb</a>.localhost/Update.<p></p>
Parameters to SRU Update are:
<ul>
<li> request.recordIdentifier: The URI assigned to the record</li>
<li> request.version: &quot;1.0&quot;</li>
<li> request.operation: &quot;<a href="./info:srw/operation/1/create">info:srw/operation/1/create</a>&quot;, &quot;<a href="./info:srw/operation/1/replace">info:srw/operation/1/replace</a>&quot;, or &quot;<a href="./info:srw/operation/1/delete">info:srw/operation/1/delete</a>&quot;</li>
<li> request.record: Something like this:
<ul>
<li> record.recordSchema=&quot;<a href="./info:oclc/schema/1/UpdateRepository-v1.1">info:oclc/schema/1/UpdateRepository-v1.1</a>&quot;</li>
<li> record.recordPacking=&quot;string&quot;</li>
<li> record.recordData=:</li>
</ul>
</li>
</ul>

<pre>
 &lt;Deposit&gt;
 &lt;refID&gt;info:sid/localhost:CollectionWikiPages:NonCollectionTest&lt;/refID&gt;
 &lt;userName&gt;anonymous&lt;/userName&gt;
 &lt;collection&gt;CollectionWikiPages&lt;/collection&gt;
 &lt;mimeType&gt;text/xml&lt;/mimeType&gt;
 &lt;sort&gt;CollectionWikiPages:NonCollectionTest&lt;/sort&gt;
 &lt;simpleObject&gt;PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/Pg0K
 PHJlY29yZCB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3Rh
 bmNlIiB4bWxucz0iaW5mbzpzaWQvbG9jYWxob3N0OkNvbGxlY3Rpb25TaW1wbGVTY2hlbWFzOndp
 a2kiIHhzaTpzY2hlbWFMb2NhdGlvbj0iaW5mbzpzaWQvbG9jYWxob3</pre>
<a href="N0OkNvbGxlY3Rpb25TaW1w">N0OkNvbGxlY3Rpb25TaW1w</a>
<pre>
 bGVTY2hlbWFzOndpa2kgaHR0cDovL3lvdW5nLWoub2Eub2NsYy5vcmc6NDM0Mi93aWtpZC9yYXcv
 aW5mbzpzaWQvbG9jYWxob3N0OkNvbGxlY3Rpb25TaW1wbGVTY2hlbWFzOndpa2kueHNkIj4NCjxy
 YXc+dGVzdDwvcmF3Pg0KPC9yZWNvcmQ+DQo=&lt;/simpleObject&gt;
 &lt;/Deposit&gt;</pre>
<p></p>
<ul>
<ul>
<ul>
<li> refID: The URI assigned to the record</li>
<li> userName: An identifier for the user who submitted the record</li>
<li> collection: The local identifier for a collection registered in <a href="./CollectionCollection">CollectionCollection</a></li>
<li> mimeType: The mime type for the data stored in &lt;simpleObject&gt;</li>
<li> sort: Text that can be used for SRU sorting and presented in brief results lists.</li>
<li> simpleObject: A Base64-encoded XML record. WARNING! The XML namespace for this record MUST match the native schemaURI specified in the <a href="./CollectionCollection">CollectionCollection</a> registry for &lt;collection&gt;.</li>
</ul>
</ul>
</ul>

</body>
</html>
</displayContent>
</resource>
