Re: [EMOXG] Challenge: plug in different categories etc. into EmotionML

Hi all,

on the issue of "subclassing", of being able to plug in a different set 
of emotion categories etc., I have done a bit of research to complement 
the existing contributions, and I want to suggest a possible solution 
with XML.

The core idea in this approach is to use a "substitutionGroup", a 
concept from XML Schema that allows us to use several XML elements in 
the same locations in the overall structure.

Attached is a set of files that illustrate the idea with a concrete, 
minimal example for John and his subway emotions.

1. base.xsd and base-example.xml

These are Schema and example document for the "base" language. For 
clarity, I have only defined the minimal structure needed: an <emotion> 
containing a set of dimensions and a category. I have chosen a 
relatively explicit structure:

<emotion>
   <dimensions>
     <FontaineDimensions>
       <activation>0.7</activation>
       <unpredictability>medium</unpredictability>
     </FontaineDimensions>
   </dimensions>
   <category>
     <BigSixCategory>surprise</BigSixCategory>
   </category>
</emotion>

The main thing to notice here is that we use element names which make it 
explicit which vocabulary is used: <FontaineDimensions> and 
<BigSixCategory>.

This corresponds to John's use case (1), below.

2. subway.xsd, subway-example.xml, and subway-example2.xml

The domain-specific Schema, subway.xsd, includes the base schema, and 
defines additional vocabulary by defining elements in the relevant 
*substitutionGroup*: <SubwayDimensions> belongs to "dimensionGroup", 
<SubwayCategory> belongs to "categoryGroup", which means they can now be 
used everywhere where <FontaineDimensions> and <BigSixCategory> can be 
used. Note that as it is currently defined, the new vocabulary can be 
used alongside the old one, as in subway-example.xml:

<emotion>
   <dimensions>
     <FontaineDimensions>
       <activation>0.7</activation>
       <unpredictability>medium</unpredictability>
     </FontaineDimensions>
   </dimensions>
   <category>
     <SubwayCategory>stressed</SubwayCategory>
   </category>
</emotion>

This combination of SubwayCategory and FontaineDimensions corresponds to 
John's use case (2).

It is also possible to use only the new sets (John's use case (3), 
subway-example2.xml):

<emotion>
   <dimensions>
     <SubwayDimensions>
       <socially-open>0.7</socially-open>
       <degree-of-time-pressure>high</degree-of-time-pressure>
     </SubwayDimensions>
   </dimensions>
   <category>
     <SubwayCategory>stressed</SubwayCategory>
   </category>
</emotion>


The examples validate properly with Xerces-J [1], as follows:

java -cp xercesSamples.jar:xercesImpl.jar dom.Counter -v -s base-example.xml

[1] http://xerces.apache.org/xerces2-j/


What I like about this approach is that it is a lightweight method of 
complementing the existing format with a custom vocabulary, in the same 
namespace, and that the structure is explicit about the vocabulary used.

Best regards,
Marc

PS: As a side note, it is also possible to use "inline schema", as in 
subway-example-inline.xml, where the document itself contains the 
extension of the vocabulary. This can be validated with Xerces-J as follows:

java -cp xercesSamples.jar:xercesImpl.jar jaxp.InlineSchemaValidator -nm 
xsd http://www.w3.org/2001/XMLSchema emo 
http://www.w3.org/2005/Incubator/emotion -a //xsd:schema -i 
//emo:emotion -f -hs subway-example-inline.xml



Marc Schroeder schrieb:
> 
> As agreed during last phone conference (ACTION-12), I try to describe 
> what I see as an important challenge towards the definition of an 
> emotion markup language. I'll be very curious to see to what extent the 
> solutions that are possible in XML, RDF and OWL differ.
> 
> Best,
> Marc
> 
> "Custom descriptor challenge"
> -----------------------------
> 
> Let us assume that John is a user of our future Emotion Markup Language. 
> John wants to annotate some content (photos of faces taken in real-life 
> situations, say in a subway) with emotion-related information.
> 
> 1) Initially, John wants to use two types of coarse descriptors:
>     a) Emotion categories following Ekman's earlier work, i.e. the "big 
> six" categories: anger, fear, sadness, surprise, disgust, joy
>     b) Emotion dimensions following Fontaine et al.: evaluation, 
> potency, activation, unpredictability.
> 
> Let us assume that we as EmotionML specifiers have provided several 
> "default" sets of categories and dimensions centrally, so all John 
> should have to do in his document at stage (1) is to refer to these 
> centrally defined sets from his document.
> 
> 
> 2) After working with the data for a while, John feels the "big six" 
> categories don't quite fit his needs.
> a) instead of the "big six", he wants to define, and use, a custom set 
> of "subway emotions": stressed, scared, in-a-hurry, relaxed, friendly
> 
> b) he feels the dimensions are OK, so he still wants to refer to the 
> centrally-defined dimensions
> 
> 
> 3) After refining his analyses further, John wants to replace also the 
> dimensions with a custom set:
> 
> a) categories: custom "subway emotions"
> b) custom dimensions: socially-open, degree-of-time-pressure
> 
> 
> In each case, it should be possible for John to indicate clearly where 
> he is taking his labels from, so that it is possible to verify that his 
> documents are valid with respect to the specification.
> Ideally, it should not be necessary to define new "dialects" of the 
> language as we had done with EARL [1], but it would be sufficient to 
> refer to a set of categories or dimensions, which *instantiate* or 
> *subclass* a generic concept of "EmotionML category set" or "EmotionML 
> dimension set".
> 
> [1] http://emotion-research.net/earl/schemadesign#SchemaDialects
> 
> 

