index.html 22.6 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Device Description Structures</title><style type="text/css">
code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

ol.enumar      { list-style-type: decimal; }
ol.enumla      { list-style-type: lower-alpha; }
ol.enumlr      { list-style-type: lower-roman; }
ol.enumua      { list-style-type: upper-alpha; }
ol.enumur      { list-style-type: upper-roman; }


div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}
</style><link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" /></head><body><div class="head">
<a href="http://www.w3.org/"><img height="48" width="72" alt="W3C" src="http://www.w3.org/Icons/w3c_home"/></a>
	
<h1><a name="title" id="title"></a>Device Description Structures</h1>
<h2><a name="subtitle" id="subtitle"></a>An expression language for the structured categorization of devices in content adaptation</h2>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft Note 05 December 2008</h2><dl><dt>This version:</dt><dd>
			<a href="http://www.w3.org/TR/2008/WD-dd-structures-20081205/">http://www.w3.org/TR/2008/WD-dd-structures-20081205/</a>
		</dd><dt>Latest version:</dt><dd>
			<a href="http://www.w3.org/TR/dd-structures/">http://www.w3.org/TR/dd-structures/</a>
		</dd><dt>Editor:</dt><dd>José Manuel Cantera Fonseca, Telefónica I+D</dd></dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2008 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p></div><hr /><div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2><p>
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. 
</p></div><div>
<h2><a name="status" id="status"></a>Status of this Document</h2>
				<em>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 <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/. </em>
			<p>Publication as a Working Draft does not imply endorsement by 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.</p>
			
			
			<p>This is a First Public Working Draft of a Working Group Note, published as part of the W3C <a href="http://www.w3.org/Mobile/">Mobile Web Initiative</a> (MWI) by the <a href="http://www.w3.org/2005/MWI/DDWG/">Device Description Working Group</a>. It is a deliverable as defined in the <a href="http://www.w3.org/2006/09/mwi-ddwg2-charter">Charter</a> of that group.</p><p>Please send comments to <a href="mailto:public-ddwg@w3.org">public-ddwg-comments@w3.org</a>. This list is archived at <a href="http://lists.w3.org/Archives/Public/public-ddwg">http://lists.w3.org/Archives/Public/public-ddwg-comments/</a>.</p>
			
<p> This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. The group does not expect this document to become a W3C Recommendation. W3C maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/37583/status#specs">public list of any patent disclosures</a> 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 <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
			


</div><div class="toc">
        <h2><a name="contents" id="contents"></a>Table of Contents</h2><p class="toc">1 <a href="#sec-introduction">Introduction</a><br />
2 <a href="#sec-definition">Device Grouping based on XML</a><br />
    2.1 <a href="#deviceStructures">The deviceStructures element</a><br />
    2.2 <a href="#vocabularies">The vocabularies element</a><br />
    2.3 <a href="#vocabulary">The vocabulary element</a><br />
        2.3.1 <a href="#vocabulary-attrs">Attributes</a><br />
    2.4 <a href="#groups">The groups element</a><br />
    2.5 <a href="#group">The group element</a><br />
        2.5.1 <a href="#group-attrs">Attributes</a><br />
    2.6 <a href="#expression">The expression element</a><br />
        2.6.1 <a href="#expression-syntax">Expression Syntax</a><br />
3 <a href="#sec-extended-api">Extended Simple API</a><br />
    3.1 <a href="#id30828">Initialization</a><br />
    3.2 <a href="#id30840">Query Methods</a><br />
4 <a href="#sec-example">Example</a><br />
    4.1 <a href="#sec-example-xml">XML group definitions file</a><br />
    4.2 <a href="#sec-example-hava">Java Code</a><br />
</p>
          <h3><a name="appendices" id="appendices"></a>Appendices</h3><p class="toc">A <a href="#sec-references">References</a><br />
B <a href="#acknowledgements">Acknowledgements</a><br />
</p></div><hr /><div class="body"><div class="div1">
<h2><a name="sec-introduction" id="sec-introduction"></a>1 Introduction</h2><p>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.
</p><p>
			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. </p><p>
			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. 
			</p><p>
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. 
	 </p><p class="ednote"><b>Editorial Note </b>: 
		This Working Draft includes a preliminary, early proposal which it is expected to be taken over and revised by a successor of the DDWG. </p></div><div class="div1">
