Device Description Repository 1b

Grouping

Editors' Draft 01 May 2008

This version:
http://www.w3.org/2005/MWI/DDWG/drafts/structures/080501
Latest version:
http://www.w3.org/2005/MWI/DDWG/drafts/structures/latest
Previous version:
http://www.w3.org/2005/MWI/DDWG/drafts/api/071031
Editor:
José Manuel Cantera Fonseca, Telefónica I+D

Abstract

Content adaptation in the Mobile Web can benefit from the definition of groups of devices that share common characteristics. This WG Note defines an XML format, a syntax for group definitions and an extension to the DDR Simple API that can be used in the development of applications that exploit device grouping.

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 Note

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-comments@w3.org. This list is archived at http://lists.w3.org/Archives/Public/public-ddwg-comments/.

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
2 Background to the need of Device Grouping
    2.1 Use Case 1 : Mobile Web content adaptation for a family of devices
    2.2 Use case 2 : Device family reuse in mobile web content adaptation
    2.3 Use case 3 : Formal definition of groups of devices
    2.4 Use Case 4 : Application development for a family of devices
    2.5 Use Case 5 : Common definition and sharing of device family for content provisioning
3 Device Grouping based on XML
    3.1 The deviceStructures element
    3.2 The vocabularies element
    3.3 The vocabulary element
        3.3.1 Attributes
    3.4 The groups element
    3.5 The group element
        3.5.1 Attributes
    3.6 The expression element
        3.6.1 Expression Syntax
4 Extended Simple API
    4.1 Initialization
    4.2 Query Methods
5 Example
    5.1 XML group definitions file
    5.2 Java Code

Appendices

A References
B Acknowledgements


1 Introduction

The mobile handset market is very innovative and dynamic, offering tons of devices made by different manufacturers. However, it is noteworthy that most of these devices share common characteristics, and, as a result, there is a tendency towards device grouping into families to capture sets of devices that share common characteristics, such as all the devices made by a manufacturer or all devices that offer similar functionalities. Device grouping is useful as it provides a level of abstraction (in an specific context) that avoids in thinking on specific models or particularities.

Device grouping is not only useful for abstraction purposes. There also different situations regarding adaptation of content in the mobile web where it is needed to group different kind of devices to create categories, families, hierarchies or clusters of devices. For example, "The customer wants to include an extra link in a page for those devices that belong to the Example Series 70" family. This kind of functionality is currently available in different content adaptation solutions in the commercial and open source space.

This W3C Note describes the situations where device grouping is useful and proposes an extension to the DDR Simple API for solving the problem of device grouping.

2 Background to the need of Device Grouping

2.1 Use Case 1 : Mobile Web content adaptation for a family of devices

John is a developer in charge of designing and deploying a new mobile web site. As a requirement the site must be accesible from a myriad of devices including mobile phones, smartphones and different kind of PDAs (Palm, Blackberry, Pocket PC). The customer is expecting a good experience in all the devices addressed, exploiting all device features at a maximum.

There are some requirements that has to do with the presentation of different information in tabular format. Initially John starts designing all the tables to have only two columns, restricting the amount of information of each entity to the two most important data fields. This design is suitable for the majority of mobile phones but when he tests on a PDA device, John realizes that two columns provide a very poor result on a PDA device. He realizes that space is wasted and decides to add an additional column that will be only displayed for those devices that are PDAs.

To overcome that issue, John creates a new device family called 'PDADevice' using a tool provided by a W3C-compliant device description solution. This family of devices will be characterized by a set conditions on the device capabilities, such as screen dimensions, supported markup code, available memory, etc. Once the device family is created and uploaded to the DDR, John uses the DDR API in his favourite programming language to generate the markup table accordingly to the established requirements.

2.2 Use case 2 : Device family reuse in mobile web content adaptation

Company A wants to develop a new mobile web application and would like to provide different layout and content to different groups of devices. As company A doesn't like reinventing the wheel, instead of creating a new device family, queries the DDR, and realizes that there is a device family that suits its needs as defined by company B who is working in the same space. Company A can consistently reuse that family of devices and references it in his own application.

2.3 Use case 3 : Formal definition of groups of devices

