Device Description Repository Simple API 1f

Editors' Draft 28 February 2008

This version:
http://www.w3.org/2005/MWI/DDWG/drafts/api/080228
Latest version:
http://www.w3.org/2005/MWI/DDWG/drafts/api/latest
Previous version:
http://www.w3.org/2005/MWI/DDWG/drafts/api/080223
Editors:
Jo Rabin, dotMobi (mTLD Top Level Domain)
José Manuel Cantera Fonseca, Telefónica I+D
Rotan Hanrahan, MobileAware
Ignacio Marín, Fundación CTIC

Abstract

Web content delivered to a mobile context usually benefits from being tailored to take into account a range of factors such as device form factor, input capabilities, browser markup language support and image format support. Data about such information is stored in proprietary databases called "Device Description Repositories" (DDR).

This document describes a simple API for access to DDRs, in order to ease and promote the development of such adaptive Delivery Context aware Web content.

Status of this Document

This document is an editors' copy that has no official standing.

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is an Editorial Draft of a possible future W3C Recommendation.

Publication as an Editorial Draft does not imply endorsement by the Device Description Working Group or the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document is published as part of the W3C Mobile Web Initiative (MWI) by the Device Description Working Group. It is a deliverable as defined in the Charter of that group.

Please send comments to public-ddwg@w3.org. This list is archived at http://lists.w3.org/Archives/Public/public-ddwg/.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Revision Description

Table of Contents

1 Introduction
    1.1 Background to the need for Device Description Repositories
    1.2 Development of the Simple API Recommendation
    1.3 Scope
2 Reading the Recommendation
    2.1 Normative and Informative Parts
    2.2 Normative Language for Conformance Requirements
    2.3 Language Bindings
3 Interfaces
    3.1 Supporting Interfaces
        3.1.1 Evidence
            3.1.1.1 Methods
        3.1.2 PropertyName
            3.1.2.1 Methods
        3.1.3 PropertyRef
            3.1.3.1 Constants
            3.1.3.2 Methods
        3.1.4 PropertyValue
            3.1.4.1 Methods
        3.1.5 SimplePropertyValues
            3.1.5.1 Methods
    3.2 Service Interface
        3.2.1 Query Methods
            3.2.1.1 Return Known Values
            3.2.1.2 Return the Values of a Specific List
            3.2.1.3 Return the Value of a Single Property
        3.2.2 Factory Methods
            3.2.2.1 Create Evidence
            3.2.2.2 Create PropertyName
            3.2.2.3 Create PropertyRef
        3.2.3 Information Methods
            3.2.3.1 Get Version Information
            3.2.3.2 List Available Properties
        3.2.4 Initialization
    3.3 Exceptions
    3.4 Instantiation
4 Vocabularies
5 Conformance
    5.1 General Conformance Requirements
    5.2 Conformance Requirements (Languages where there is a Normative Binding)
    5.3 Conformance Requirements (Languages where there is no Normative Binding)

Appendices

A IDL Definitions for Simple API
B Java Bindings
    B.1 org.w3c.ddr.simple.Evidence
    B.2 org.w3c.ddr.simple.PropertyName
    B.3 org.w3c.ddr.simple.PropertyRef
    B.4 org.w3c.ddr.simple.PropertyValue
    B.5 org.w3c.ddr.simple.PropertyValues
    B.6 org.w3c.ddr.simple.Service
    B.7 org.w3c.ddr.simple.ServiceFactory
    B.8 Exceptions
C WSDL Language Binding
D Binding rules for mapping APIs to any programming language
E Normative References
F Informative Use Case: To Be defined (Non-Normative)
G Informative References (Non-Normative)
H Acknowledgements (Non-Normative)


1 Introduction

This section is informative.

1.1 Background to the need for Device Description Repositories

The need for Device Descriptions (information about the properties of various aspects of the Delivery Context [definition]) is not confined to the mobile Delivery Context. It has been common, for some time, to use the technique of "browser sniffing" to determine possibly small but important differences between various desktop Web browsers and adapt content to accommodate those differences.

The number of different properties that affect the usability of the resulting content for the desktop Delivery Context is limited, when compared with the number of different properties of the mobile Delivery Context that affect usability of content. Examples of such properties include screen dimensions, input methods, memory and CPU constraints, as well as differences in implementation and support between Web browsers which typically vary by many factors including markup languages supported and image formats supported.

Historically, it has been difficult or impossible to upgrade Web browser software on mobile devices or to add support for features not present in the Web browser originally shipped with the device. This leads to a very wide variation not only of hardware related features but also of features determined by software and firmware. As a result of this, although the need for content adaptation is a general requirement of the Web as a whole, the need for a more systematic approach is seen as being most urgent in the mobile Delivery Context.