<h2><a name="sec-definition" id="sec-definition"></a>2 Device Grouping based on XML</h2><p>
			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 <code>http://www.w3.org/2008/05/ddr-structures</code> namespace.
			</p>
				<table border="1"><tbody><tr><th>Element</th><th>Attributes</th><th>Minimal Content Model</th></tr><tr><td><a href="#deviceStructures">deviceStructures</a></td><td>None</td><td>(<a href="#vocabularies">vocabularies</a>)?,
							<a href="#groups">groups</a></td></tr><tr><td><a href="#vocabularies">vocabularies</a></td><td>None</td><td>(<a href="#vocabulary">vocabulary</a>)+</td></tr><tr><td><a href="#vocabulary">vocabulary</a></td><td><a href="#iri-attr">iri</a>,
							       <a href="#nsPrefix-attr">nsPrefix</a></td><td>EMPTY</td></tr><tr><td><a href="#groups">groups</a></td><td>None</td><td><a href="#group">group</a>+</td></tr><tr><td><a href="#group">group</a></td><td><a href="#id-attr">id</a></td><td><a href="#expression">expression</a></td></tr><tr><td><a href="#expression">expression</a></td><td>None</td><td>PCDATA (See <a href="#expression-syntax">syntax</a>)</td></tr></tbody></table>
