The creation of new information stores is follows the concept of HTTP to create
a new resource. A simple post request on not yet existing URLs creates a new information
store. For the HTTP request you need to specify
- The request URL (the information store URI)
- The method (POST)
- A schema (obligaroty)
The requested URL must not be existing when performing the request.
After the request was successfuly performed you receive the corresponding result
To delete a information store, you specify the resource to delete by its request
URL and submit a HTTP DELETE request to this URL.
The newly created information store using the XML data adapter can be bound to a
schema if submitted along with the POST request. An exemplary XSD is given below:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Person"
targetNamespace="http://www.webcomposition.net/2007/10/test/person.xsd"
elementFormDefault="qualified"
xmlns="http://www.webcomposition.net/2007/10/test/person.xsd"
xmlns:mstns="http://www.webcomposition.net/2007/10/test/person.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name"
type="xs:string"/>
<xs:element name="lastName"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
To bind the information store to the given, the schem is submitted along as the
POST request's content. This has to be accomplished while creating the resource
using the initial POST request.
Creating new items is accoplished by using the PUT method along with a HTTP request.
Since the creation of data is understood as the modification of an existing resource
(i.e. the information store) the PUT method. The PUT method is applied to the information
store's URL we want to add the item to.
The XML for the example we used is
<person>
<name>Heil</name>
<firstName>Andreas</firstName>
</person>
After the request was successfuly performed you receive the corresponding result.
To recive the information store's content perform a HTTP request on its URL
using the GET verb. The following information is required to receive results:
- The request URL (the information store's URI)
- The content type header value for the request
The live demo is using text/xml as default content type header value for its request.
The consequent usage of meta data is a key concept of the WebComposition/DGS appraoch.
Therefore, each service and infomation store provide the reserved URI .../meta
to access the resouce's meta data. While the internal representation and processing
is accomplished by RDF, the user can choose variy filters for different input and
output formats of the meta data. The meta information for the example can be requested
by sending a HTTP request using the GET method to the corresponding URL.
The default import filter allows to add meta data in form of Notation3, a easy to
write foramt for RDF. The meta data is added by submitting it along with a HTTP
request using the PUT verb to the .../meta URL of a resource. The format of the
input data depends on the input filter for the corresponding data dapter defined
in the Web.config.
The service will confirm after adding the meta data by a corresponding response.
Deleting meta data is accomplished by sending a HTTP request using the DELETE
method providing the exact tripple to be deleted.
UrlTemplates help to identify elements within complex data structures and provide URIs for elements within complex XML structures.
This example shows how to adress an element within information store created before. The data provided looks simiar to
<people>
<person>
<name>Heil</name>
<firstName>Andreas</firstName>
</person>
<person>
<name>Gaedke</name>
<firstName>Martin</firstName>
</person>
<person>
<name>Meinecke</name>
<firstName>Johannes</firstName>
</person>
</people>
To address a dedicated element within this XML structure, UrlTemplates can be used to map URLs to XML elements within a inforamtion store.
In this exemple, the adress to be mapped is
http://localhost/DataGridService/DataGridService/people/Heil
UrlTemplates as the following are added using the .../meta URL of a information
store. A HTTP request and the PUT method using the .../meta URL of the
information store allow to add this UrlTemplate.
The UrlTemplate in Notation3 looks as below. The two tripples specify the URL to be replaced and the XPath expression to be used to locate the required elements.
@prefix meta: <http://www.webcomposition.net/2008/02/dgs/meta/>.
<http://localhost/DataGridService/datagridservice/people>
meta:urlTemplate [meta:url "people/{value}";
meta:xPath "/people/person[name='{value}']" ].
After adding the UrlTemplate the resource can be addressed using the specified URL.