As a result, Device Description Repositories (DDRs) have become the sine qua non of development of content targeted at the mobile Delivery Context. A number of proprietary implementations exist, each with its own API and method of describing the properties of the Delivery Context.

The Device Descriptions Working Group (DDWG), a Working Group of the W3C Mobile Web Initiative, was chartered to create a single API though which property values can be retrieved, and a "core" vocabulary [Core Vocabulary] that identifies a small number of such properties.

1.2 Development of the Simple API Recommendation

Editorial Note Rev 1f (JR): Would this section better be placed into a note?

By charter, the DDWG's work was limited to providing an API into a DDR, and to consider only those applications of DDRs that relate to the delivery of Web content to mobile devices.

It was recognised at the time of creation of the charter that there are many other similar use cases, including delivery of non Web content (such as MMS) to mobile devices, as well as delivery of Web content to some types of non mobile devices which may share some of restrictions and wide variations of mobile devices.

It was also recognized that by their very nature, DDRs are limited to describing the values of properties of devices that can be known "a priori". For example, while it may be known that the screen size of a particular device is a certain number of pixels, and while it may also be known that the screen orientation can change from landscape to portrait, it cannot be known a priori what the orientation is at any particular moment.

In the course of the work of the DDWG it became clear that having an API that revealed only the a properties of a particular device that can be known a priori, and a potentially different api to reveal those that can not, would entail usability difficulties for creators of software that uses API. For instance, in the example above relating to screen orientation use of a DDR API would reveal the screen orientation for some set of devices, but for other devices leave the need for further, possibly unrelated, API calls to determine the actual screen orientation. It was felt that such a situation would not serve the community of software developers well.

Unfortunately, categorization of properties into classes of "can not be known a priori" (sometimes called dynamic properties) and "can be known a priori" (sometimes called static properties) turns out to be fraught with difficulties, leaving most properties in the category of "can not be known a priori on some set of devices".

Additionally, as work progressed, the DDWG gained an increasing understanding that properties refer in some cases to the Delivery Context as a whole, and in other cases to specific constituent components of the Delivery Context. For example, screen width and height are often considered to be properties of the device hardware, but more usefully to the developer, they might be considered to represent the size of the canvas when operating system and browser chrome, together with scroll bars are taken into account. In other cases, for example, the properties Vendor, Model and Version, each constituent component of the delivery context has a separate and discrete identity, so it is unhelpful to regard these properties as being a superposition of the contributions of the various individual components.

Moreover, it is possible that more than one component of the same type may be present in the delivery context. The type of the component was described by the DDWG as an "aspect" of the Delivery Context, and as work on the API progressed it became clear that to provide a complete API that allows both the identification of components present in a Delivery Context and also allows the querying of aspects or specific components of the Delivery Context would be a very significant task, well beyond the scope and charter of the DDWG. Such an API would not be limited to mobile Delivery Contexts and would not be limited to determining a priori information.

The DDWG, recognizing the urgent need for an API to ease and promote the development of adaptive context aware content - specifically mobile Web content - decided to create a "simple" API that fulfils the majority of needs of the "Run Time" use case. It decided also to documenting its findings to contribute to a possible future activity in a Working Group chartered to consider uses cases that go beyond the limitations of mobile repository derived information.

1.3 Scope

Various use cases for DDRs are detailed in [Requirements]. In summary, the uses fall into two main classes: design time and run time. The design time use case relates to the activities of the planning, UI prototyping, market research and so on for mobile Web applications. These are collectively also referred to as cataloging functions. By contrast, the run time use case represents the determining of the actual values of properties that are relevant to a particular application for the delivery of Web content.

The W3C DDR Simple API supports only the run-time use case. It provides read-only functionality to allow an adapting application to provide evidence in the form of HTTP headers that identifies the Delivery Context (DC) and allows it query the DDR for property values of aspects of the DC identified. In addition, it provides access to basic catalog information that allows it to find out about which properties are supported.

The run-time use case consists, in general, of two logically (though not necessarily in practice) distinct activities: Device Recognition and Property Value Retrieval. The simple API does not expose these two activities as distinct to the user of the API.

The types of components that compose a specific Delivery Context (its aspects) are in general many and various. Different vocabularies (sets of properties) recognize different aspects of the delivery context that are "essential" to implementing adaptive mobile content. For example, the Core Vocabulary [Core Vocabulary] recognises the aspects of "device" and "Web browser". Other aspects of the Delivery Context may be supported other vocabularies.

There are an indefinite number of possible properties descriptive of the Delivery Context. The simple API does not define any properties nor mandate the use of any particular vocabulary of such properties. The DDWG strongly recommends that its Core Vocabulary is supported by all DDRs. The requirements of vocabularies supported by the DDR Simple API are documented in 4 Vocabularies.