<div class="div2">
<h3><a name="deviceStructures" id="deviceStructures"></a>2.1 The <code>deviceStructures</code> element</h3><p>It is the element that serves as root of the XML document</p></div><div class="div2">
<h3><a name="vocabularies" id="vocabularies"></a>2.2 The <code>vocabularies</code> element</h3><p>This element is the parent element for all the vocabulary declarations in the XML document.</p></div><div class="div2">
<h3><a name="vocabulary" id="vocabulary"></a>2.3 The <code>vocabulary</code> element</h3><p>The purpose of this element is the declaration of the vocabularies that will be used in the group definitions.</p><div class="div3">
<h4><a name="vocabulary-attrs" id="vocabulary-attrs"></a>2.3.1 Attributes</h4><dl><dt class="label"><a name="iri-attr" id="iri-attr"></a><code>iri</code></dt><dd><p>The IRI of the vocabulary referenced. This attribute is mandatory.</p></dd><dt class="label"><a name="nsPrefix-attr" id="nsPrefix-attr"></a><code>nsPrefix</code></dt><dd><p>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.</p></dd></dl></div></div><div class="div2">
<h3><a name="groups" id="groups"></a>2.4 The <code>groups</code> element</h3><p>This element is the parent element for all the groups defined</p></div><div class="div2">
<h3><a name="group" id="group"></a>2.5 The <code>group</code> element</h3><p>This is the element used to define a group of devices</p><div class="div3">
<h4><a name="group-attrs" id="group-attrs"></a>2.5.1 Attributes</h4><dl><dt class="label"><a name="id-attr" id="id-attr"></a><code>id</code></dt><dd><p>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. Group identifiers must be unique and are case sensitive.</p></dd></dl></div></div><div class="div2">
<h3><a name="expression" id="expression"></a>2.6 The <code>expression</code> element</h3><p>This element includes the boolean expression that defines a group. </p><div class="div3">
<h4><a name="expression-syntax" id="expression-syntax"></a>2.6.1 Expression Syntax</h4><p>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):</p>
<h5><a name="id30303" id="id30303"></a>Grammar for group expressions</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-GroupExpr" id="NT-GroupExpr"></a>[1]   </td><td><code>GroupExpr</code></td><td>   ::=   </td><td><code>
							'not' <a href="#NT-GroupExpr">GroupExpr</a>
						</code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| '(' <a href="#NT-GroupExpr">GroupExpr</a> ')' </code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-GroupExpr">GroupExpr</a> 'or' <a href="#NT-GroupExpr">GroupExpr</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-GroupExpr">GroupExpr</a> 'and' <a href="#NT-GroupExpr">GroupExpr</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-RelationalExpr">RelationalExpr</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-RelationalExpr" id="NT-RelationalExpr"></a>[2]   </td><td><code>RelationalExpr</code></td><td>   ::=   </td><td><code><a href="#NT-PropertyDef">PropertyDef</a>   '&gt;'  <a href="#NT-Number">Number</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  '&gt;='  <a href="#NT-Number">Number</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  '&lt;'  <a href="#NT-Number">Number</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  '&lt;='  <a href="#NT-Number">Number</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  '=='  
							<a href="#NT-Number">Number</a> | 
							<a href="#NT-Literal">Literal</a> | 
							<a href="#NT-Boolean">Boolean</a>
						</code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  '!='  
							<a href="#NT-Number">Number</a> |
							<a href="#NT-Literal">Literal</a> | 
							<a href="#NT-Boolean">Boolean</a>
						</code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  'contains'  <a href="#NT-NumberEnum">NumberEnum</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-PropertyDef">PropertyDef</a>  'contains'  <a href="#NT-LiteralEnum">LiteralEnum</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PropertyDef" id="NT-PropertyDef"></a>[3]   </td><td><code>PropertyDef</code></td><td>   ::=   </td><td><code>'[' <a href="#NT-PropertyNameDef">PropertyNameDef</a> ']' </code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| '[' <a href="#NT-PropertyNameDef">PropertyNameDef</a> ',' <a href="#NT-AspectNameDef">AspectNameDef</a> ']'</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PropertyNameDef" id="NT-PropertyNameDef"></a>[4]   </td><td><code>PropertyNameDef</code></td><td>   ::=   </td><td><code><a href="#NT-NsPrefix">NsPrefix</a>':'<a href="#NT-LocalPropertyName">LocalPropertyName</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-LocalPropertyName">LocalPropertyName</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-AspectNameDef" id="NT-AspectNameDef"></a>[5]   </td><td><code>AspectNameDef</code></td><td>   ::=   </td><td><code><a href="#NT-NsPrefix">NsPrefix</a>':'<a href="#NT-LocalAspectName">LocalAspectName</a></code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| <a href="#NT-LocalAspectName">LocalAspectName</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-LocalPropertyName" id="NT-LocalPropertyName"></a>[6]   </td><td><code>LocalPropertyName</code></td><td>   ::=   </td><td><code><a href="//www.w3.org/TR/2006/REC-xml-names-20060816/#NT-NCName">NCName</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-LocalAspectName" id="NT-LocalAspectName"></a>[7]   </td><td><code>LocalAspectName</code></td><td>   ::=   </td><td><code><a href="http://www.w3.org/TR/2006/REC-xml-names-20060816/#NT-NCName">NCName</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-NsPrefix" id="NT-NsPrefix"></a>[8]   </td><td><code>NsPrefix</code></td><td>   ::=   </td><td><code><a href="http://www.w3.org/TR/2006/REC-xml-names-20060816/#NT-NCName">NCName</a></code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-NumberEnum" id="NT-NumberEnum"></a>[9]   </td><td><code>NumberEnum</code></td><td>   ::=   </td><td><code>(' ( <a href="#NT-Number">Number</a> ( ',' <a href="#NT-Number">Number</a> )* )? ')'</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-LiteralEnum" id="NT-LiteralEnum"></a>[10]   </td><td><code>LiteralEnum</code></td><td>   ::=   </td><td><code>'(' ( <a href="#NT-Literal">Literal</a> ( ',' <a href="#NT-Literal">Literal</a> )* )? ')'</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Literal" id="NT-Literal"></a>[11]   </td><td><code>Literal</code></td><td>   ::=   </td><td><code>'"' [^"]* '"'</code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| "'" [^']* "'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Boolean" id="NT-Boolean"></a>[12]   </td><td><code>Boolean</code></td><td>   ::=   </td><td><code>'true'</code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>| 'false'</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Number" id="NT-Number"></a>[13]   </td><td><code>Number</code></td><td>   ::=   </td><td><code>
							<a href="#NT-Digits">Digits</a> ('.' <a href="#NT-Digits">Digits</a>?)? </code></td></tr><tr valign="baseline"><td></td><td></td><td></td><td><code> | '.' <a href="#NT-Digits">Digits</a>
						</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Digits" id="NT-Digits"></a>[14]   </td><td><code>Digits</code></td><td>   ::=   </td><td><code>[0-9]+</code></td></tr></tbody></table><p>The semantics of the boolean operators used are the same as those present in programming languages like Java.
				The <code>contains</code> clause returns <code>true</code> if the corresponding enumerated property value includes at least the set of elements between brackets.</p></div></div></div><div class="div1">
