Device Description Repository 1c

Exploiting Groups of Devices for Content Adaptation

Editors' Draft 16 June 2008

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

Abstract

Content Adaptation on the Mobile Web can be simplified by creating groups for those devices that share common characteristics. This WG Note defines an XML format, a group definition syntax and an extension to the DDR Simple API that can be used in the development of adaptive Mobile Web sites that exploit 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 Device Grouping based on XML
    2.1 The deviceStructures element
    2.2 The vocabularies element
    2.3 The vocabulary element
        2.3.1 Attributes
    2.4 The groups element
    2.5 The group element
        2.5.1 Attributes
    2.6 The expression element
        2.6.1 Expression Syntax
3 Extended Simple API
    3.1 Initialization
    3.2 Query Methods
4 Example
    4.1 XML group definitions file
    4.2 Java Code

Appendices

A References
B Acknowledgements


1 Introduction

The mobile handset market is innovative and dynamic but at the same time fragmented. The result is that there are thousands of different devices made by multiple manufacturers. Nonetheless the majority of handsets share common characteristics and can be grouped into families. For example, all the devices made by a manufacturer or all the devices that provide certain functionalities. Device Grouping is useful as it provides a higher level of abstraction (in an specific context), avoiding to work with specific device instances or models.

Device Grouping is also a valuable tool for content adaptation on the Mobile Web. One significative example could be the dynamic generation of a web page that includes a game download menu. The version of each game to be offered to the user could depend on the manufacturer and memory restrictions imposed by the target device, among others. This particular application would benefit from the existence of a grouping mechanism. The developer could define different groups of devices specifying certain conditions to be met by the 'vendor' and 'availableMemory' property values.

Our problem could also have been solved by means of 'if' statements in any programming language (using the DDR Simple API). However such approach is unflexible as a change in the Group conditions would also imply a change in the application logic. Furthermore, "harcoded" Groups defined using programming language statements do not promote knowledge reuse between companies and organizations.

In order to promote a more flexible approach for Device Grouping, this W3C Note proposes an XML format, a syntax for group expressions (based on boolean conditions over the DDR properties) and an extension to the DDR Simple API.

2 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)

2.1 The deviceStructures element

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

2.2 The vocabularies element

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

2.3 The vocabulary element

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

2.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.

2.4 The groups element

This element is the parent element for all the groups defined

2.5 The group element

This is the element used to define a group of devices

2.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.

2.6 The expression element

This element includes the boolean expression that defines a group.

2.6.1 Expression Syntax

Boolean expressions can be used to denote the conditions that a device and its aspects 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 'contains' NumberEnum
| PropertyDef 'contains' 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]+

The semantics of the boolean operators used are the same as those present in programming languages like Java. The 'contains' clause returns true if the corresponding enumerated property value includes at least the set of elements between brackets.

3 Extended Simple API

This note proposes two extensions to the DDR Simple API

3.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.

3.2 Query Methods

public boolean belongsTo(Evidence evidence,String group);

Returns true if a device belongs to a group

4 Example

4.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] contains ('gif','jpeg') and [displayWidth] >= 240)
				or [ex:rendersTables,ex:webBrowser] == true and [inputDevices] contains ('touchScreen'))
			</expression>
		</group>
			
		<group id="XhtmlDevice">
			<expression>
				[markupSupport] contains ('xhtmlmp10','xhtmlbasic10')
			</expression>
		</group>		
	</groups>
</deviceStructures>
					
				

4.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: