MINDMAKERS Forum
Welcome, Guest. Please login or register.
September 09, 2010, 08:30:34 AM

Login with username, password and session length
Search:     Advanced search
NB: Spam bots are becoming smarter every day - we had to turn off regular registration. To become member, please send email to Kris Thorisson ([kris'_lastname] att ru dott is).
337 Posts in 99 Topics by 99 Members
Latest Member: peterwit
* Home Help Search Login Register
+  MINDMAKERS Forum
|-+  Projects
| |-+  SAIBA Multimodal Behavior Generation Framework
| | |-+  Behavior Markup Language
| | | |-+  XML Element Structure
« previous next »
Pages: [1] Print
Author Topic: XML Element Structure  (Read 1101 times)
amarshal
Jr. Member
**
Posts: 55


View Profile WWW Email
« on: September 09, 2008, 05:19:15 PM »

Returning to one of our unresolved issues from the Boston meeting, with a specific example:

Reposted from the semantics thread:
Code:
<bml>
  <behavior id="B1"/>
  <behavior id="B2" stroke="B1:stroke"/>
  <constraint>
    <synchronize ref="B1:stroke">
      <sync ref="B2:stroke"/>
    </synchronize>
  </constraint>
  <constraint>
    <dependency base="B1" dependant="B2"/>
  </constraint>
  <constraint>
    <dependency base="B2" dependant="B1"/>
  </constraint>
</bml>

I think this example highlights some of the inconsistent structure we've introduced.  Notice how the elements that actually describe the constraints require a parent <constraint> element according to the development draft, but the behavior elements have no equivalent.

I feel this additional depth leads to a lot of unnecessary verbosity.  As written, the constrain open and close tags take six lines, where their contents take only five.  Additionally, the implied nature of the <constraint> element can never have more than one child, making this verbosity a permanent structure.

At the same time, we've stated the constraint element is the location of the id attribute.  However, the behaviors so that need not be the case.

If we remove the <constraint> parent tag, we implicitly require some a priori knowledge of the <bml> child elements to determine whether they are behaviors with sync-point attributes or not.  This conflicts with encouraging the use of experimental behaviors through namespaced attributes.


One alternative is to use a parent <constraints> element that describe the type (currently behavior or constraint) of multiple child elements.  I could rewrite the above example as:
Code:
<bml>
  <behavior id="B1"/>
  <behavior id="B2" stroke="B1:stroke"/>
  <constraints>
    <synchronize ref="B1:stroke">
      <sync ref="B2:stroke"/>
    </synchronize>
    <dependency base="B1" dependant="B2"/>
    <dependency base="B2" dependant="B1"/>
  </constraints>
</bml>
In doing this, the constraint id attribute moves from the <constraint> element to the constraint description element.  In the above example, we save four lines.

However, we've maintained an inconsistency between behavior elements and constraint elements, in that there is no complimentary <behaviors> group.  Instead, we assume every tag in <bml> is a behavior, with a few exceptions (e.g., <constraints>, <required>).  Personally, I don't like this structural inconsistency.  I'd rather introduce a required <behaviors> at the fixed cost of two short lines.  It also makes BML more future proof with respect to new element types (e.g., shared references to world objects/places) by providing clear boundaries.

Example using <behaviors>:
Code:
<bml>
  <behaviors>
    <behavior id="B1"/>
    <behavior id="B2" stroke="B1:stroke"/>
  </behaviors>
  <constraints>
    <synchronize ref="B1:stroke">
      <sync ref="B2:stroke"/>
    </synchronize>
    <dependency base="B1" dependant="B2"/>
    <dependency base="B2" dependant="B1"/>
  </constraints>
</bml>

With respect to <required> tags, I don't see this explicitly conflicting with their structure, as a <required> group can contain both <behaviors> and <constraints>.  However, it remains structurally inconsistent in my opinion.  By delegating the required property to an attribute of the individual behavior and constraint description elements, top level group elements now serve the single purpose of identifying the general type of data represented by an element.

Thoughts?  Counterpoints?
Logged
herwin
Newbie
*
Posts: 39


View Profile Email
« Reply #1 on: September 10, 2008, 08:44:24 AM »

I like that. It would be even more elegant if the stroke="B1:stroke" was no longer allowed Tongue

For streaming of large <bml> blocks, we might want to allow multiple <behaviors> blocks and <constraints> blocks? That way, you can parse one <behaviors> and one <constraints> block and start playing while you parse and plan the rest of the <bml>? Unless we want BML to be executed in small chunks only, but then we need to go into the meaning of combining <bml> blocks some time soon.
« Last Edit: September 10, 2008, 08:49:37 AM by herwin » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!