-- 
Dr. Marc Schröder, Senior Researcher at DFKI GmbH
Coordinator EU FP7 Project SEMAINE http://www.semaine-project.eu
Chair W3C Emotion ML Incubator http://www.w3.org/2005/Incubator/emotion
Portal Editor http://emotion-research.net
Team Leader DFKI Speech Group http://mary.dfki.de
Project Leader DFG project PAVOQUE http://mary.dfki.de/pavoque

Homepage: http://www.dfki.de/~schroed
Email: schroed@dfki.de
Phone: +49-681-302-5303
Postal address: DFKI GmbH, Campus D3_2, Stuhlsatzenhausweg 3, D-66123 
Saarbrücken, Germany
--
Official DFKI coordinates:
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Trippstadter Strasse 122, D-67663 Kaiserslautern, Germany
Geschaeftsfuehrung:
Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.w3.org/2005/Incubator/emotion"
	targetNamespace="http://www.w3.org/2005/Incubator/emotion"
	elementFormDefault="qualified" attributeFormDefault="unqualified">

  <xsd:element name="emotion">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="dimensions" minOccurs="0" maxOccurs="1">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element ref="dimensionGroup"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="category" minOccurs="0" maxOccurs="1">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element ref="categoryGroup"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="dimensionGroup" abstract="true"/>
  <xsd:element name="categoryGroup" abstract="true"/>



  <xsd:element name="FontaineDimensions" substitutionGroup="dimensionGroup">
    <xsd:complexType>
      <xsd:choice maxOccurs="unbounded">
        <xsd:element name="evaluation"       type="xsd:string" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="potency"          type="xsd:string" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="activation"       type="xsd:string" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="unpredictability" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      </xsd:choice>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="BigSixCategory" substitutionGroup="categoryGroup">
    <xsd:simpleType>
      <xsd:restriction base="xsd:NMTOKEN">
	    <xsd:enumeration value="anger"/>
	    <xsd:enumeration value="joy"/>
	    <xsd:enumeration value="sadness"/>
	    <xsd:enumeration value="surprise"/>
	    <xsd:enumeration value="fear"/>
	    <xsd:enumeration value="disgust"/>
	  </xsd:restriction>
    </xsd:simpleType>
  </xsd:element>
  
</xsd:schema>
<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns="http://www.w3.org/2005/Incubator/emotion"
	targetNamespace="http://www.w3.org/2005/Incubator/emotion"
	elementFormDefault="qualified" attributeFormDefault="unqualified">

  <xsd:include schemaLocation="base.xsd"/>
  
    <xsd:element name="SubwayDimensions" substitutionGroup="dimensionGroup">
    <xsd:complexType>
      <xsd:choice maxOccurs="unbounded">
        <xsd:element name="socially-open"           type="xsd:string" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="degree-of-time-pressure" type="xsd:string" minOccurs="0" maxOccurs="1"/>
      </xsd:choice>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="SubwayCategory" substitutionGroup="categoryGroup">
    <xsd:simpleType>
      <xsd:restriction base="xsd:NMTOKEN">
	    <xsd:enumeration value="stressed"/>
	    <xsd:enumeration value="scared"/>
	    <xsd:enumeration value="in-a-hurry"/>
	    <xsd:enumeration value="relaxed"/>
	    <xsd:enumeration value="friendly"/>
	  </xsd:restriction>
    </xsd:simpleType>
  </xsd:element>

</xsd:schema>

Received on Thursday, 29 May 2008 12:35:44 UTC