This Recommendation provides a normative definition of the interface based on OMG IDL [IDL]. In addition, it provides a normative WSDL [WSDL] and Java [Java] bindings.

2 Reading the Recommendation

This section is normative.

3 Interfaces

3.1 Supporting Interfaces

A number of supporting interfaces are defined for various types of data that are used in the DDR Simple API. They are described in the following sections.

The principal interface of the DDR API, Service, is defined in 3.2 Service Interface, it is this interface that contains the factory methods for creating instances of the interfaces discussed here.

3.2 Service Interface

The Service interface is the core of the DDR Simple API. Using methods of Service the caller supplies Evidence representing the Delivery Context and an indication of the properties of interest. These methods return PropertyValue objects which can then be queried to reveal the values of the properties of interest.

The Service may be instantiated by a supplied factory [@@(q.v.)] class. The class invokes the initialize method to establish a default vocabulary and to pass implementation specific settings.

All implementations are required to support Evidence consisting of name/value pairs of HTTP headers.

The methods of the Service interface fall into the following categories, which are discussed in the subsequent sections:

3.2.1 Query Methods

Query methods return values for properties of the Delivery Context represented by the supplied Evidence.

The following types of query method exist:

4 Vocabularies

This section is normative.

A vocabulary is a set of properties which together provide information about aspects of the delivery context. From the point of view of this recommendation, a vocabulary defines the relationship between properties and the aspects they refer to.

Vocabularies have a namespace which governs both property names and aspect names. This API does not require that aspect names and property names are distinct from each other, though for the sake of clarity to human readers this is @@probably a good idea.

Property and aspect names must conform to the syntax defined in "Namespaces in XML" [XML Namespaces]. The value "__NULL" is reserved as the null aspect name.

Editorial Note Rev 1f (Jo): Need to define what types vocabs can have

Vocabularies also define the data types of their constituent property values. The allowable dat types are: Unicode String, Integer, Boolean ... [@@to be confirmed] [@@ all with thier meaning defined as in XMLSchema??]

The DDWG has published a suggested "core" vocabulary for essential properties for Web content adaptation [Core Vocabulary]. It is anticipated that implementations will extend the core vocabulary by using properties defined in different name spaces.

[@@Also need to check that the Core Vocab note makes it clear that extensions require that a new namespace is defined.]

5 Conformance

This section is normative.

A IDL Definitions for Simple API

This appendix contains the complete normative OMG IDL [IDL] definitions for DDR-API

Editorial Note Version 1f (JR): need new version

IDL

tbd

B Java Bindings

Java bindings are normative?

The code can be browsed at http://www.w3.org/2005/MWI/DDWG/drafts/api/simple/java/org/w3c/ddr/simple/

B.4 org.w3c.ddr.simple.PropertyValue

Java

package org.w3c.ddr.simple;

import org.w3c.ddr.simple.exception.ValueException;

/**
 * Represents the value of a property
 * 
 * @author jmcf
 * 
 */
public interface PropertyValue {

	/**
	 * 
	 * Returns the value as double in the default units of the property
	 * 
	 * If the value cannot be represented as a double an exception will be
	 * thrown
	 * 
	 * 
	 */
	public double getDouble() throws ValueException;

	/**
	 * 
	 * Returns the value as a long in the default units of the property
	 * 
	 * An exception will be thrown if the value cannot be represented as a long
	 * 
	 * @return
	 * @throws ValueException
	 */
	public long getLong() throws ValueException;

	/**
	 * 
	 * Returns the value of the property as a String
	 * 
	 * This method will return
	 * 
	 * @return
	 */
	public String getString() throws ValueException;

	/**
	 * Returns the actual value as a boolean
	 * 
	 * If the value cannot be represented as a boolean an exception will be
	 * thrown
	 * 
	 * @return
	 * @throws DDRException
	 */
	public boolean getBoolean() throws ValueException;

	/**
	 * 
	 * Returns the value as an integer in the default units of the property
	 * 
	 * An exception will be thrown if the value cannot be represented as an
	 * Integer
	 * 
	 * @return
	 * @throws DDRException
	 */
	public int getInteger() throws ValueException;

	/**
	 * 
	 * Returns the value as an enumeration
	 * 
	 * If the value cannot be represented as an enumeration an exception will be
	 * thrown
	 * 
	 * 
	 * @return
	 * @throws DDRException
	 */
	public String[] getEnumeration() throws ValueException;

	/**
	 * 
	 * Returns the value in the specified unit as a float
	 * 
	 * If the value cannot be represented as a float an exception will be thrown
	 * 
	 * 
	 * 
	 */
	public float getFloat() throws ValueException;

	/**
	 * @return
	 */
	public PropertyRef getPropertyRef();

