Skip to main content
Jazz Community SiteJazz Community SiteJazz.net HomepageJazz.net Homepage

Sample Resource Source

Using the Resource Representation Samples

This sample provides two simple client scripts to upload a set of resources based on the Resource Representation Samples and allows the user to see capabilities such as search, query, properties etc. To allow this, before uploading the sample resources the script uploads a set of indexing resources so that the uploaded resources will be correctly indexed. The following listing demonstrates the execution of the Python-based script.

$ python create.py

This sample requires you create the following users:
User Name       Password        Role           
simon           simon           Admin          
Press enter if you are ready to continue, or Ctrl-C

Reading the Root Service Document...
Posting "dcterms" indexer...
Posting "glossary" indexer...
Posting "planning" indexer...
Posting "supplemental" indexer...
Creating Glossary resource...
Creating Glossary feed...
Creating Glossary terms...
++  term-atom.xml
++  term-atom_entry.xml
++  term-atom_feed.xml
++  term-collection.xml
++  term-resource.xml
++  term-resource_representation.xml
Creating Requirements feed...
Creating Requirement entries...
++  req-collection_storage.xml
++  req-http_basic_auth.xml
++  req-http_digest_auth.xml
++  req-indexing.xml
++  req-indexing_msoffice.xml
++  req-query.xml
++  req-search.xml
++  req-simple_storage.xml

Alternatively you can run the create.cmd script which uses the command-line tool cURL to PUT and POST resources. This script can be useful as it can easily be copied to batch upload/create resources. The create.cmd script has been developed as a Windows command script, but this could easily be changed to make a Unix style shell script. Note that this tool requires a command line parameter containing the server base URL

C:\dev>create.cmd http://localhost:8082

Now, assuming you are running the server on the default port on localhost you can either paste the sample URLs into your browser or use the "try" link.

Review the requirements feed
/jazz/resources/openservices.requirements [try]
Review the first requirement
/jazz/resources/openservices.requirements/1 [try]
Review the first requirement properties
/jazz/resources/openservices.requirements/1?properties [try]
Search for resources containing the string "basic"
/jazz/services/search?q=basic [try]
Query for high priority M1 items
/jazz/services/query?
  http://example.org/xmlns/planning/v0.1%23milestone=M1&
  http://example.org/xmlns/supplemental/v0.1%23priority=High
[try]
Find terms related to "Atom"
/jazz/services/query?
  uri:http://example.org/xmlns/glossary/v0.1%23relatedTerm=
    /jazz/resources/openservices.glossaryfeed/atom
[try]
Find anything related to the term "Atom"
/jazz/services/query?query=
  SELECT+?url+WHERE+{+?url+?p+%3C/jazz/resources/openservices.glossaryfeed/atom%3E+.+}
[try]

Note the difference in these last two queries, in the first we use the conjunctive URL query to look for a particular term (relatedTerm) and provide the URL to the particular term we are interested in. The issue is when we don't know what elements hold links to the current term, they could be in a relatedTerm, synonym or something else we don't know about. To perform this query we have to move from the URL query to SPARQL and execute the following (unencoded) query:

SELECT ?url 
WHERE { ?url ?p </jazz/resources/openservices.glossaryfeed/atom> . }