It is common to hear names such as "Smartphone", "Musicphone", "Featurephone", but does anyone know what they mean in detail? Is a Smartphone a device to make calls, synchronize your calendar and provide a fully featured address book? If so, what is the difference between a Smartphone and a PDA? When does a mobile phone "turn" into a Smartphone? When isn't it a Smartphone anymore and become a PDA?

All these definitions are very important to many individuals and companies. Providing a way to define clearly {*} and formally what they are will help comunication between different individuals and companies.

2.4 Use Case 4 : Application development for a family of devices

When developing an application, for J2ME, Symbian etc, it is often useful to create different builds for different devices or use different API's to exploit the device capabilities, namely 3D hardware acceleration, stereo speakers, bluetooth chips, GPS support and more. In order to do this, developers might have to create one build for each device on the market. Many devices actually share the same functionalities and support the same API's. Developing and testing on a device often means supporting a range of devices. Companies in this space will claim compatibility with device families instead of individual devices.

An specific instantiation of this use case, relevant to the Mobile Web, is a mobile web browser vendor who wants to express the fact that their browser works in a set of devices. For example, "our MiniBrowser is compatible with all Nokia Series 60 devices".

2.5 Use Case 5 : Common definition and sharing of device family for content provisioning

Company A is a developer of J2ME applications. Every month its QA team tests the new games against the devices they have in their lab. Devices used for testing are often considered master devices representing a number of other devices that will not be tested directly. Also, every month, the company lab buys new devices, old games are tested against these devices for compatibility. Company A states formally on which devices and device families their games work on.

Company B is a content aggregator. Every month receives from different software developers a number of new games. Company B also keeps updates of their device database so every month new devices are added. Every month Company A sends to Company B a list of the games and a list of the devices and group of devices (families) compatible with the games provided.

Company B needs to go back and check the list of devices and games every month for each of the games. The ability of using a common representation of device families between Company B and each of its affiliate games developers would ease the work on a daily basis and make sure that all the devices that are certified to work with a certain game are up-to-date. For example, if Company B has a brand new device in its database and that device belongs to a device family certified by Company A, Company B can automatically state that a certain game works in that new device.

3 Device Grouping based on XML

The device groups are defined in the XML format defined in the following sections. The XML infoset is described in XML Schema ... with each element in the http://www.w3.org/2008/05/structures namespace.

ElementAttributesMinimal Content Model
deviceStructuresNone(vocabularies)?, groups
vocabulariesNone(vocabulary)+
vocabularyiri, nsPrefixEMPTY
groupsNonegroup+
groupidexpression
expressionNonePCDATA (See syntax)

3.1 The deviceStructures element

It is the element that serves as root of the XML document

3.2 The vocabularies element

This element is the parent element for all the vocabulary declarations in the XML document.

3.3 The vocabulary element

The purpose of this element is the declaration of the vocabularies that will be used in the group definitions.

3.3.1 Attributes

iri

The IRI of the vocabulary referenced. This attribute is mandatory.

nsPrefix

The namespace prefix assigned to the vocabulary. It will be used to reference qualified Property and Aspect names in expressions. This attribute is mandatory and there cannot be two vocabularies with the same prefix. Note that a vocabulary can be assigned the empty string as "" prefix, indicating that it will be the vocabulary used when properties are not fully qualified in expressions.

3.4 The groups element

This element is the parent element for all the groups defined

3.5 The group element

This is the element used to define a group of devices

3.5.1 Attributes

id

The group's id. This attribute is mandatory. This is the identifier that will be used later by the programmer in the code to ckeck if a device belongs to such group.

3.6 The expression element

This element includes the boolean expression that defines a group.

3.6.1 Expression Syntax

Expression can be used to define the conditions under a device belongs to a group. boolean expressions that denote the conditions that a device must satisfy in order to belong to an specific group. The formal syntax for those expressions is (in simple Extended Backus-Naur Form (EBNF) notation):

