Skip to content

Workset API

Jaimie Murdock edited this page Oct 17, 2016 · 3 revisions

This document describes the Workset API

GET /workset

List all public workset IDs, titles, and user, but not "gathers" field of the IDs inside the workset, but include numItems.
Content-Type: application/json
Response codes: 200
Require authentication: No, but if logged in, return own collections as well.

Sample response:

GET /workset

{
  "@context": "http://emblematica.library.illinois.edu/test/worksetcontext.jsonld",
  "@graph": [
    {
      "@id": "http://htrc.hathitrust.org/wsid/1616876109a",
      "@type": "Workset",
      "curator": "Jesse S Cohn",
      "numItems": 5,
      "title": "Anarchist literary and cultural criticism"
    },
    {
      "@id": "http://htrc.hathitrust.org/wsid/189324102",
      "@type": "Workset",
      "curator": "John Doe",
      "numItems": 3,
      "title": "Random Poetry"
    },
    {
      "@id": "http://htrc.hathitrust.org/wsid/18932476423",
      "@type": "Workset",
      "curator": "John Doe",
      "numItems": 6,
      "title": "A collection of various versions of Walt Whitman's 'The Ox-Tamer'"
    }
  ]
}

##GET /workset/{workset_id} Get the workset with the given ID. Content-Type: application/json
Response codes: 200, 404 (workset not found)
Require authentication: No

Sample response:

GET /workset/1616876109a

{
  "@context": "http://emblematica.library.illinois.edu/test/worksetcontext.jsonld",
  "@graph": [
    {
      "@id": "http://htrc.hathitrust.org/wsid/1616876109a",
      "@type": "Workset",
      "curator": "Jesse S Cohn",
      "numItems": 5,
      "title": "Anarchist literary and cultural criticism",
      "gathers": [
        {
          "@id": "http://hdl.handle.net/2027/wu.89054391917"
        },
        {
          "@id": "http://hdl.handle.net/2027/njp.32101067492643"
        },
        {
          "@id": "http://hdl.handle.net/2027/hvd.hnr43u"
        },
        {
          "@id": "http://hdl.handle.net/2027/osu.32435014276414"
        },
        {
          "@id": "http://hdl.handle.net/2027/wu.89107614968"
        }
      ]
    }
  ]
}

SPARQL query generating the above:

prefix dcterms: <http://purl.org/dc/terms/>
prefix edm: <http://www.europeana.eu/schemas/edm/>
prefix htrc: <http://wcsa.htrc.illinois.edu/> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

CONSTRUCT {
  <http://htrc.hathitrust.org/wsid/1616876109a>
      rdf:type htrc:Workset ;
      dcterms:creator ?cre ; 
      dcterms:created ?dat ;
      dcterms:extent  ?ext ;
      htrc:hasCriterion ?crit ;
      htrc:hasResearchMotivation ?mot ;
      htrc:intendedForUse ?intent ;
      dcterms:publisher ?pub ;
      dcterms:abstract ?abs ;
      dcterms:language ?lang ;
      dcterms:temporal ?temp ;
      dcterms:format ?form ;
      edm:gathers ?vols .} 

where {
  <http://htrc.hathitrust.org/wsid/1616876109a> 
      rdf:type htrc:Workset ;
      dcterms:title ?title ;
      dcterms:creator ?cre ; 
      dcterms:created ?dat ;
      dcterms:extent  ?ext ;
      htrc:intendedForUse ?intent ;
      dcterms:language ?lang ;
      dcterms:temporal ?temp ;
      edm:gathers ?vols . 
   OPTIONAL
     {
      <http://htrc.hathitrust.org/wsid/1616876109a> dcterms:abstract ?abs ;
          htrc:hasCriterion ?crit ;
          htrc:hasResearchMotivation ?mot ;
          dcterms:publisher ?pub ;
          dcterms:format ?form .
     }
}

Abbreviated Javascript - not implemented:

{
  "@context": "http://emblematica.library.illinois.edu/test/worksetcontext.jsonld",
  "@graph": [
    {
      "@id": "http://htrc.hathitrust.org/wsid/1616876109a",
      "@type": "Workset",
      "curator": "Jesse S Cohn",
      "numItems": 5,
      "title": "Anarchist literary and cultural criticism",
      "gathers": [
		"http://hdl.handle.net/2027/wu.89054391917", 
		"http://hdl.handle.net/2027/njp.32101067492643", 
		"http://hdl.handle.net/2027/hvd.hnr43u", 
		"http://hdl.handle.net/2027/osu.32435014276414", 
		"http://hdl.handle.net/2027/wu.89107614968"
      ]
    }
  ]
}
Clone this wiki locally