	/**
	 * @return
	 */
	public boolean exists();
}

B.6 org.w3c.ddr.simple.Service

Java

package org.w3c.ddr.simple;

import java.util.Map;
import java.util.Properties;

import org.w3c.ddr.simple.exception.NameException;
import org.w3c.ddr.simple.exception.SystemException;

public interface Service {
	/**
	 * Called by {@link ServiceFactory} to initialize the API following
	 * construction
	 * 
	 * @param defaultVocabularyIRI
	 *            the IRI of the default vocabulary namespace
	 * @param props
	 *            Implementation dependent properties
	 * @throws SystemException
	 */
	public void initialize(String defaultVocabularyIRI, Properties props)
			throws SystemException;

	/**
	 * 
	 * @return A string indicating the revision level of the API
	 */
	public String getAPIVersion();

	/**
	 * 
	 * @return A String indicating the revision level of the data
	 */
	public String getDataVersion();

	/**
	 * List all the PropertyRefs the API knows about
	 * 
	 * @return
	 * @throws SystemException
	 */
	public PropertyRef[] listPropertyRefs() throws SystemException;

	public PropertyValue getPropertyValue(Evidence evidence,
			PropertyRef propertyRef) throws NameException, SystemException;

	public PropertyValue getPropertyValue(Evidence evidence,
			PropertyName propertyName) throws NameException, SystemException;

	public PropertyValue getPropertyValue(Evidence evidence,
			String localPropertyName) throws NameException, SystemException;

	public PropertyValues getPropertyValues(Evidence evidence)
			throws SystemException;

	public PropertyValues getPropertyValues(Evidence evidence,
			PropertyRef[] propertyRefs) throws NameException, SystemException;

	public PropertyValues getPropertyValues(Evidence evidence,
			String localAspectName) throws NameException, SystemException;

	public PropertyValues getPropertyValues(Evidence evidence,
			String localAspectName, String aspectIRI) throws NameException,
			SystemException;

	public PropertyName newPropertyName(String propertyName)
			throws NameException, SystemException;

	public PropertyName newPropertyName(PropertyRef propertyRef)
			throws NameException, SystemException;

	public PropertyRef newPropertyRef(String localPropertyName)
			throws NameException, SystemException;

	public PropertyRef newPropertyRef(PropertyName propertyName)
			throws NameException, SystemException;

	public PropertyRef newPropertyRef(PropertyName propertyName,
			String localAspectName) throws NameException, SystemException;

	/**
	 * Create a Evidence using the Map consisting of HTTP Header Names and
	 * Values
	 * 
	 * @param map
	 * @return
	 */
	public Evidence newHTTPEvidence();

	public Evidence newHTTPEvidence(Map map);

}

C WSDL Language Binding

This section is normative. It describes a WSDL [WSDL] language binding for DDR-API.

WSDL

tbd

D Binding rules for mapping APIs to any programming language

This section is normative

Editorial Note Rev 1f (Jo): I am not convinced this is needed.

E Normative References

WSDL
Web Services Description Language (WSDL) 1.1, W3C Note, Erik Christensen, Francisco Curbera, Greg Meredith, Sanjiva Weerawarana, 15 March 2001 (See http://www.w3.org/TR/wsdl)
RFC 2119
Key words for use in RFCs to Indicate Requirement Levels, S. Bradner, March 1997 (See http://www.ietf.org/rfc/rfc2119.txt)
IDL
OMG IDL Syntax and Semantics, Object Management Group. (See http://www.omg.org/technology/documents/formal/corba_2.htm)
Java
The Java Language Specification, Third Edition (See http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html)
XML Namespaces
Namespaces in XML, W3C Recommendation, Tim Bray, Dave Hollander, Andrew Layman (eds.), 14 January 1999 (See http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName)

F Informative Use Case: To Be defined (Non-Normative)

This section is informative. It provides an illustration of how the DDR-API could operate.

G Informative References (Non-Normative)

DIGLOSS
Glossary of Terms for Device Independence, W3C Working Draft, Rhys Lewis (ed.), 18 January 2005 (See http://www.w3.org/TR/2005/WD-di-gloss-20050118)
Core Vocabulary
Device Description Repository Core Vocabulary, W3C Working Draft, Andrea Trasatti, Jo Rabin, Rotan Hanrahan (eds.), 18 December 2007 (See http://www.w3.org/TR/ddr-core-vocabulary/)
Requirements
Device Description Repository Requirements 1.0, W3C Working Group Note, Kevin Smith (ed.), 17 December 2007 (See http://www.w3.org/TR/DDR-requirements/)

H Acknowledgements (Non-Normative)

The editors wish to acknowledge the contributions of members of the DDWG.

The editors wish to acknowledge the specific written contributions of: