-
Notifications
You must be signed in to change notification settings - Fork 1
IIIF Search within Manifest
IIIF Reference: http://iiif.io/api/search/1.0/#simple-lists
Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/IIIF_Search_API/SearchWithinManifestGet
To search all chars resource annotations within manifest, send a GET request to /{identifier}/manifest/search/?q={values}&motivation=something
Other than q, which is recommended, all other parameters are optional in the request.
q: A space separated list of search terms. The search terms may be either words (to search for within textual bodies) or URIs (to search identities of annotation body resources).
The response will be an AnnotationList with the matching annotations for the query.
Example: Say we have the following manifest
{
"manifest":{
"@context":"http://iiif.io/api/presentation/2/context.json",
"@id":"http://example.org/iiif/book1/manifest",
"label":"Book 1",
"@type":"sc:Manifest",
"within":"http://example.org/collections/books",
"sequences":[
{
"@type":"sc:Sequence",
"label":"Sequence1",
"viewingDirection":"left-to-right",
"viewingHint":"paged",
"startCanvas":"http://example.org/iiif/book1/canvas/canvas2",
"canvases":[
{
"@id":"http://example.org/iiif/book1/canvas/canvas1",
"@type":"sc:Canvas",
"label":"Canvas 1",
"height":1000,
"width":750,
"thumbnail":{
"@id":"http://example.org/iiif/book1/canvas/canvas1/thumb.jpg",
"@type":"dctypes:Image",
"height":200,
"width":150
},
"images":[
{
"@type":"oa:Annotation",
"motivation":"sc:painting",
"resource":{
"@id":"http://example.org/iiif/book1/res/page1.jpg",
"@type":"dctypes:Image",
"format":"image/jpeg",
"service":{
"@context":"http://iiif.io/api/image/2/context.json",
"@id":"http://example.org/images/book1-page1",
"profile":"http://iiif.io/api/image/2/level2.json"
},
"height":2000,
"width":1500
},
"on":"http://example.org/iiif/book1/canvas/canvas1"
}
],
"otherContent":[
{
"@id":"http://example.org/iiif/book1/list/list1",
"@type":"sc:AnnotationList"
}
]
},
{
"@id":"http://example.org/iiif/book1/canvas/canvas2",
"@type":"sc:Canvas",
"label":"Canvas 2",
"images":[
{
"@type":"oa:Annotation",
"motivation":"sc:painting",
"resource":{
"@id":"http://example.org/iiif/book1/res/music.mp3",
"@type":"dctypes:Sound",
"format":"audio/mpeg"
},
"on":"http://example.org/iiif/book1/canvas/canvas2"
},
{
"@type":"oa:Annotation",
"motivation":"sc:painting",
"label":"New Annotation 2",
"resource":{
"@id":"http://example.org/iiif/book1/res/tei-text-p1.xml",
"@type":"dctypes:Text",
"format":"application/tei+xml"
},
"on":"http://example.org/iiif/book1/canvas/canvas2"
}
],
"otherContent":[
{
"@id":"http://example.org/iiif/book1/list/list2",
"@type":"sc:AnnotationList"
}
]
},
{
"@id":"http://example.org/iiif/book1/canvas/canvas3",
"@type":"sc:Canvas",
"label":"Canvas 3",
"images":[
{
"@id":"http://example.org/iiif/book1/annotation/anno4",
"@type":"oa:Annotation",
"motivation":"sc:painting",
"resource":[
{
"@type":"cnt:ContentAsText",
"chars":"Here starts book one...",
"format":"text/plain",
"language":"en"
},
{
"@type":"oa:Choice",
"default":{
"@id":"http://example.org/iiif/book1/res/page1.jpg",
"@type":"dctypes:Image",
"label":"Color"
},
"item":[
{
"@id":"http://example.org/iiif/book1/res/page1-blackandwhite.jpg",
"@type":"dctypes:Image",
"label":"Black and White"
}
]
}
],
"on":"http://example.org/iiif/book1/canvas/canvas3#xywh=100,150,500,25"
}
]
},
{
"@id":"http://example.org/iiif/book1/canvas/canvas4",
"@type":"sc:Canvas",
"label":"Canvas 4",
"images":[
{
"@id":"http://example.org/iiif/book1/annotation/anno5",
"@type":"oa:Annotation",
"motivation":"sc:painting",
"stylesheet":{
"@type":[
"oa:CssStyle",
"cnt:ContentAsText"
]
},
"resource":{
"@type":"oa:SpecificResource",
"chars":".rotated {transform-origin: top left; transform: rotate(-45deg);}"
"style":"rotated",
"full":{
"@id":"http://example.org/iiif/book1/res/page1-detail.png",
"@type":"dctypes:Image"
}
},
"on":"http://example.org/iiif/book1/canvas/canvas4#xywh=100,150,500,30"
},
{
"@id":"http://example.org/iiif/book1/annotation/anno6",
"@type":"oa:Annotation",
"motivation":"oa:commenting",
"resource":{
"@id":"http://example.org/iiif/book1/res/comment1.html",
"@type":"dctypes:Text",
"format":"text/html"
},
"on":"http://example.org/iiif/book1/canvas/canvas4"
}
]
},
{
"@id":"http://example.org/iiif/book1/canvas/canvas5",
"@type":"sc:Canvas",
"label":"Canvas 5",
"images":[
{
"@context":"http://iiif.io/api/presentation/2/context.json",
"@id":"http://www.example.org/iiif/book1/annotation/anno7",
"@type":"oa:Annotation",
"motivation":"oa:linking",
"resource":{
"@id":"http://www.example.org/page-to-go-to.html",
"@type":"dctypes:Text",
"format":"text/html"
},
"on":"http://www.example.org/iiif/book1/canvas/canvas5#xywh=500,500,150,30"
}
]
}
]
},
{
"@id":"http://example.org/iiif/book1/sequence/sequence2",
"@type":"sc:Sequence",
"label":"Sequence 2",
"viewingDirection":"right-to-left"
},
{
"@id":"http://example.org/iiif/book1/sequence/sequence3",
"@type":"sc:Sequence",
"label":"Sequence 3"
}
]
}
}Performing a GET request with /book1/manifest/search/?q=book would give the following result
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://localhost:8000/book1/manifest/search/?q=book&motivation=painting",
"@type": "sc:AnnotationList",
"resources": [
{
"@context": "http://iiif.io/api/presentation/2/context.json",
"@id": "http://localhost:8000/book1/annotation/anno4",
"@type": "oa:Annotation",
"motivation": "sc:painting",
"resource": [
{
"@id": "http://localhost:8000/book1/res/res_d713c3d9-0701-44c6-a7bc-bacc31249abe",
"@type": "cnt:ContentAsText",
"format": "text/plain",
"chars": "Here starts book one...",
"language": "en"
},
{
"@id": "http://localhost:8000/book1/res/res_3298c30f-3d62-40e7-bd26-47cb8f7aa700",
"@type": "oa:Choice",
"default": {
"@id": "http://example.org/iiif/book1/res/page1.jpg",
"@type": "dctypes:Image",
"label": "Color"
},
"item": [
{
"@id": "http://example.org/iiif/book1/res/page1-blackandwhite.jpg",
"@type": "dctypes:Image",
"label": "Black and White"
}
]
}
],
"on": "http://localhost:8000/book1/canvas/canvas3"
}
]
}