NAME
DAIA::Availability - Abstract base class of availability information
DESCRIPTION
Availability in DAIA is modeled as a combination of service and status. The availability status is a boolean value - either something is available or it is not. The service must be one of presentation
, loan
, interloan
, and openaccess
or a custom URI. Additionally you can specify some details about the availability.
In general availability is encoded as an object of either DAIA::Available (status true
) or DAIA::Unavailable (status false
). There are several equivalent ways to define a given service as available:
available( $service );
available( service => $service ),
DAIA::Available->new( $service );
DAIA::Available->new( service => $service );
availability( service => $service, status => 1 );
availability( { service => $service, status => 1 } );
availability( 1, service => $service );
availability( $service => 1 );
Likewise there are several equivalent ways to define a service as unavailable:
unavailable( $service );
unavailable( service => $service ),
DAIA::Unavailable->new( $service );
DAIA::Unavailable->new( service => $service );
availability( service => $service, status => 0 );
availability( { service => $service, status => 0 } );
availability( 0, service => $service );
availability( $service => 0 );
PROPERTIES
- status
-
Either true DAIA::Available or false DAIA::Unavailable. Modifying the status changes the object type:
$a->status # returns 0 or 1 $a->status(0) # make $a a DAIA::Unavailable object $a->status(1) # make $a a DAIA::Available object
- service
-
One of
presentation
,loan
,interloan
, andopenaccess
(highly recommended) or a custom URI (use with care). The predefined URLshttp://purl.org/NET/DAIA/services/presentation
,http://purl.org/NET/DAIA/services/loan
,http://purl.org/NET/DAIA/services/interloan
, andhttp://purl.org/NET/DAIA/services/openaccess
are converted to their short form equivalent. - href
-
An URL to perform, register or reserve the service.
- limitation
-
An array reference with limitations (DAIA::Limitation objects).
- message
-
An array reference with DAIA::Message objects about this specific service.
Depending on whether the availability's status is true (DAIA::Available) or false (DAIA::Unavailable), the properties delay
, queue
, and expected
are also possible.
CONSTRUCTOR
A new availability can be created with the constructors of DAIA::Availability, DAIA::Available, and DAIA::Unavailable or with the shortcut functions available
, unavailable
, and availability
which are exported in DAIA. You can also create a new availability object with the methods addAvailable
, addUnavailable
, and addAvailability
of DAIA::Item.
METHODS
DAIA::Item provides the default methods of DAIA::Object, accessor methods for all of its properties and the following methods
addMessage ( $message | ... )
Add a specified or a new DAIA::Message.
addLimitation ( $limitation | ... )
Add a specified or a new DAIA::Limitation.
status ( [ 0 | 1 ] )
Get or set the availability status (true for DAIA::Available and false for DAIA::Unavailable). This method may change the type of the object:
$avail = available( 'loan' ); # now $avail isa DAIA::Available
$avail->status(0); # now $avail isa DAIA::Unavailable
FUNCTIONS
FUNCTIONS
This package implements a duration parsing method based on code from DateTime::Format::Duration::XSD by Smal D A.
parse_duration ( $string )
Parses a XML Schema xs:duration string and returns a DateTime::Duration object or undef.
normalize_duration ( $string-or-duration-object )
Returns a normalized duration (according to XML Schema xs:duration). You can pass a duration string or a DateTime::Duration object. Returns undef on failure.
date_or_datetime ( $date_or_datetime )
Returns a canonical xs:date or xs:dateTime value or undef. You can pass a DateTime object or a string as defined in section 3.2.7.1 of the XML Schema Datatypes specification. Fractions of seconds are ignored.
AUTHOR
Jakob Voss <jakob.voss@gbv.de>
LICENSE
Copyright (C) 2009-2010 by Verbundzentrale Goettingen (VZG) and Jakob Voss
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.