Where to place mix components

Elements of a mix are defined in an XML tree hierarchy where mix elements should be placed the closest possible to other elements referencing them.

Place operations inside the mix

Place operations in a mix tag otherwise the sequencing graph is not generated.

Table 1. Where to place operations
Undesirable Idiomatic
<folder name="myFolder">
  <field name="myField"/>
  <service name="myService"/>
  <folder name="ClientOps">
    <notify name="myNotify"/>
  </folder>
  <folder name="BackendOps">
    <consume name="myConsume"/>
  </folder>
</mix>
<folder name="myFolder"> 
  <field name="myField"/> 
  <service name="myService"/>   
  <mix name="myMix">  
    <folder name="ClientOps">    
      <notify name="myNotify"/> 
    </folder>  
    <folder name="BackendOps">    
      <consume name="myConsume"/>  
    </folder> 
  </mix>
</folder>

Place ONLY operations in a mix

Place the mix in a folder and do not define fields and services inside the mix. A mix is not a root element of a SPARKL source document.

Table 2. Where to place the mix
Undesirable Idiomatic
<mix name="myMix">
  <field name="myField"/>
  <service name="myService"/>
  <folder name="ClientOps">
    <notify name="myNotify"/>
  </folder>
  <folder name="BackendOps">
    <consume name="myConsume"/>
  </folder>
</mix>
<folder name="myFolder"> 
  <field name="myField"/> 
  <service name="myService"/>   
  <mix name="myMix">  
    <folder name="ClientOps">    
      <notify name="myNotify"/> 
    </folder>  
    <folder name="BackendOps">    
      <consume name="myConsume"/>  
    </folder> 
  </mix>
</folder>

Place field and service definitions the closest possible to their use

Table 3. Where to place fields and servicesIn the left column field and service definitions are several folders above their actual use. They should be brought as close as possible to the operations that reference them.
Undesirable Idiomatic
<folder name="FolderA"> 
  <field name="myField"/> 
  <service name="myService"/> 
  <folder name="FolderB">   
    <folder name="FolderC">      
      <mix name="MixA">       
        <folder name="ClientOps">         
          <notify fields="myField"/>       
        </folder>       
        <folder name="BackendOps">         
          <consume service="myService"/>       
        </folder>     
      </mix>   
    </folder>   
    <folder name="FolderD">     
      <mix name="MixB">       
        <folder name="ClientOps">         
          <notify fields="myField"/>       
        </folder>       
        <folder name="BackendOps">         
          <consume service="myService"/>       
        </folder>     
      </mix>   
    </folder>    
  </folder> 
</folder>
<folder name="FolderA">
...
<folder name="FolderB"> 
  <field name="myField"/>   
  <service name="myService"/>   
  <folder name="FolderC">     
    <mix name="MixA">       
      <folder name="ClientOps">         
        <notify fields="myField"/>       
      </folder>       
      <folder name="BackendOps">         
        <consume service="myService"/>       
      </folder>     
    </mix>   
  </folder>   
  
  <folder name="FolderD">     
    <mix name="MixB">       
      <folder name="ClientOps">         
        <notify fields="myField"/>       
      </folder>       
      <folder name="BackendOps">         
        <consume service="myService"/>       
      </folder>     
    </mix>   
  </folder>  
</folder>
</folder>