IIIFpres package¶
Helper methods of the common IIIF objects¶
- class IIIFpres.iiifpapi3._CoreAttributes[source]¶
HELPER CLASS
Core attributes are the attributes in all the major classes/containers of IIIF namely: Collection, Manifest, Canvas, Range and Annotation Page, Annotation and Content and also in the minor classes such as SeeAlso and partOf.
The core attributes are: ID, Type, Label
ID an type attributes are required. The other might vary.
- json_dumps(dumps_errors=False, ensure_ascii=False, sort_keys=False, context=None)[source]¶
Dumps the content of the object in JSON format.
- Parameters:
dumps_errors (bool, optional) – If set true it shows any problem found directly on the JSON file with a Required or Recommended tag.Defaults to False.
ensure_ascii (bool, optional) – Ensure ASCI are used. Defaults to False.
sort_keys (bool, optional) – Sort the keys. Defaults to False.
context (str,list, optional) – Add additional context. Defaults to None.
- Returns:
The JSON object as a string.
- Return type:
str
- orjson_dumps(dumps_errors=False, context=None)[source]¶
Dumps the content of the object in JSON format using orJSON library.
- Parameters:
dumps_errors (bool, optional) – If set true it shows any problem found, directly on the JSON file with a Required or Recommended tag.Defaults to False.
ensure_ascii (bool, optional) – Ensure ASCI are used. Defaults to False.
sort_keys (bool, optional) – Sort the keys. Defaults to False.
context (str,list, optional) – Add additional context. Defaults to None.
- Returns:
The JSON object as a string.
- Return type:
str
- to_json(dumps_errors=False, ensure_ascii=False, sort_keys=False, context=None)[source]¶
Return the object with the JSON syntax.
- Parameters:
filename (str) – The filename.
save_errors (bool, optional) – If True also the errors will be dumped. Defaults to False.
ensure_ascii (bool, optional) – If True only ASCI character will be used. Defaults to False.
context (str,list, optional) – Add additional contexts to the JSON. Defaults to None.
- Returns:
a JSON dump of the object as dict.
- Return type:
dict
- json_save(filename, save_errors=False, ensure_ascii=False, context=None)[source]¶
Save the JSON object to file.
- Parameters:
filename (str) – The filename.
save_errors (bool, optional) – If True also the errors will be dumped. Defaults to False.
ensure_ascii (bool, optional) – If True only ASCI character will be used. Defaults to False.
context (str,list, optional) – Add additional contexts to the JSON. Defaults to None.
- orjson_save(filename, save_errors=False, context=None)[source]¶
Save the JSON object to file.
- Parameters:
filename (str) – The filename.
save_errors (bool, optional) – If True also the errors will be dumped. Defaults to False.
ensure_ascii (bool, optional) – If True only ASCI character will be used. Defaults to False.
context (str,list, optional) – Add additional contexts to the JSON. Defaults to None.
Subpackages¶
IIIFpres.iiifpapi3 module¶
Implementation of IIIF Presentation API 3.0
This module maps IIIF Presentation API 3.0 resources to Python classes. The user set resources with a single element, and add to the list of the resources multiple objects.
Example
>>> from IIIFpres import iiifpapi3
>>> iiifpapi3.BASE_URL = r"https://iiif.io/api/0001-mvm-image/"
>>> manifest = iiifpapi3.Manifest()
>>> manifest.set_id(extendbase_url="manifest.json")
>>> manifest.add_label("en", "Image 1")
>>> canvas = manifest.add_canvas_to_items()
>>> canvas.set_id(extendbase_url="canvas/p1")
>>> canvas.set_height(1800)
>>> canvas.set_width(1200)
>>> annopage = canvas.add_annotationpage_to_items()
>>> annopage.set_id(extendbase_url="page/p1/1")
>>> annotation = annopage.add_annotation_to_items(target=canvas.id)
>>> annotation.set_motivation("painting")
>>> annotation.set_id(extendbase_url="annotation/p0001-image")
>>> annotation.body.set_height(1800)
>>> annotation.body.set_width(1200)
>>> annotation.body.set_id("http://resources/page1-full.png")
>>> annotation.body.set_format("image/png")
>>> annotation.body.set_type("Image")
>>> manifest.to_json()
- IIIFpres.iiifpapi3.BASE_URL¶
Module level variable containing the URL to be preappend to iiifpapi3._CoreAttributes.set_id extend_baseurl
- Type:
str
- IIIFpres.iiifpapi3.LANGUAGES¶
Module level variable containing a list of accepted languages. This variable is used for checking accepted languages, using the IANA sub tag registry
- Type:
list[str]
- IIIFpres.iiifpapi3.CONTEXT¶
Module level variable containing the context of the JSONLD file. Can be set to a list in case of multiple contexts.
- Type:
str,list
- IIIFpres.iiifpapi3.INVALID_URI_CHARACTERS¶
A list of charachters that are not accepted in the URL.
- Type:
str
- IIIFpres.iiifpapi3.BEHAVIOURS¶
A list of accepted behaviours.
- Type:
list[str]
Warning
only language subtags are checked not variants or composite strings. You can manually add a language if you need to use subtags:
Example
>>> from IIIFpres import iiifpapi3,BCP47lang
>>> iiifpapi3.LANGUAGES.append("de-DE-u-co-phonebk")
- IIIFpres.iiifpapi3.unused(attr)[source]¶
This function checks if an attribute is not set (has no value in it).
- IIIFpres.iiifpapi3.serializable(attr)[source]¶
Check if attribute is Required and if so rise Value error.
- Parameters:
attr – the value of the dictionary of the attribute of the instance.
- IIIFpres.iiifpapi3.add_to(selfx, destination, classx, obj, acceptedclasses=None, target=None)[source]¶
Helper function used for adding IIIF object to to IIIF lists.
- Parameters:
selfx (object) – The class it-self
destination (str) – The class list attribute where the object will be stored.
classx (object) – The IIIF class that will be used for instantiating the object.
obj (object) – An already instantiated IIIF object.
acceptedclasses (objects, optional) – Accepted classes for obj. Defaults to None.
target (str, optional) – The target of an Annotation. Defaults to None.
- Raises:
ValueError – When users try to add the wrong object to a list.
- Returns:
A reference to an instance of the IIIF object.
- Return type:
IIIF object
- IIIFpres.iiifpapi3.check_valid_URI(URI)[source]¶
Check if it is a valid URI.
- Parameters:
URI (str) – The URI to check.
- Returns:
True if it is valid.
- Return type:
Bool
- IIIFpres.iiifpapi3.check_ID(self, extendbase_url, objid)[source]¶
Function for creating and checking IDs.
- Parameters:
extendbase_url (str) – The baseURL to extend.
objid (str) – A valid ID.
- Raises:
ValueError – When trying to use both args together.
- class IIIFpres.iiifpapi3.seeAlso[source]¶
Bases:
_MutableType,_CoreAttributes,_FormatIIIF resource
https://iiif.io/api/presentation/3.0/#seealso
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property. Properties of the resource should be given to help the client select between multiple descriptions (if provided), and to make appropriate use of the document. If the relationship between the resource and the document needs to be more specific, then the document should include that relationship rather than the IIIF resource. Other IIIF resources are also valid targets for seeAlso, for example to link to a Manifest that describes a related object. The URI of the document must identify a single representation of the data in a particular format. For example, if the same data exists in JSON and XML, then separate resources should be added for each representation, with distinct id and format properties.
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- class IIIFpres.iiifpapi3.partOf[source]¶
Bases:
_MutableType,_CoreAttributesIIIF resource
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property. When a client encounters the partOf property, it might retrieve the referenced containing resource, if it is not embedded in the current representation, in order to contribute to the processing of the contained resource. For example, the partOf property on a Canvas can be used to reference an external Manifest in order to enable the discovery of further relevant information. Similarly, a Manifest can reference a containing Collection using partOf to aid in navigation.
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- class IIIFpres.iiifpapi3.supplementary[source]¶
Bases:
_ImmutableType,_CoreAttributesIIIF resource
https://iiif.io/api/presentation/3.0/#supplementary
IIIF: A link from this Range to an Annotation Collection that includes the supplementing Annotations of content resources for the Range. Clients might use this to present additional content to the user from a different Canvas when interacting with the Range, or to jump to the next part of the Range within the same Canvas. For example, the Range might represent a newspaper article that spans non-sequential pages, and then uses the supplementary property to reference an Annotation Collection that consists of the Annotations that record the text, split into Annotation Pages per newspaper page. Alternatively, the Range might represent the parts of a manuscript that have been transcribed or translated, when there are other parts that have yet to be worked on. The Annotation Collection would be the Annotations that transcribe or translate, respectively.
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- class IIIFpres.iiifpapi3.service[source]¶
Bases:
_CoreAttributes,_HeightWidth,_ServiceIIIF resource
https://iiif.io/api/presentation/3.0/#service
IIIF:A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service. The service resource should have additional information associated with it in order to allow the client to determine how to make appropriate use of it. Please see the Service Registry document for the details of currently known service types.
The value must be an array of JSON objects. Each object will have properties depending on the service’s definition, but must have either the id or @id and type or @type properties. Each object should have a profile property.
Any resource type may have the service property with at least one item. Clients may process service on any resource type, and should process the IIIF Image API service.
- set_type(mytype)[source]¶
Set the type of the service.
https://iiif.io/api/presentation/3.0/#service
IIIF: For content resources, the value of type is drawn from other specifications. Please see the Service Registry document for the details of currently known service types.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- set_profile(profile)[source]¶
Set the profile of the resource.
https://iiif.io/api/presentation/3.0/#profile
IIIF: The value must be a string, either taken from the profiles registry or a URI.
- Parameters:
profile (str) – A schema or named set of functionality available
resource. (from the)
- add_size(width, height)[source]¶
Add size to the sizes list of the service.
This methods does not return an handler.
- Parameters:
width (int,str) – The width of the resource.
height (int,str) – The height of the resource.
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- set_height(height)¶
Set the height of the resource.
https://iiif.io/api/presentation/3.0/#height
- Parameters:
height (int,str) – The height of the resource.
- set_heightWidth(height, width)¶
Set both the height and the width of the resource.
https://iiif.io/api/presentation/3.0/#height https://iiif.io/api/presentation/3.0/#width
- Parameters:
height (int, str) – The height of the resource.
width (int, str) – The width of the resource.
- set_hightwidth(height, width)¶
Deprecated method use set_heightWidth instead.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_width(width)¶
Set the width of the resource.
https://iiif.io/api/presentation/3.0/#width
- Parameters:
width (int,str) – The width of the resource.
- class IIIFpres.iiifpapi3.thumbnail[source]¶
Bases:
_MutableType,_CoreAttributes,_Format,_HeightWidth,_Duration,_ServiceIIIF resource
https://iiif.io/api/presentation/3.0/#thumbnail https://iiif.io/api/cookbook/recipe/0065-opera-multiple-canvases/
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
The value must be an array of JSON objects, each of which must have the id and type properties, and should have the format property. Images and videos should have the width and height properties, and time-based media should have the duration property. It is recommended that a IIIF Image API service be available for images to enable manipulations such as resizing.
Example
>>> tmb = canvas.add_thumbnail() >>> tmb.set_id("https://act1-thumbnail.png") >>> tmb.set_type("Image") >>> tmb.set_format("image/jpeg") >>> tmb.set_heightWidth(1234,1234)
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- set_duration(duration)¶
Set the duration of the resource.
https://iiif.io/api/presentation/3.0/#duration
- Parameters:
duration (float) – The duration of the resource in seconds.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_height(height)¶
Set the height of the resource.
https://iiif.io/api/presentation/3.0/#height
- Parameters:
height (int,str) – The height of the resource.
- set_heightWidth(height, width)¶
Set both the height and the width of the resource.
https://iiif.io/api/presentation/3.0/#height https://iiif.io/api/presentation/3.0/#width
- Parameters:
height (int, str) – The height of the resource.
width (int, str) – The width of the resource.
- set_hightwidth(height, width)¶
Deprecated method use set_heightWidth instead.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- set_width(width)¶
Set the width of the resource.
https://iiif.io/api/presentation/3.0/#width
- Parameters:
width (int,str) – The width of the resource.
- class IIIFpres.iiifpapi3.homepage[source]¶
Bases:
_MutableType,_CoreAttributes,_Format,_AddLanguageIIIF resource
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_language(language)¶
add a language to the language list of the resource.
https://iiif.io/api/presentation/3.0/#language-of-property-values
Example
>>> manifest.add_language('en')
Note
pyIIIFpres accept only single tag, in case you need subtags you need to add them to iiifpapi3.LANGUAGES:
>>> from IIIFpres import iiifpapi3,BCP47lang >>> iiifpapi3.LANGUAGES.append("de-DE-u-co-phonebk")
Please read https://git.io/JoQty.
- Parameters:
language (str) – A BCP 47 language tag e.g. en, it, es.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- class IIIFpres.iiifpapi3.provider[source]¶
Bases:
_ImmutableType,_CoreAttributes,_Hompage,_SeeAlsoIIIF resource
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource. Clients can then display this information to the user to acknowledge the provider’s contributions. This differs from the requiredStatement property, in that the data is structured, allowing the client to do more than just present text but instead have richer information about the people and organizations to use in different interfaces.
Examples
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- add_logo(logoobj=None)[source]¶
add a logo object to the resource
https://iiif.io/api/presentation/3.0/#logo https://iiif.io/api/cookbook/recipe/0234-provider/
Examples
>>> logo = prov.add_logo() >>> logo.set_id("https://UCLA-Library-Logo/full/full/0/default.png") >>> serv = logo.add_service() >>> serv.set_id("https://UCLA-Library-Logo")
- Parameters:
logoobj (iiifpapi3.logo, optional) – If logoobj is None a i iiifpapi3.logo object handler. Defaults to None.
- Returns:
iiifpapi3.logo if logoobj is None.
- Return type:
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- class IIIFpres.iiifpapi3.logo[source]¶
Bases:
_ImmutableType,_CoreAttributes,_HeightWidth,_Format,_ServiceIIIF resource
https://iiif.io/api/presentation/3.0/#logo https://iiif.io/api/cookbook/recipe/0234-provider/
A small image resource that represents the Agent resource it is associated with. The logo must be clearly rendered when the resource is displayed or used, without cropping, rotating or otherwise distorting the image. It is recommended that a IIIF Image API service be available for this image for other manipulations such as resizing.
When more than one logo is present, the client should pick only one of them, based on the information in the logo properties. For example, the client could select a logo of appropriate aspect ratio based on the height and width properties of the available logos. The client may decide on the logo by inspecting properties defined as extensions.
Examples
>>> logo = prov.add_logo() >>> logo.set_id("https://UCLA-Library-Logo/full/full/0/default.png") >>> serv = logo.add_service() >>> serv.set_id("https://UCLA-Library-Logo")
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_height(height)¶
Set the height of the resource.
https://iiif.io/api/presentation/3.0/#height
- Parameters:
height (int,str) – The height of the resource.
- set_heightWidth(height, width)¶
Set both the height and the width of the resource.
https://iiif.io/api/presentation/3.0/#height https://iiif.io/api/presentation/3.0/#width
- Parameters:
height (int, str) – The height of the resource.
width (int, str) – The width of the resource.
- set_hightwidth(height, width)¶
Deprecated method use set_heightWidth instead.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- set_width(width)¶
Set the width of the resource.
https://iiif.io/api/presentation/3.0/#width
- Parameters:
width (int,str) – The width of the resource.
- class IIIFpres.iiifpapi3.rendering[source]¶
Bases:
_MutableType,_CoreAttributes,_FormatIIIF resource
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
A resource that is an alternative, non-IIIF representation of the resource that has the rendering property. Such representations typically cannot be painted onto a single Canvas, as they either include too many views, have incompatible dimensions, or are compound resources requiring additional rendering functionality. The rendering resource must be able to be displayed directly to a human user, although the presentation may be outside of the IIIF client. The resource must not have a splash page or other interstitial resource that mediates access to it. If access control is required, then the IIIF Authentication API is recommended. Examples include a rendering of a book as a PDF or EPUB, a slide deck with images of a building, or a 3D model of a statue.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kabuki.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en","PDF version") >>> rendering.set_format("application/pdf")
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- class IIIFpres.iiifpapi3.languagemap[source]¶
Bases:
objectHELPER CLASS This is not a IIIF type but is used for easing the construction of multilingual metadata and requiredstatements.
Examples
>>> languagemap.add_label('Hosting','en') >>> languagemap.add_value('hosted by imagineRio','en')
- add_value(value, language='none')[source]¶
Add the value of the language map.
- Parameters:
value (str) – The value of the language map e.g. Author:
language (str, optional) – The language of the value e.g. en. Defaults to “none”.
- add_label(label, language='none')[source]¶
Add the label of the language map.
Example
>>> iiifobj.add_label("A painting","en") >>> iiifobj.add_label(["Canvas","Oil"],"en")
- Parameters:
label (str) – The value of the language map e.g. Dante Alighieri:
language (str, optional) – The language of the value e.g. it. Defaults to “none”.
- class IIIFpres.iiifpapi3.Annotation(target=Required attribute:None)[source]¶
Bases:
_CommonAttributesIIIF resource
https://iiif.io/api/presentation/3.0/#56-annotation
Annotations follow the Web Annotation data model.
Annotations must have their own HTTP(S) URIs, conveyed in the id property. The JSON-LD description of the Annotation should be returned if the URI is dereferenced, according to the Web Annotation Protocol.
When Annotations are used to associate content resources with a Canvas, the content resource is linked in the body of the Annotation. The URI of the Canvas must be repeated in the target property of the Annotation, or the source property of a Specific Resource used in the target property.
Note that the Web Annotation data model defines different patterns for the value property, when used within an Annotation. The value of a Textual Body or a Fragment Selector, for example, are strings rather than JSON objects with languages and values. Care must be taken to use the correct string form in these cases.
Additional features of the Web Annotation data model may also be used, such as selecting a segment of the Canvas or content resource, or embedding the comment or transcription within the Annotation. The use of these advanced features sometimes results in situations where the target is not a content resource, but instead a SpecificResource, a Choice, or other non-content object. Implementations should check the type of the resource and not assume that it is always content to be rendered.
- set_motivation(motivation)[source]¶
set the motivation of the annotation.
https://iiif.io/api/presentation/3.0/#values-for-motivation
- Parameters:
motivation (str) – the motivation of the annotation usually is
painting
supplementing
commenting
tagging
IIIF: this specification defines only motivations for Annotations that target Canvases. These motivations allow clients to determine how the Annotation should be rendered, by distinguishing between Annotations that provide the content of the Canvas, from ones with externally defined motivations which are typically comments about the Canvas.
Additional motivations may be added to the Annotation to further clarify the intent, drawn from extensions or other sources. Other motivation values given in the Web Annotation specification should be used where appropriate, and examples are given in the Presentation API Cookbook.
painting - Resources associated with a Canvas by an Annotation that has the motivation value painting must be presented to the user as the representation of the Canvas. The content can be thought of as being of the Canvas.
supplementing - Resources associated with a Canvas by an Annotation that has the motivation value supplementing may be presented to the user as part of the representation of the Canvas, or may be presented in a different part of the user interface. The content can be thought of as being from the Canvas.
- add_motivation(motivation)[source]¶
add the motivation of the annotation without changing the body type.
https://iiif.io/api/presentation/3.0/#values-for-motivation
- Parameters:
motivation (str) – the motivation of the annotation usually is
painting
supplementing
commenting
tagging
IIIF: this specification defines only motivations for Annotations that target Canvases. These motivations allow clients to determine how the Annotation should be rendered, by distinguishing between Annotations that provide the content of the Canvas, from ones with externally defined motivations which are typically comments about the Canvas.
Additional motivations may be added to the Annotation to further clarify the intent, drawn from extensions or other sources. Other motivation values given in the Web Annotation specification should be used where appropriate, and examples are given in the Presentation API Cookbook.
painting - Resources associated with a Canvas by an Annotation that has the motivation value painting must be presented to the user as the representation of the Canvas. The content can be thought of as being of the Canvas.
supplementing - Resources associated with a Canvas by an Annotation that has the motivation value supplementing may be presented to the user as part of the representation of the Canvas, or may be presented in a different part of the user interface. The content can be thought of as being from the Canvas.
- set_target_specific_resource(specificresource=None)[source]¶
Set a specific resource as the target of the annotation.
This function will set the target of the specific resource as an object.
Examples
https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/ >>> annotation.set_target_specific_resource() >>> annotation.target.set_source(canvas.id) >>> svg =”<svg xmlns=’http://www.w3.org/2000/svg’ … > … </svg>” >>> annotation.target.set_selector_as_SvgSelector(value=svg)
- Parameters:
specificresource (iiifpapi3.sepcificreosurce, optional) – a iiifpapi3.sepcificreosurce object. Defaults to None.
- Raises:
ValueError – if you add the wrong object.
- Returns:
A reference to the object.
- Return type:
iiifpapi3.sepcificreosurce
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- class IIIFpres.iiifpapi3.AnnotationPage[source]¶
Bases:
_CommonAttributesIIIF resource.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
- add_item(item)[source]¶
Add an item (Annotation) to the AnnotationPage.
Same as add_annotation_to_items but doesn’t return.
An Annotation Page should have the items property with at least one item. Each item must be an Annotation.
- Parameters:
item (Annotation) – The Annotation
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- class IIIFpres.iiifpapi3.AnnotationCollection[source]¶
Bases:
_CommonAttributesIIIF resource.
https://iiif.io/api/presentation/3.0/#58-annotation-collection
Annotation Collections represent groupings of Annotation Pages that should be managed as a single whole, regardless of which Canvas or resource they target. This allows, for example, all of the Annotations that make up a particular translation of the text of a book to be collected together. A client might then present a user interface that allows all of the Annotations in an Annotation Collection to be displayed or hidden according to the user’s preference.
- set_id(objid, extendbase_url=None)[source]¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id https://iiif.io/api/presentation/3.0/#58-annotation-collection
IIIF: Annotation Collections must have a URI, and it should be an HTTP(S) URI.
Note
Usually ID must be HTTP(S) in this case it seems not.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- class IIIFpres.iiifpapi3.contentresources[source]¶
Bases:
_MutableType,_CommonAttributes,_HeightWidth,_Duration,_AnnotationsList,_Format,_AddAnnoP2ItemsIIIF resource
https://iiif.io/api/presentation/3.0/#57-content-resources
IIIF: Content resources are external web resources that are referenced from within the Manifest or Collection. This includes images, video, audio, data, web pages or any other format.
- add_annotationpage_to_annotations(annopageobj=None)¶
Add an AnnotationPage to the annotations list.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
https://iiif.io/api/presentation/3.0/#annotations
IIIF: An ordered list of Annotation Pages that contain commentary or other Annotations about this resource, separate from the Annotations that are used to paint content on to a Canvas.
- Parameters:
annopageobj (AnnnotationPage, optional) – An AnnotationPage object. Defaults to None.
- Returns:
An AnnotationPage if annopageobj is None.
- Return type:
- add_annotationpage_to_items(annotationpageobj=None, target=None)¶
Add an annotation page to the items list of the object.
- Parameters:
- Returns:
if annotationpageobj is None.
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_duration(duration)¶
Set the duration of the resource.
https://iiif.io/api/presentation/3.0/#duration
- Parameters:
duration (float) – The duration of the resource in seconds.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_height(height)¶
Set the height of the resource.
https://iiif.io/api/presentation/3.0/#height
- Parameters:
height (int,str) – The height of the resource.
- set_heightWidth(height, width)¶
Set both the height and the width of the resource.
https://iiif.io/api/presentation/3.0/#height https://iiif.io/api/presentation/3.0/#width
- Parameters:
height (int, str) – The height of the resource.
width (int, str) – The width of the resource.
- set_hightwidth(height, width)¶
Deprecated method use set_heightWidth instead.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- set_width(width)¶
Set the width of the resource.
https://iiif.io/api/presentation/3.0/#width
- Parameters:
width (int,str) – The width of the resource.
- class IIIFpres.iiifpapi3.bodycommenting[source]¶
Bases:
_ImmutableType- set_format(format)[source]¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
Note
pyIIIFpres will check that the format is in MEDIATYPES[‘text’] If you are confident with the format you are using set the format using obj.format = … or run the script with -O flag. or append your format to the MEDIATYPES: >>> MEDIATYPES[‘text’].append(‘myformat’)
- Parameters:
format (str) – Usually is the MIME e.g. text/plain.
- set_value(value)[source]¶
Set the value of the TextualBody e.g. “Comment text”
- Parameters:
value (str) – The value of the TextualBody
- set_language(language)[source]¶
Set the language of the TextualBody value.
- Parameters:
language (str) – The language of the TextualBody value e.g. “en”
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- class IIIFpres.iiifpapi3.bodypainting[source]¶
Bases:
contentresources,_Service,_AddLanguagePseudo-IIIF resource
IIIF: the content associated with a Canvas (and therefore the content of a Manifest) is provided by the body property of Annotations with the painting motivation.
- add_choice(choiceobj=None)[source]¶
Add a Choice to the body of the annotation.
https://preview.iiif.io/cookbook/3333-choice/recipe/0033-choice/
- Parameters:
choiceobj (dict, optional) – A dictionary representing the Choice. Defaults to None.
- Raises:
ValueError – if you try to add the wrong object type.
- Returns:
A bodypainting instance.
- Return type:
- add_annotation(annotation=None)¶
Please use add_annotationpage_to_annotations instead.
- add_annotationpage_to_annotations(annopageobj=None)¶
Add an AnnotationPage to the annotations list.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
https://iiif.io/api/presentation/3.0/#annotations
IIIF: An ordered list of Annotation Pages that contain commentary or other Annotations about this resource, separate from the Annotations that are used to paint content on to a Canvas.
- Parameters:
annopageobj (AnnnotationPage, optional) – An AnnotationPage object. Defaults to None.
- Returns:
An AnnotationPage if annopageobj is None.
- Return type:
- add_annotationpage_to_items(annotationpageobj=None, target=None)¶
Add an annotation page to the items list of the object.
- Parameters:
- Returns:
if annotationpageobj is None.
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_language(language)¶
add a language to the language list of the resource.
https://iiif.io/api/presentation/3.0/#language-of-property-values
Example
>>> manifest.add_language('en')
Note
pyIIIFpres accept only single tag, in case you need subtags you need to add them to iiifpapi3.LANGUAGES:
>>> from IIIFpres import iiifpapi3,BCP47lang >>> iiifpapi3.LANGUAGES.append("de-DE-u-co-phonebk")
Please read https://git.io/JoQty.
- Parameters:
language (str) – A BCP 47 language tag e.g. en, it, es.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_duration(duration)¶
Set the duration of the resource.
https://iiif.io/api/presentation/3.0/#duration
- Parameters:
duration (float) – The duration of the resource in seconds.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_height(height)¶
Set the height of the resource.
https://iiif.io/api/presentation/3.0/#height
- Parameters:
height (int,str) – The height of the resource.
- set_heightWidth(height, width)¶
Set both the height and the width of the resource.
https://iiif.io/api/presentation/3.0/#height https://iiif.io/api/presentation/3.0/#width
- Parameters:
height (int, str) – The height of the resource.
width (int, str) – The width of the resource.
- set_hightwidth(height, width)¶
Deprecated method use set_heightWidth instead.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- set_type(mtype)¶
Set the type or class of the resource.
https://iiif.io/api/presentation/3.0/#type
IIIF: For content resources, the value of type is drawn from other specifications.
- Parameters:
mtype (str) – the type of the object e.g. Image or Dataset.
- set_width(width)¶
Set the width of the resource.
https://iiif.io/api/presentation/3.0/#width
- Parameters:
width (int,str) – The width of the resource.
- class IIIFpres.iiifpapi3.Canvas[source]¶
Bases:
_CMRCattributes,_HeightWidth,_Duration,_AddAnnoP2ItemsIIIF resource
https://iiif.io/api/presentation/3.0/#53-canvas
The Canvas represents an individual page or view and acts as a central point for assembling the different content resources that make up the display. Canvases must be identified by a URI and it must be an HTTP(S) URI.
- add_item(item)[source]¶
Add an item (AnnotationPage) to the Canvas.
Same as add_annotationpage_to_items but doesn’t return.
A Canvas should have the items property with at least one item. Each item must be an Annotation Page.
- Parameters:
item (AnnotationPage) – The AnnotationPage object.
- add_annotation(annotation=None)[source]¶
Danger
From 0.4 use iiifpapi3.Canvas.add_annotationpage_to_annotations
- add_annotationpage_to_annotations(annopageobj=None)¶
Add an AnnotationPage to the annotations list.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
https://iiif.io/api/presentation/3.0/#annotations
IIIF: An ordered list of Annotation Pages that contain commentary or other Annotations about this resource, separate from the Annotations that are used to paint content on to a Canvas.
- Parameters:
annopageobj (AnnnotationPage, optional) – An AnnotationPage object. Defaults to None.
- Returns:
An AnnotationPage if annopageobj is None.
- Return type:
- add_annotationpage_to_items(annotationpageobj=None, target=None)¶
Add an annotation page to the items list of the object.
- Parameters:
- Returns:
if annotationpageobj is None.
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_accompanyingCanvas(canvas=None)¶
set a accompanyingCanvas to the object.
https://iiif.io/api/presentation/3.0/#accompanyingcanvas
IIIF: A single Canvas that provides additional content for use while rendering the resource that has the accompanyingCanvas property.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as accompanyingCanvas.
- Raises:
AttributeError – if you are tyring to ad a accompanying Canvas to a accompanying Canvas.
- Returns:
A modified Canvas to be used as accompanying Canvas.
- Return type:
- set_duration(duration)¶
Set the duration of the resource.
https://iiif.io/api/presentation/3.0/#duration
- Parameters:
duration (float) – The duration of the resource in seconds.
- set_height(height)¶
Set the height of the resource.
https://iiif.io/api/presentation/3.0/#height
- Parameters:
height (int,str) – The height of the resource.
- set_heightWidth(height, width)¶
Set both the height and the width of the resource.
https://iiif.io/api/presentation/3.0/#height https://iiif.io/api/presentation/3.0/#width
- Parameters:
height (int, str) – The height of the resource.
width (int, str) – The width of the resource.
- set_hightwidth(height, width)¶
Deprecated method use set_heightWidth instead.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
set the navDate of the object.
https://iiif.io/api/presentation/3.0/#navdate https://iiif.io/api/cookbook/recipe/0230-navdate/
IIIF: A date that clients may use for navigation purposes when presenting the resource to the user in a date-based user interface, such as a calendar or timeline. More descriptive date ranges, intended for display directly to the user, should be included in the metadata property for human consumption.
- Parameters:
navDate (str) – A date in UTC in the format “2010-01-01T00:00:00Z”
- set_placeholderCanvas(canvas=None)¶
set a placeholderCanvas to the object.
https://iiif.io/api/presentation/3.0/#placeholdercanvas
IIIF: A single Canvas that provides additional content for use before the main content of the resource that has the placeholderCanvas property is rendered, or as an advertisement or stand-in for that content.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as placeholderCanvas.
- Raises:
AttributeError – if you are tyring to ad a placeholder Canvas to a placeholder Canvas.
- Returns:
A modified Canvas to be used as placeholder Canvas.
- Return type:
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- set_width(width)¶
Set the width of the resource.
https://iiif.io/api/presentation/3.0/#width
- Parameters:
width (int,str) – The width of the resource.
- class IIIFpres.iiifpapi3.start[source]¶
Bases:
_CoreAttributesIIIF resource
https://iiif.io/api/presentation/3.0/#start https://iiif.io/api/cookbook/recipe/0009-book-1/
A Canvas, or part of a Canvas, which the client should show on initialization for the resource that has the start property. This property allows the client to begin with the first Canvas that contains interesting content rather than requiring the user to manually navigate to find it.
Examples
>>> manifest.set_start() >>> manifest.start.set_type("Canvas") >>> manifest.start.set_id("0202-start-canvas/canvas/p2")
- set_type(mtype)[source]¶
Set the type of the resource: Canvas or SpecificResource.
- Parameters:
mtype (str) – The type of the resource that must be Canvas or SpecificResource.
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- class IIIFpres.iiifpapi3.Manifest[source]¶
Bases:
_CMRCattributes,_ViewingDirection,_Start,_ServicesListIIIF resource
https://iiif.io/api/presentation/3.0/#52-manifest https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: The Manifest resource typically represents a single object and any intellectual work or works embodied within that object. In particular it includes descriptive, rights and linking information for the object. The Manifest embeds the Canvases that should be rendered as views of the object and contains sufficient information for the client to initialize itself and begin to display something quickly to the user.
The identifier in id must be able to be dereferenced to retrieve the JSON description of the Manifest, and thus must use the HTTP(S) URI scheme.
The Manifest must have an items property, which is an array of JSON-LD objects. Each object is a Canvas, with requirements as described in the next section. The Manifest may also have a structures property listing one or more Ranges which describe additional structure of the content, such as might be rendered as a table of contents. The Manifest may have an annotations property, which includes Annotation Page resources where the Annotations have the Manifest as their target. These will typically be comment style Annotations, and must not have painting as their motivation.
Example
>>> manifest = iiifpapi3.Manifest() >>> manifest.set_id(extendbase_url="manifest.json") >>> manifest.add_label("en", "Image 1") >>> canvas = manifest.add_canvas_to_items()
- add_item(item)[source]¶
Add an item (Canvas) to the Manifest.
Same as iiifpapi3.Manifest.add_canvas_to_items but doesn’t return.
A Manifest must have the items property with at least one item. Each item must be a Canvas. Clients must process items on a Manifest.
Example
>>> manifest = iiifpapi3.Manifest() >>> manifest.set_id(extendbase_url="manifest.json") >>> manifest.add_label("en", "Image 1") >>> canvas = iiifpapi3.Canvas() >>> manifest.add_item(canvas)
- Parameters:
item (Canvas) – The canvas
- add_canvas_to_items(canvasobj=None)[source]¶
Add a Canvas object to the items list.
https://iiif.io/api/presentation/3.0/#canvas https://iiif.io/api/cookbook/recipe/0009-book-1/
- Parameters:
canvasobj (iiifpapi3.Canvas, optional) – A iiifpapi3.Canvas to be added to the Manifest.items list. Defaults to None.
Example
>>> canvas = manifest.add_canvas_to_items() >>> canvas.set_height(1800) >>> canvas.set_width(1200)
- Returns:
if canvasobj is None an empty iiifpapi3.Canvas obj
- Return type:
- add_structure(structure)[source]¶
Add an already instatiated Range to structres without return.
Note
This is equivalent to iiifpapi3.Manifest.add_range_to_structures but does not return.
Example
>>> manifest = iiifpapi3.Manifest() >>> manifest.set_id(extendbase_url="manifest.json") >>> manifest.add_label("en", "Image 1") >>> range = iiifpapi3.Range() >>> range.set_id('https//test') >>> manifest.add_item(range)
- Parameters:
structure (Range) – A Range object.
- add_range_to_structures(rangeobj=None)[source]¶
Add a Range object to the structures list.
https://iiif.io/api/presentation/3.0/#range https://iiif.io/api/cookbook/recipe/0024-book-4-toc
- Parameters:
rangeobj (iiifpapi3.Range, optional) – A iiifpapi3.Range to be added to the Manifest.structures list. Defaults to None.
Example
>>> rng = manifest.add_range_to_structures() >>> rng.set_id(extendbase_url="range/r0") >>> rng.add_label('en',"Table of Contents") >>> r1 = rng.add_range_to_items() >>> r1.set_id(extendbase_url="range/r1")
- Returns:
if rangeobj is None an empty iiifpapi3.Range obj
- Return type:
- add_annotationpage_to_annotations(annopageobj=None)¶
Add an AnnotationPage to the annotations list.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
https://iiif.io/api/presentation/3.0/#annotations
IIIF: An ordered list of Annotation Pages that contain commentary or other Annotations about this resource, separate from the Annotations that are used to paint content on to a Canvas.
- Parameters:
annopageobj (AnnnotationPage, optional) – An AnnotationPage object. Defaults to None.
- Returns:
An AnnotationPage if annopageobj is None.
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_service_to_services(serviceobj=None)¶
Add a service to the services list of the resource.
https://iiif.io/api/presentation/3.0/#services
IIIF: A list of one or more service definitions on the top-most resource of the document, that are typically shared by more than one subsequent resource. This allows for these shared services to be collected together in a single place, rather than either having their information duplicated potentially many times throughout the document, or requiring a consuming client to traverse the entire document structure to find the information.
- Parameters:
serviceobj (iiifpapi3.service, optional) – a iiifpapi3.service to be added. Defaults to None.
- Returns:
If serviceobj is None a iiifpapi3.service object handler.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_accompanyingCanvas(canvas=None)¶
set a accompanyingCanvas to the object.
https://iiif.io/api/presentation/3.0/#accompanyingcanvas
IIIF: A single Canvas that provides additional content for use while rendering the resource that has the accompanyingCanvas property.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as accompanyingCanvas.
- Raises:
AttributeError – if you are tyring to ad a accompanying Canvas to a accompanying Canvas.
- Returns:
A modified Canvas to be used as accompanying Canvas.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
set the navDate of the object.
https://iiif.io/api/presentation/3.0/#navdate https://iiif.io/api/cookbook/recipe/0230-navdate/
IIIF: A date that clients may use for navigation purposes when presenting the resource to the user in a date-based user interface, such as a calendar or timeline. More descriptive date ranges, intended for display directly to the user, should be included in the metadata property for human consumption.
- Parameters:
navDate (str) – A date in UTC in the format “2010-01-01T00:00:00Z”
- set_placeholderCanvas(canvas=None)¶
set a placeholderCanvas to the object.
https://iiif.io/api/presentation/3.0/#placeholdercanvas
IIIF: A single Canvas that provides additional content for use before the main content of the resource that has the placeholderCanvas property is rendered, or as an advertisement or stand-in for that content.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as placeholderCanvas.
- Raises:
AttributeError – if you are tyring to ad a placeholder Canvas to a placeholder Canvas.
- Returns:
A modified Canvas to be used as placeholder Canvas.
- Return type:
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- set_start(startobj=None)¶
This method set a start obejct at self.start. IIIF: A Canvas, or part of a Canvas, which the client should show on initialization for the resource that has the start property. The reference to part of a Canvas is handled in the same way that Ranges reference parts of Canvases. This property allows the client to begin with the first Canvas that contains interesting content rather than requiring the user to manually navigate to find it.
Notes
set_start self assign start attribute to a iiifpapi3.start handler see example below on how to use it.
Examples
>>> manifest.set_start() >>> manifest.start.set_type('Canvas') >>> manifest.start.set_id("https://example.org/iiif/1/canvas/1")
- Returns:
a reference to the start object to be used
- Return type:
start object
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- set_viewingDirection(viewingDirection)¶
Set the viewing direction of the object.
The viewing direction can be one of these: left-to-right The object is displayed from left to right.
The default if not specified.
right-to-left The object is displayed from right to left. top-to-bottom The object is displayed from the top to the bottom. bottom-to-top The object is displayed from the bottom to the top.
https://iiif.io/api/presentation/3.0/#viewingdirection
- Parameters:
viewingDirection (str) – The viewing direction.
- class IIIFpres.iiifpapi3.refManifest[source]¶
Bases:
_CoreAttributes,_Thumbnailpseudo-IIIF resource
https://iiif.io/api/presentation/3.0/#51-collection
This class is used for creating references to Manifest:
IIIF: Collections or Manifests referenced in the items property must have the id, type and label properties. They should have the thumbnail property.
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- class IIIFpres.iiifpapi3.Collection[source]¶
Bases:
_CMRCattributes,_ViewingDirection,_ServicesListIIIF resource
https://iiif.io/api/presentation/3.0/#51-collection https://iiif.io/api/cookbook/recipe/0230-navdate/navdate-collection.json
IIIF: Collections are used to list the Manifests available for viewing. Collections may include both other Collections and Manifests, in order to form a tree-structured hierarchy. Collections might align with the curated management of cultural heritage resources in sets, also called “collections”, but may have absolutely no such similarity.
Example
>>> collection = iiifpapi3.Collection() >>> collection.set_id("0230-navdate/navdate-collection.json") >>> collection.add_label(language='en',text="Chesapeake and Ohio") >>> tbn = collection.add_thumbnail() >>> collection.add_manifest_to_items(manifest_2) >>> collection.add_manifest_to_items(manifest_1)
- add_item(item)[source]¶
Add an item (Collection or Manifest) to the Manifest without returning.
A Collection must have the items property. Each item must be either a Collection or a Manifest.
- Parameters:
item (Collection or Manifest) – The item to be added.
- add_collection_to_items(collectionobj=None)[source]¶
Add a Collection object to the items list.
https://iiif.io/api/presentation/3.0/#51-collection https://iiif.io/api/cookbook/recipe/0009-book-1/
- Parameters:
collectionobj (iiifpapi3.Canvas, optional) – A iiifpapi3.Canvas to be added to the Manifest.items list. Defaults to None.
Example
>>> subcollection = collection.add_collection_to_items()
- Returns:
if collectionobj is None an empty iiifpapi3.Collection obj
- Return type:
- add_manifest_to_items(manifestobj=None)[source]¶
Add a Manifest object to the items list.
https://iiif.io/api/presentation/3.0/#51-collection https://iiif.io/api/cookbook/recipe/0009-book-1/
- Parameters:
manifestobj (iiifpapi3.Manifest, optional) – A iiifpapi3.Manifest to be added to the Collection.items list. Defaults to None.
Example
>>> subcollection = collection.add_collection_to_items()
- Returns:
if manifestobj is None an empty iiifpapi3.Manifest obj
- Return type:
- add_annotationpage_to_annotations(annopageobj=None)¶
Add an AnnotationPage to the annotations list.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
https://iiif.io/api/presentation/3.0/#annotations
IIIF: An ordered list of Annotation Pages that contain commentary or other Annotations about this resource, separate from the Annotations that are used to paint content on to a Canvas.
- Parameters:
annopageobj (AnnnotationPage, optional) – An AnnotationPage object. Defaults to None.
- Returns:
An AnnotationPage if annopageobj is None.
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_service_to_services(serviceobj=None)¶
Add a service to the services list of the resource.
https://iiif.io/api/presentation/3.0/#services
IIIF: A list of one or more service definitions on the top-most resource of the document, that are typically shared by more than one subsequent resource. This allows for these shared services to be collected together in a single place, rather than either having their information duplicated potentially many times throughout the document, or requiring a consuming client to traverse the entire document structure to find the information.
- Parameters:
serviceobj (iiifpapi3.service, optional) – a iiifpapi3.service to be added. Defaults to None.
- Returns:
If serviceobj is None a iiifpapi3.service object handler.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_accompanyingCanvas(canvas=None)¶
set a accompanyingCanvas to the object.
https://iiif.io/api/presentation/3.0/#accompanyingcanvas
IIIF: A single Canvas that provides additional content for use while rendering the resource that has the accompanyingCanvas property.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as accompanyingCanvas.
- Raises:
AttributeError – if you are tyring to ad a accompanying Canvas to a accompanying Canvas.
- Returns:
A modified Canvas to be used as accompanying Canvas.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
set the navDate of the object.
https://iiif.io/api/presentation/3.0/#navdate https://iiif.io/api/cookbook/recipe/0230-navdate/
IIIF: A date that clients may use for navigation purposes when presenting the resource to the user in a date-based user interface, such as a calendar or timeline. More descriptive date ranges, intended for display directly to the user, should be included in the metadata property for human consumption.
- Parameters:
navDate (str) – A date in UTC in the format “2010-01-01T00:00:00Z”
- set_placeholderCanvas(canvas=None)¶
set a placeholderCanvas to the object.
https://iiif.io/api/presentation/3.0/#placeholdercanvas
IIIF: A single Canvas that provides additional content for use before the main content of the resource that has the placeholderCanvas property is rendered, or as an advertisement or stand-in for that content.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as placeholderCanvas.
- Raises:
AttributeError – if you are tyring to ad a placeholder Canvas to a placeholder Canvas.
- Returns:
A modified Canvas to be used as placeholder Canvas.
- Return type:
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- set_viewingDirection(viewingDirection)¶
Set the viewing direction of the object.
The viewing direction can be one of these: left-to-right The object is displayed from left to right.
The default if not specified.
right-to-left The object is displayed from right to left. top-to-bottom The object is displayed from the top to the bottom. bottom-to-top The object is displayed from the bottom to the top.
https://iiif.io/api/presentation/3.0/#viewingdirection
- Parameters:
viewingDirection (str) – The viewing direction.
- class IIIFpres.iiifpapi3.Range[source]¶
Bases:
_CMRCattributes,_ViewingDirection,_StartIIIF resource
https://iiif.io/api/presentation/3.0/#54-range https://iiif.io/api/cookbook/recipe/0024-book-4-toc
IIIF: Ranges are used to represent structure within an object beyond the default order of the Canvases in the items property of the Manifest, such as newspaper sections or articles, chapters within a book, or movements within a piece of music. Ranges can include Canvases, parts of Canvases, or other Ranges, creating a tree structure like a table of contents.
Example
>>> rng = manifest.add_range_to_structures() >>> rng.set_id(extendbase_url="range/r0") >>> rng.add_label('en',"Table of Contents") >>> r1 = rng.add_range_to_items() >>> r1.set_id(extendbase_url="range/r1") >>> r1.add_label('gez',"Tabiba Tabiban [ጠቢበ ጠቢባን]")
- add_item(item)[source]¶
Add an item (Range,Canvas,Specific Resource where the source is a Canvas) to the Range.
This function does not return. Use:
iiifpapi3.Range.add_range_to_items iiifpapi3.Range.add_specificresource_to_items
A Range must have the items property with at least one item. Each item must be a Range, a Canvas or a Specific Resource where the source is a Canvas.
- add_range_to_items(rangeobj=None)[source]¶
Add a Range object to the items list.
https://iiif.io/api/presentation/3.0/#54-range https://iiif.io/api/cookbook/recipe/0024-book-4-toc
- Parameters:
rangeobj (iiifpapi3.Range, optional) – A iiifpapi3.Range to be added to the Range.items list. Defaults to None.
Example
>>> subrange = range.add_range_to_items() >>> subrange.set_id(extendbase_url="range/r1") >>> subrange.add_label('gez',"Tabiba Tabiban [ጠቢበ ጠቢባን]")
- Returns:
if rangeobj is None an empty iiifpapi3.Range obj
- Return type:
- add_specificresource_to_items(specificresourceobj=None)[source]¶
Add a SpecificResource object to the items list.
https://iiif.io/api/presentation/3.0/#54-range https://iiif.io/api/cookbook/recipe/0024-book-4-toc
- Parameters:
rangeobj (iiifpapi3.SpecificResource, optional) – A iiifpapi3.SpecificResource to be added to the Range.items list. Defaults to None.
Example
>>> subrange = range.add_range_to_items() >>> subrange.set_id(extendbase_url="range/r1") >>> subrange.add_label('gez',"Tabiba Tabiban [ጠቢበ ጠቢባን]")
- Returns:
if rangeobj is None an empty iiifpapi3.SpecificResource obj
- Return type:
- set_supplementary(objid=None, extendbase_url=None)[source]¶
Set a supplementary resource to the range
A link from this Range to an Annotation Collection that includes the supplementing Annotations of content resources for the Range.
https://iiif.io/api/presentation/3.0/#supplementary
- Parameters:
objid (str, optional) – The ID of the supplementary resource. Defaults to None.
extendbase_url (str, optional) – part of the URL to be appended at the IIIFpapi3.BASE_URL global variable to create the ID. Defaults to None.
- add_canvas_to_items(canvas_id)[source]¶
Ad a reference to a Canvas to the items.
- To do:
Might be useful to add canvasobj removing attributes.
- Parameters:
canvas_id (str) – The ID of the Canvas.
- add_annotationpage_to_annotations(annopageobj=None)¶
Add an AnnotationPage to the annotations list.
https://iiif.io/api/presentation/3.0/#55-annotation-page
IIIF: Annotations are collected together in Annotation Page resources, which are included in the items property from the Canvas. Each Annotation Page can be embedded in its entirety, if the Annotations should be processed as soon as possible when the user navigates to that Canvas, or a reference to an external page.
https://iiif.io/api/presentation/3.0/#annotations
IIIF: An ordered list of Annotation Pages that contain commentary or other Annotations about this resource, separate from the Annotations that are used to paint content on to a Canvas.
- Parameters:
annopageobj (AnnnotationPage, optional) – An AnnotationPage object. Defaults to None.
- Returns:
An AnnotationPage if annopageobj is None.
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_accompanyingCanvas(canvas=None)¶
set a accompanyingCanvas to the object.
https://iiif.io/api/presentation/3.0/#accompanyingcanvas
IIIF: A single Canvas that provides additional content for use while rendering the resource that has the accompanyingCanvas property.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as accompanyingCanvas.
- Raises:
AttributeError – if you are tyring to ad a accompanying Canvas to a accompanying Canvas.
- Returns:
A modified Canvas to be used as accompanying Canvas.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
set the navDate of the object.
https://iiif.io/api/presentation/3.0/#navdate https://iiif.io/api/cookbook/recipe/0230-navdate/
IIIF: A date that clients may use for navigation purposes when presenting the resource to the user in a date-based user interface, such as a calendar or timeline. More descriptive date ranges, intended for display directly to the user, should be included in the metadata property for human consumption.
- Parameters:
navDate (str) – A date in UTC in the format “2010-01-01T00:00:00Z”
- set_placeholderCanvas(canvas=None)¶
set a placeholderCanvas to the object.
https://iiif.io/api/presentation/3.0/#placeholdercanvas
IIIF: A single Canvas that provides additional content for use before the main content of the resource that has the placeholderCanvas property is rendered, or as an advertisement or stand-in for that content.
- Parameters:
phcnv (iiifpapi3.Canvas, optional) – A Canvas to be used as placeholderCanvas.
- Raises:
AttributeError – if you are tyring to ad a placeholder Canvas to a placeholder Canvas.
- Returns:
A modified Canvas to be used as placeholder Canvas.
- Return type:
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- set_start(startobj=None)¶
This method set a start obejct at self.start. IIIF: A Canvas, or part of a Canvas, which the client should show on initialization for the resource that has the start property. The reference to part of a Canvas is handled in the same way that Ranges reference parts of Canvases. This property allows the client to begin with the first Canvas that contains interesting content rather than requiring the user to manually navigate to find it.
Notes
set_start self assign start attribute to a iiifpapi3.start handler see example below on how to use it.
Examples
>>> manifest.set_start() >>> manifest.start.set_type('Canvas') >>> manifest.start.set_id("https://example.org/iiif/1/canvas/1")
- Returns:
a reference to the start object to be used
- Return type:
start object
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- set_viewingDirection(viewingDirection)¶
Set the viewing direction of the object.
The viewing direction can be one of these: left-to-right The object is displayed from left to right.
The default if not specified.
right-to-left The object is displayed from right to left. top-to-bottom The object is displayed from the top to the bottom. bottom-to-top The object is displayed from the bottom to the top.
https://iiif.io/api/presentation/3.0/#viewingdirection
- Parameters:
viewingDirection (str) – The viewing direction.
- class IIIFpres.iiifpapi3.SpecificResource[source]¶
Bases:
_CommonAttributesIIIF Web Annotation Data Model resource
https://www.w3.org/TR/annotation-model/#specific-resources
- set_source(source, extendbase_url=None)[source]¶
Set the source of the SpecificResource
- Parameters:
source (str) – The source is usually an URL.
extendbase_url (str, optional) – For extending the BASE_URL and using it as a source. Defaults to None.
- set_selector(selector)[source]¶
Set the selector of the specifc resource.
- Parameters:
selector (any) – The selector of the specific resource.
- set_selector_as_PointSelector()[source]¶
Set the selectof of the SpecificReource as a PointSelector.
- Returns:
- A reference to an empty
iiifpapi3.PointSelector
- Return type:
- set_selector_as_SvgSelector(value=None)[source]¶
Set the selector to an SvgSelector or to a SVG string.
- Parameters:
value (str, optional) – An SVG as a string. Defaults to None.
- Returns:
An instance of iiifpapi3.SvgSelector
- Return type:
- add_behavior(behavior)¶
add a one ore more behaviours to the resource without returning.
https://iiif.io/api/presentation/3.0/#behavior https://iiif.io/api/cookbook/recipe/0009-book-1/
IIIF: A set of user experience features that the publisher of the content would prefer the client to use when presenting the resource. This specification defines the values below. Others may be defined externally as an extension.
auto-advance, no-auto-advance, repeat, no-repeat, unordered, individuals, continuous, multi-part, facing-pages, non-paged, together, paged, sequence, thumbnail-nav, no-nav, hidden,
Examples
>>> iiifobj.add_behavior("thumbnail-nav")
Warning
This function does not test disjoints with inherited behaviours.
- Parameters:
behavior (str) – the behaviour to be added.
- add_homepage(homepageobj=None)¶
add an homepage object to the resource.
https://iiif.io/api/presentation/3.0/#homepage https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: A web page that is about the object represented by the resource that has the homepage property. The web page is usually published by the organization responsible for the object, and might be generated by a content management system or other cataloging system. The resource must be able to be displayed directly to the user. Resources that are related, but not home pages, must instead be added into the metadata property, with an appropriate label or value to describe the relationship.
Example
>>> homp = provider.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/") >>> homp.set_type("Text") >>> homp.add_label("en","UCLA Library Digital Collections") >>> homp.set_format("text/html") >>> homp.add_language("en")
- Parameters:
homepageobj (iiifpapi3.homepage, optional) – a iiifpapi3.homepage object. Defaults to None.
- Returns:
If homepage is None a iiifpapi3.homepage object handler.
- Return type:
- add_label(language, text)¶
Add a label to the object.
- Parameters:
language (str) – The language of the label.
text (str or list of str) – The content of the label.
Example
>>> iiifobj.add_label("en", "A painting") >>> iiifobj.add_label("en", ["Canvas","Oil"])
IIIF : A human readable label, name or title. The label property is intended to be displayed as a short, textual surrogate for the resource if a human needs to make a distinction between it and similar resources, for example between objects, pages, or options for a choice of images to display. The label property can be fully internationalized, and each language can have multiple values.
- add_metadata(label=None, value=None, language_l='none', language_v='none', entry=None)¶
Add a metadata object to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#metadata https://iiif.io/api/cookbook/recipe/0029-metadata-anywhere/
IIIF: An ordered list of descriptions to be displayed to the user when they interact with the resource, given as pairs of human readable label and value entries. The content of these entries is intended for presentation only; descriptive semantics should not be inferred. An entry might be used to convey information about the creation of the object, a physical description, ownership information, or other purposes.
- Parameters:
label (str, optional) – The label e.g. Author:. Defaults to None.
value (str, optional) – The value e.g. Herman Melville. Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
Examples
>>> iiifobj.add_metadata("Author:","Herman Melville","en","en") >>> md = canvas.add_metadata() >>> md.add_label("Author:","en") >>> md.add_value("Herman Meliville","en")
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
- add_partOf(partOfobj=None)¶
Add a partOf to the partOfs list of the resource.
https://iiif.io/api/presentation/3.0/#partof
IIIF: A containing resource that includes the resource that has the partOf property.
- Parameters:
partOfobj (iiifpapi3.partOf, optional) – a iiifpapi3.partOf to be added. Defaults to None.
- Returns:
- If partOfobj is None a iiifpapi3.partOf object
handler.
- Return type:
iifpapi3.partOf
- add_provider(providerobj=None)¶
Add a provider to the provider list of the resource.
https://iiif.io/api/presentation/3.0/#provider https://iiif.io/api/cookbook/recipe/0234-provider/
IIIF: An organization or person that contributed to providing the content of the resource.
Example
>>> prov = manifest.add_provider() >>> prov.set_id("https://id.loc.gov/authorities/n79055331") >>> prov.add_label(language='en', text="UCLA Library") >>> homp = prov.add_homepage() >>> homp.set_id("https://digital.library.ucla.edu/")
- Parameters:
providerobj (iiifpapi3.provider, optional) – a iiifpapi3.provider to beadded. Defaults to None.
- Returns:
If providerobj is None a iiifpapi3.provider object handler.
- Return type:
- add_rendering(renderingobj=None)¶
Add a rendering to the renderings list of the resource.
https://iiif.io/api/presentation/3.0/#rendering https://iiif.io/api/cookbook/recipe/0046-rendering/
IIIF: A resource that is an alternative, non-IIIF representation of the resource that has the rendering property.
Example
>>> rendering = manifest.add_rendering() >>> rendering.set_id("https://fixtures.iiif.io/other/UCLA/kab.pdf") >>> rendering.set_type("Text") >>> rendering.add_label("en", "PDF version") >>> rendering.set_format("application/pdf")
- Parameters:
renderingobj (iiifpapi3.rendering, optional) – a iiifpapi3.rendering to be added. Defaults to None.
- Returns:
If renderingobj is None a iiifpapi3.rendering object handler.
- Return type:
- add_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
- add_seeAlso(seeAlsoobj=None)¶
Add a seeAlso object to the resource.
IIIF: A machine-readable resource such as an XML or RDF description that is related to the current resource that has the seeAlso property.
https://iiif.io/api/presentation/3.0/#seealso
- Parameters:
seeAlsoobj (iiifpapi3.seeAlso, optional) – a iiifpapi3.seeAlso object. Defaults to None.
- Returns:
if seeAlsoobj is None a iiifpapi3.seeAlso
- Return type:
- add_service(serviceobj=None)¶
Add a service to the resource.
https://iiif.io/api/presentation/3.0/#service
IIIF: A service that the client might interact with directly and gain additional information or functionality for using the resource that has the service property, such as from an Image to the base URI of an associated IIIF Image API service.
- Parameters:
serviceobj (serviceobj, optional) – A iiifpapi3.service object or a dict representing the service in case of older service. Defaults to None.
- Returns:
In case serviceobj is None a iiifpapi3.service.
- Return type:
- add_summary(language, text)¶
Add directly an entry in the summary dict without returning handler.
https://iiif.io/api/presentation/3.0/#summary https://iiif.io/api/cookbook/recipe/0006-text-language
IIIF: A short textual summary intended to be conveyed to the user when the metadata entries for the resource are not being displayed. This could be used as a brief description for item level search results, for small-screen environments, or as an alternative user interface when the metadata property is not currently being rendered.
- Parameters:
language (str) – The language of the summary.
text (str) – The text of the summary.
- add_thumbnail(thumbnailobj=None)¶
Add a thumbnail object to the resource.
https://iiif.io/api/presentation/3.0/#thumbnail
IIIF: A content resource, such as a small image or short audio clip, that represents the resource that has the thumbnail property. A resource may have multiple thumbnail resources that have the same or different type and format.
- Parameters:
thumbnailobj (iiifpapi3.thumbnail, optional) – A iiifpapi3.thumbnail object. Defaults to None.
- Returns:
a iiifpapi3.thumbnail object if thumnailobj is None.
- Return type:
- set_id(objid=None, extendbase_url=None)¶
Set the ID of the object
https://iiif.io/api/presentation/3.0/#id
IIIF: The URI that identifies the resource. If the resource is only available embedded within another resource (see the terminology section for an explanation of “embedded”), such as a Range within a Manifest, then the URI may be the URI of the embedding resource with a unique fragment on the end. This is not true for Canvases, which must have their own URI without a fragment.
- Parameters:
objid (str, optional) – A string corresponding to the ID of the object id = objid.Defaults to None.
extendbase_url (str , optional) – A string containing the URL part to be joined with the iiifpapi3.BASE_URL: id = iiifpapi3.BASE_URL + extendbase_url. Defaults to None.
- set_requiredStatement(label=None, value=None, language_l=None, language_v=None, entry=None)¶
Set/add a requiredStatement to the resource and returns a languge map.
https://iiif.io/api/presentation/3.0/#requiredstatement https://iiif.io/api/cookbook/recipe/0006-text-language/
IIIF: For example, the requiredStatement property could be used to present copyright or ownership statements, an acknowledgement of the owning and/or publishing institution, or any other text that the publishing organization deems critical to display to the user.
- Parameters:
label (str, optional) – The label e.g. Attribution:. Defaults to None.
value (str, optional) – The value e.g. Provided courtesy of Example Institution.Defaults to None.
language_l (str, optional) – the language of the label e.g. en. Defaults to “none”.
language_v (str, optional) – the langugage of the value e.g. none or en. Defaults to “none”.
entry (dict, optional) – A metadata dict. Defaults to None.
- Raises:
ValueError – If an entry is provided toghether with other arguments.
- Returns:
If no arguments are passed a language map is returned as handler so that the user can fill the fields.
- Return type:
Examples
>>> reqstat = manifest.set_requiredStatement() >>> reqstat.add_label(language="en", label="Held By") >>> reqstat.add_label(language="fr", label="Détenu par") >>> reqstat.add_value(value="Musée d'Orsay, Paris, France")
- set_rights(rights)¶
set the rights of the resources.
https://iiif.io/api/presentation/3.0/#rights
IIIF: A string that identifies a license or rights statement that applies to the content of the resource, such as the JSON of a Manifest or the pixels of an image. The value must be drawn from the set of Creative Commons license URIs, the RightsStatements.org rights statement URIs, or those added via the extension mechanism. The inclusion of this property is informative, and for example could be used to display an icon representing the rights assertions.
- Parameters:
rights (str) – an URL pointing to a licence.
- class IIIFpres.iiifpapi3.ImageApiSelector[source]¶
Bases:
_Format,_ImmutableTypeIIIF Resource
https://iiif.io/api/annex/openannotation/#iiif-image-api-selector
IIIF: The Image API Selector is used to describe the operations available via the Image API in order to retrieve a particular image representation. In this case the resource is the abstract image as identified by the IIIF Image API base URI plus identifier, and the retrieval process involves adding the correct parameters after that base URI. For example, the top left hand quadrant of an image has the region parameter of pct:0,0,50,50 which must be put into the requested URI to obtain the appropriate representation.
- set_region(region)[source]¶
Set the region of the image API selector.
- Parameters:
region (str) – The region of the ImageAPI selector.
- set_rotation(rotation)[source]¶
Set the rotation of the image API selector.
- Parameters:
rotation (str,int) – The rotation to be applied to the image.
- set_quality(quality)[source]¶
Set the quality to to the ImageAPI selector.
- Parameters:
quality (str) – e.g. default
- set_size(size)[source]¶
Set the size parameter of the ImageAPI selector.
- Parameters:
size (str) – The requested size of the image.
- set_format(format)¶
Set the format of the resource.
https://iiif.io/api/presentation/3.0/#format
IIIF: The specific media type (often called a MIME type) for a content resource, for example image/jpeg. This is important for distinguishing different formats of the same overall type of resource, such as distinguishing text in XML from plain text.
- Parameters:
format (str) – Usually is the MIME e.g. image/jpeg.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- class IIIFpres.iiifpapi3.PointSelector[source]¶
Bases:
_ImmutableTypehttps://iiif.io/api/annex/openannotation/#point-selector
There are common use cases in which a point, rather than a range or area, is the target of the Annotation. For example, putting a pin in a map should result in an exact point, not a very small rectangle. Points in time are not very short durations, and user interfaces should also treat these differently. This is particularly important when zooming in (either spatially or temporally) beyond the scale of the frame of reference. Even if the point takes up a 10 by 10 pixel square at the user’s current resolution, it is not a rectangle bounding an area.
It is not possible to select a point using URI Fragments with the Media Fragment specification, as zero-sized fragments are not allowed. In order to fulfill the use cases, this specification defines a new Selector class called PointSelector.
Property Description type Required. Must be the value “PointSelector”. x Optional. An integer giving the x coordinate of the point, relative to
the dimensions of the target resource.
- y Optional. An integer giving the y coordinate of the point, relative to
the dimensions of the target resource.
- t Optional. A floating point number giving the time of the point in seconds,
relative to the duration of the target resource
- set_t(t)[source]¶
Set the time time of the point in seconds.
- Parameters:
t (float) – The time of the point in seconds relative to the duration.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- class IIIFpres.iiifpapi3.FragmentSelector[source]¶
Bases:
_ImmutableTypeW3C: As the most well understood mechanism for selecting a Segment is to use the fragment part of an IRI defined by the representation’s media type, it is useful to allow this as a description mechanism via a Selector.
https://www.w3.org/TR/annotation-model/#fragment-selector
- set_xywh(x, y, w, h)[source]¶
Set the starting x and y point and the widht and height.
- Parameters:
x (int) – The x coordinate.
y (int) – The y coordinate.
w (int) – The width coordinate.
h (int) – The hieght coordinate.
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
- class IIIFpres.iiifpapi3.SvgSelector[source]¶
Bases:
_ImmutableTypeThe SvgSelector is used to select a non rectangualar region of an image. https://www.w3.org/TR/annotation-model/#svg-selector
- set_type(mtype=None)¶
In case of IIIF objects with predefined type this function won’t change the type but will rise an error if you try to change it.
https://iiif.io/api/presentation/3.0/#type
- Parameters:
mtype (str, optional) – the type of the object. Defaults to None.
- Raises:
ValueError – In case you are trying to set a type.
IIIFpres.utilities module¶
- IIIFpres.utilities.modify_API3_json(path)[source]¶
Modify an IIIF json file complaint with API 3.0 This method parse only the frist level of the IIIF object. All the nested object are left as dict.
It is faster compared to read read_API3_json.
Note
the method assumes the IIIF object is complaint to API 3.0.
- Parameters:
path (str) – The path of the json file.
- IIIFpres.utilities.read_API3_json_dict(jsondict, extensions=None, save_context=False)[source]¶
Read an IIIF json file complaint with API 3.0 and map iiifpapi3 objects.
This method parse the major IIIF types and map them to the iiifpapi3 classes.
Note
the method assumes the IIIF object is complaint to API 3.0.
- Parameters:
jsondict (dict) – a dict representing the JSON file.
extensions
- IIIFpres.utilities.read_API3_json(path, extensions=None, save_context=False)[source]¶
Read an IIIF json file complaint with API 3.0 and map the IIIF types to classes.
This method parse the major IIIF types and map them to the iiifpapi3 classes.
Note
the method assumes the IIIF object is complaint to API 3.0.
- Parameters:
path (str) – path of the jsonfile
- IIIFpres.utilities.read_API3_json_file(path, extensions=None, save_context=False)[source]¶
Read an IIIF json file complaint with API 3.0 and map the IIIF types to classes.
This method parse the major IIIF types and map them to the iiifpapi3 classes. NOTE: the method assumes the IIIF object is complaint to API 3.0.
- Parameters:
path (str) – path of the jsonfile
- IIIFpres.utilities.delete_object_byID(obj, id)[source]¶
Deletes nested IIIF objects using the ID.
- Parameters:
obj (dict) – a dict representing the IIIF object.
id (str) – the ID of the object to be delete.
- Returns:
if the ID was found.
- Return type:
True
- IIIFpres.utilities.remove_and_insert_new(obj, id, newobj)[source]¶
Remove inplace from any IIIF object (collection, manifest, canvas, etc) the object with the given id and insert the new object.
- Parameters:
obj (IIIFobject) – The object to modify.
id (str) – The id of the object to remove.
newobj (IIIFobject) – The new object to insert.
- Returns:
The number of objects removed. If 0, nothing was removed.
- Return type:
counter (int)
IIIFpres.visualization_html module¶
- IIIFpres.visualization_html.show_error_in_browser(myjson, getHTML=False)[source]¶
Get display a dict in the browser highlighting Recommended and Required fields.
- Parameters:
myjson (dict) – A dictionary representing the JSON object.
getHTML (bool, optional) – if True returns the HTML as string. Defaults to False.
Module contents¶
The module maps the IIIF presentation API structure (https://iiif.io/api/presentation/3.0/) to Python classes. The user set_ objects that can have only one value (e.g. id) and add_ objects that can have multiple entities (e.g. labels). As an example, we will execute part of the Simple Manifest - Book recipe from the IIIF cookbook.
from IIIFpres import iiifpapi3 iiifpapi3.BASE_URL = “https://iiif.io/api/cookbook/recipe/0009-book-1/” manifest = iiifpapi3.Manifest() manifest.set_id(extendbase_url=”manifest.json”) manifest.add_label(“en”,”Simple Manifest - Book”) manifest.add_behavior(“paged”) canvas = manifest.add_canvas_to_items() canvas.set_id(extendbase_url=”canvas/p%s”%idx) # in this case we use the base url … manifest.json_save(“manifest.json”)