===== Null literal
null
-----
null
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Null"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
/>

===== Property access
model -> $model.get(`T:others`)
-----
model -> $model.get(`T:others`)
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Define"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  name="model"
>
  <method name="get">
    <args>
      <type name="others"
        module="T"
      />
    </args>
    <var name="model"/>
  </method>
</config>

===== Boolean expressions
$isIgnored or $a == $b and $c == "foobar" || $x == 42 && !(true==false)
-----
$isIgnored or $a == $b and $c == "foobar" or $x == 42.0 and !(true == false)
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Or"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
>
  <var name="isIgnored"/>
  <and>
    <eq>
      <var name="a"/>
      <var name="b"/>
    </eq>
    <eq>
      <var name="c"/>
      <string value="foobar"/>
    </eq>
  </and>
  <and>
    <eq>
      <var name="x"/>
      <number value="42.0"/>
    </eq>
    <not>
      <eq>
        <true/>
        <false/>
      </eq>
    </not>
  </and>
</config>

===== Model literals
all(`my.module:MyType`)
  .filter(x -> $x.get(`T:other`).get(`TLObject:tType`).get(`TLType:module`)==`other.module`)
  .filter(y -> $y.get(`T:ref`) == `my.module:OtherType#part`)
-----
all(`my.module:MyType`).filter(x -> $x.get(`T:other`).get(`TLObject:tType`).get(`TLType:module`) == `other.module`).filter(y -> $y.get(`T:ref`) == `my.module:OtherType#part`)
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Method"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  name="filter"
>
  <args>
    <define name="y">
      <eq>
        <method name="get">
          <args>
            <type name="ref"
              module="T"
            />
          </args>
          <var name="y"/>
        </method>
        <part name="part"
          module="my.module"
          type="OtherType"
        />
      </eq>
    </define>
  </args>
  <method name="filter">
    <args>
      <define name="x">
        <eq>
          <method name="get">
            <args>
              <type name="module"
                module="TLType"
              />
            </args>
            <method name="get">
              <args>
                <type name="tType"
                  module="TLObject"
                />
              </args>
              <method name="get">
                <args>
                  <type name="other"
                    module="T"
                  />
                </args>
                <var name="x"/>
              </method>
            </method>
          </method>
          <module name="other.module"/>
        </eq>
      </define>
    </args>
    <staticMethod name="all">
      <args>
        <type name="MyType"
          module="my.module"
        />
      </args>
    </staticMethod>
  </method>
</config>

===== TLEnumeration literal
`my.package:my.type#my.constant`
-----
`my.package:my.type#my.constant`
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$PartLiteral"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  module="my.package"
  name="my.constant"
  type="my.type"
/>

===== Complex Scenario
model ->
  all(`tl.graph.demo:A`)
    .filter(y ->
      $y.get(`T:owner`).contains($model) and
      $y.get(`T:ref`).instanceOf(`tl.graph.demo:C`)
    )
    .map(z -> $z.get(`T:other`))
-----
model -> all(`tl.graph.demo:A`).filter(y -> $y.get(`T:owner`).contains($model) and $y.get(`T:ref`).instanceOf(`tl.graph.demo:C`)).map(z -> $z.get(`T:other`))
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Define"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  name="model"
>
  <method name="map">
    <args>
      <define name="z">
        <method name="get">
          <args>
            <type name="other"
              module="T"
            />
          </args>
          <var name="z"/>
        </method>
      </define>
    </args>
    <method name="filter">
      <args>
        <define name="y">
          <and>
            <method name="contains">
              <args>
                <var name="model"/>
              </args>
              <method name="get">
                <args>
                  <type name="owner"
                    module="T"
                  />
                </args>
                <var name="y"/>
              </method>
            </method>
            <method name="instanceOf">
              <args>
                <type name="C"
                  module="tl.graph.demo"
                />
              </args>
              <method name="get">
                <args>
                  <type name="ref"
                    module="T"
                  />
                </args>
                <var name="y"/>
              </method>
            </method>
          </and>
        </define>
      </args>
      <staticMethod name="all">
        <args>
          <type name="A"
            module="tl.graph.demo"
          />
        </args>
      </staticMethod>
    </method>
  </method>
</config>

===== String quoting
concat("Some \"String\" with \\", 'Some \"String\"', 'Some "String"', 'Some \'String\'')
-----
concat("Some \"String\" with \\", "Some \"String\"", "Some \"String\"", "Some 'String'")
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$StaticMethod"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  name="concat"
>
  <args>
    <string value="Some &quot;String&quot; with \"/>
    <string value="Some &quot;String&quot;"/>
    <string value="Some &quot;String&quot;"/>
    <string value="Some 'String'"/>
  </args>
</config>

===== Blocks with side-effects
all(`my.module:A`)
	.filter(x -> $x.instanceOf(`my.module:B`))
	.foreach(y -> 
		(foovalue -> 
			{
				$y.set(`my.module:B#foo`, $y.get(`my.module:B#bar`));
				$y.set(`my.module:B#bar`, $foovalue);
			}
		).apply($y.get(`my.module:B#foo`)))
-----
all(`my.module:A`).filter(x -> $x.instanceOf(`my.module:B`)).foreach(y -> (foovalue -> {$y.set(`my.module:B#foo`, $y.get(`my.module:B#bar`)); $y.set(`my.module:B#bar`, $foovalue); }).apply($y.get(`my.module:B#foo`)))
-----
<config config:interface="com.top_logic.model.search.expr.config.dom.Expr$Method"
  xmlns:config="http://www.top-logic.com/ns/config/6.0"
  name="foreach"
>
  <args>
    <define name="y">
      <method name="apply">
        <args>
          <method name="get">
            <args>
              <part name="foo"
                module="my.module"
                type="B"
              />
            </args>
            <var name="y"/>
          </method>
        </args>
        <define name="foovalue">
          <block>
            <method name="set">
              <args>
                <part name="foo"
                  module="my.module"
                  type="B"
                />
                <method name="get">
                  <args>
                    <part name="bar"
                      module="my.module"
                      type="B"
                    />
                  </args>
                  <var name="y"/>
                </method>
              </args>
              <var name="y"/>
            </method>
            <method name="set">
              <args>
                <part name="bar"
                  module="my.module"
                  type="B"
                />
                <var name="foovalue"/>
              </args>
              <var name="y"/>
            </method>
          </block>
        </define>
      </method>
    </define>
  </args>
  <method name="filter">
    <args>
      <define name="x">
        <method name="instanceOf">
          <args>
            <type name="B"
              module="my.module"
            />
          </args>
          <var name="x"/>
        </method>
      </define>
    </args>
    <staticMethod name="all">
      <args>
        <type name="A"
          module="my.module"
        />
      </args>
    </staticMethod>
  </method>
</config>