Examples of Query
Last modified 18:30 ET November 26, 2007
Assumptions:
- Jazz is running at http://example.com
- client has already been authenticated as a user named Zoe
- existing project /jazz/projects/main
- zoe is authorized to work in project main
- no extant resources
- indexing rule for XML namespace http://music.example.com/schema
Each step shows 1 round trip from client to server.
==========================================
STEP 50
The client creates a resource at /jazz/resources/main/A.
PUT /jazz/resources/main/A HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t500]
Content-Type: application/xml
Content-Length: [nnn]
If-None-Match: *
HTTP/1.1 201 CREATED
Date: [t500]
Content-Length: [nnn]
The server creates the resource.
STEP 51
The client creates a resource at /jazz/resources/main/B.
PUT /jazz/resources/main/B HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t510]
Content-Type: application/xml
Content-Length: [nnn]
If-None-Match: *
HTTP/1.1 201 CREATED
Date: [t510]
Content-Length: [nnn]
The server creates the resource.
STEP 52
The client creates a resource at /jazz/resources/main/C.
PUT /jazz/resources/main/C HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t520]
Content-Type: application/xml
Content-Length: [nnn]
If-None-Match: *
HTTP/1.1 201 CREATED
Date: [t520]
Content-Length: [nnn]
The server creates the resource.
STEP 53
The client creates a resource at /jazz/resources/main/D.
PUT /jazz/resources/main/D HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t530]
Content-Type: text/plain
Content-Length: [nnn]
If-None-Match: *
California girls
HTTP/1.1 201 CREATED
Date: [t530]
Content-Length: [nnn]
The server creates the text resource.
STEP 54
The client creates a resource at /jazz/resources/main/E. The content of the entry resource is /jazz/resources/main/D.
PUT /jazz/resources/main/E HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t540]
Content-Type: application/atom+xml;type=entry
Content-Length: [nnn]
If-None-Match: *
California girls
pop
english
1965-08-01T00:00:01Z
HTTP/1.1 201 CREATED
Date: [t540]
Content-Length: [nnn]
The server creates the resource.
STEP 55
The client runs a query to locate resources with XML root element name "track".
GET /jazz/projects/main/query?http://www.w3.org/1999/02/22-rdf-syntax-ns%23type=http://music.example.com/schema%23track HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t550]
Content-Length: [nnn]
HTTP/1.1 200 OK
Date: [t550]
Content-Length: [nnn]
Content-Type: application/atom+xml
ETag: [tag550]
Last-Modified: [t550]
[some server-assigned id]
Query results
[t550]
System
[hunoz]
[hucairz]
[t550]
System
[hunoz]
[hucairz]
[t550]
System
[hunoz]
[hucairz]
[t550]
System
The server returns an atom:feed whose entries are the 3 resource with that type of XML root element.
STEP 56
The client runs a query to locate resources with title "Ruby tuesday".
GET /jazz/projects/main/query?http://music.example.com/schema%23title=Ruby%20tuesday HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t560]
Content-Length: [nnn]
HTTP/1.1 200 OK
Date: [t560]
Content-Length: [nnn]
Content-Type: application/atom+xml
ETag: [tag560]
Last-Modified: [t560]
[some server-assigned id]
Query results
[t560]
System
[hunoz]
[hucairz]
[t560]
System
The server returns an atom:feed whose entries is the one resource with that title.
STEP 57
The client runs a query to locate resources with genre "pop" and retrieve their title and genre.
GET /jazz/projects/main/query?queryNS=http://music.example.com/schema&genre=pop&properties=title,genre HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t570]
Content-Length: [nnn]
HTTP/1.1 200 OK
Date: [t570]
Content-Length: [nnn]
Content-Type: application/atom+xml
ETag: [tag570]
Last-Modified: [t570]
[some server-assigned id]
Query results
[t570]
System
[hunoz]
[hucairz]
[t570]
System
Do you know the way to San Jose
pop
[hunoz]
[hucairz]
[t570]
System
Non, je ne regrette rien
ballad
pop
[hunoz]
[hucairz]
[t570]
System
California girls
pop
The server returns an atom:feed whose entries is the three resources with that genre. Note that resource "C" was indexed under 2 genres, one of which matches the query. The entries include the title and genre of each of the resources.
STEP 58
The client updates the resource at /jazz/resources/main/B to include the index property genre "pop".
PUT /jazz/resources/main/B HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t580]
Content-Type: application/xml
Content-Length: [nnn]
If-Match: [tag510]
If-Unmodified-Since: [t510]
HTTP/1.1 204 No content
Date: [t580]
Content-Length: [nnn]
The server updates the resource "B", and updates the properties under which it is indexed to add the genre "pop".
STEP 59
The client runs a query to locate resources with genre "pop" and language "french".
GET /jazz/projects/main/query?http://music.example.com/schema%23genre=pop
&http://music.example.com/schema%23language=french HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t590]
Content-Length: [nnn]
HTTP/1.1 200 OK
Date: [t590]
Content-Length: [nnn]
Content-Type: application/atom+xml
ETag: [tag590]
Last-Modified: [t590]
[some server-assigned id]
Query results
[t590]
System
[hunoz]
[hucairz]
[t590]
System
The server returns an atom:feed whose entry is the one resource with that genre and language.
STEP 59A
The client updates the resource at /jazz/resources/main/C to remove the index property genre "pop".
PUT /jazz/resources/main/C HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t591]
Content-Type: application/xml
Content-Length: [nnn]
If-Match: [tag520]
If-Unmodified-Since: [t520]
HTTP/1.1 204 No content
Date: [t591]
Content-Length: [nnn]
The server updates the resource "C", and updates the properties under which it is indexed to withdraw the genre "pop".
STEP 59B
The client runs a query to locate resources of any type with genre "pop" and language "french".
GET /jazz/projects/main/query?http://music.example.com/schema%23genre=pop
&http://music.example.com/schema%23language=french HTTP/1.1
Host: example.com
Authorization: [zoe's credentials]
Date: [t592]
Content-Length: [nnn]
HTTP/1.1 200 OK
Date: [t592]
Content-Length: [nnn]
Content-Type: application/atom+xml
ETag: [tag592]
Last-Modified: [t592]
[some server-assigned id]
Query results
[t592]
System
The server says there are no hits
(End of examples.)