<h2><a name="sec-extended-api" id="sec-extended-api"></a>3 Extended Simple API</h2><p>This note proposes two extensions to the DDR Simple API</p><div class="div2">
<h3><a name="id30828" id="id30828"></a>3.1 Initialization</h3><p>At initialization time the user of the API need to pass one or more XML files with the group definitions to be used.</p></div><div class="div2">
<h3><a name="id30840" id="id30840"></a>3.2 Query Methods</h3>
				<div class="exampleInner Java"><pre class="Java">public boolean belongsTo(Evidence evidence,String group);</pre></div>
<p>Returns <code>true</code> if a device belongs to a group</p></div></div><div class="div1">
<h2><a name="sec-example" id="sec-example"></a>4 Example</h2><div class="div2">
<h3><a name="sec-example-xml" id="sec-example-xml"></a>4.1 XML group definitions file</h3><div class="exampleOuter"><div class="exampleInner "><pre>
					
&lt;deviceStructures xmlns="http://www.w3.org/2008/05/ddr-structures"&gt;
	&lt;vocabularies&gt;
		&lt;vocabulary iri="http://www.w3.org/2008/01/DDR-Core-Vocabulary" nsPrefix="" /&gt;
		&lt;vocabulary iri="http://example.org/vocabulary" nsPrefix="ex"/&gt;
	&lt;/vocabularies&gt;
	
	&lt;groups&gt;	
		&lt;group id="NiceDevice"&gt;
			&lt;expression&gt;
				([imageFormatSupport,webBrowser] contains ('gif','jpeg') and [displayWidth] &gt;= 240)
				or [ex:rendersTables,ex:webBrowser] == true and [inputDevices] contains ('touchScreen'))
			&lt;/expression&gt;
		&lt;/group&gt;
			
		&lt;group id="XhtmlDevice"&gt;
			&lt;expression&gt;
				[markupSupport] contains ('xhtmlmp10','xhtmlbasic10')
			&lt;/expression&gt;
		&lt;/group&gt;		
	&lt;/groups&gt;
&lt;/deviceStructures&gt;
					
				</pre></div></div></div><div class="div2">
<h3><a name="sec-example-hava" id="sec-example-hava"></a>4.2 Java Code</h3><div class="exampleOuter"><div class="exampleInner java"><pre class="java">
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
}
</pre></div></div></div></div></div><div class="back"><div class="div1">
<h2><a name="sec-references" id="sec-references"></a>A References</h2><dl><dt class="label"><a name="DDR-Simple-API" id="DDR-Simple-API"></a>DDR-Simple-API</dt><dd> Device
					Description Repository Simple API, Jo Rabin, José Manuel Cantera Fonseca, Rotan Hanrahan, Ignacio Marín (eds.), W3C Working Draft, 4 April 2008   (See <a href="http://www.w3.org/TR/DDR-Simple-API">http://www.w3.org/TR/DDR-Simple-API</a>)</dd><dt class="label"><a name="ref-Java" id="ref-Java"></a>Java</dt><dd>The Java Language Specification, Third Edition  (See <a href="http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html">http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html</a>)</dd></dl></div><div class="div1">
<h2><a name="acknowledgements" id="acknowledgements"></a>B Acknowledgements</h2><p>The editor of the document acknowledge significant written contributions coming from:</p><ul><li>Andrea Trasatti, mTLD dotMobi</li></ul></div></div></body></html>