Grammar for group expressions
[1]   GroupExpr   ::=    'not' GroupExpr
| '(' GroupExpr ')'
| GroupExpr 'or' GroupExpr
| GroupExpr 'and' GroupExpr
| RelationalExpr
[2]   RelationalExpr   ::=   PropertyDef '>' Number
| PropertyDef '>=' Number
| PropertyDef '<' Number
| PropertyDef '<=' Number
| PropertyDef '==' Number | Literal | Boolean
| PropertyDef '!=' Number | Literal | Boolean
| PropertyDef 'in' NumberEnum
| PropertyDef 'in' LiteralEnum
[3]   PropertyDef   ::=   '[' PropertyNameDef ']'
| '[' PropertyNameDef ',' AspectNameDef ']'
[4]   PropertyNameDef   ::=   NsPrefix':'LocalPropertyName
| LocalPropertyName
[5]   AspectNameDef   ::=   NsPrefix':'LocalAspectName
| LocalAspectName
[6]   LocalPropertyName   ::=   NCName
[7]   LocalAspectName   ::=   NCName
[8]   NsPrefix   ::=   NCName
[9]   NumberEnum   ::=   (' ( Number ( ',' Number )* )? ')'
[10]   LiteralEnum   ::=   '(' ( Literal ( ',' Literal )* )? ')'
[11]   Literal   ::=   '"' [^"]* '"'
| "'" [^']* "'"
[12]   Boolean   ::=   'true'
| 'false'
[13]   Number   ::=    Digits ('.' Digits?)?
| '.' Digits
[14]   Digits   ::=   [0-9]+

4 Extended Simple API

This note proposes two extensions to the DDR Simple API

4.1 Initialization

At initialization time the user of the API need to pass the XML file with the group definitions to be used. This can be used passing the XML file as an additional initialization property.

4.2 Query Methods

Returns true if a device belongs to a group

public boolean belongsTo(Evidence evidence,String group);

5 Example

5.1 XML group definitions file

					
<deviceStructures xmlns="http://www.w3.org/2008/05/structures">
	<vocabularies>
		<vocabulary iri="http://www.w3.org/2008/01/ddr-core-vocabulary" nsPrefix="" />
		<vocabulary iri="http://example.org/vocabulary" nsPrefix="ex"/>
	</vocabularies>
	
	<groups>	
		<group id="NiceDevice">
			<expression>
				([imageFormatSupport,webBrowser] in ('gif','jpeg') and [displayWidth] >= 240)
				or [ex:rendersTables,ex:webBrowser] == true and [inputDevices] in ('touchScreen'))
			</expression>
		</group>
			
		<group id="XhtmlDevice">
			<expression>
				[markupSupport] in ('xhtmlmp10','xhtmlbasic10')
			</expression>
		</group>		
	</groups>
</deviceStructures>
					
				

5.2 Java Code

Properties props = new Properties();
props.put("org.w3c.ddr.structures","file:///structuresExample.xml");
ServiceExt service = (ServiceExt)ServiceFactory.newService(
	"org.example.DDRServiceExt","http://www.w3.org/2008/01/ddr-core-vocabulary",props);

Evidence evidence = service.newHttpEvidence();
evidence.put("User-Agent","Example Browser 1.1 on Example Device");						
if(service.belongsTo(evidence,"XhtmlDevice")) {
	// Do Something
}
else {
		// Do other
}

A References

DDR-Simple-API
Device Description Repository Simple API, Jo Rabin, José Manuel Cantera Fonseca, Rotan Hanrahan, Ignacio Marín (eds.), W3C Working Draft, 4 April 2008 (See http://www.w3.org/TR/DDR-Simple-API)
DDWG
DDWG Home Page (See http://www.w3.org/2005/MWI/DDWG/)
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/)
Landscape
Device Description Landscape 1.0, W3C Working Group Note, Eman Nkeze, James Pearce, Matt Womer (eds.), 31 October 2007, (See http://www.w3.org/TR/2007/NOTE-dd-landscape-20071031/)
Ecosystem
Device Description Ecosystem 1.0, W3C Working Group Note, Rotan Hanrahan (ed.), 31 October 2007 (See http://www.w3.org/TR/2007/NOTE-dd-ecosystem-20071031/)
Delivery Context Ontology
Delivery Context Ontology, W3C Working Draft, Rhys Lewis, José Manuel Cantera Fonseca (eds.), 15 April 2008 (See http://www.w3.org/TR/dcontology/)
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 Second Edition, W3C Recommendation, Tim Bray, Dave Hollander, Andrew Layman Richard Tobin (eds.), 16 August 2006 (See http://www.w3.org/TR/2006/REC-xml-names-20060816/)

B Acknowledgements

The editor of the document acknowledge significant written contributions coming from: