w3c-cg / planning

Other
6 stars 0 forks source link

Operators and Action Generation #9

Open AdamSobieski opened 1 year ago

AdamSobieski commented 1 year ago

This issue is about the expressiveness for customizing operators’ action generating methods. It could be made possible for developers to be able to specify, for an operator, a scripting method with which to override action generation. That is, a special event on operators could be one for when actions are created by providing arguments to an operator.

Operator o = ...;
Action a = o.generate(world, p1, p2, ...);

With this expressiveness, markup might resemble:

<domain xmlns="..." xmlns:ext="..." version="0.1.5">
  <head>...</head>
  <body>
    <operators>
      <operator name="move" generate="move_custom_generate">
        <meta>...</meta>
        <parameters>
          <parameter name="from" />
          <parameter name="to" />
          <guard type="text/sparql+calculus">
            <![CDATA[
              PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
              PREFIX domain: <http://example.com/domain#>
              ASK
              {
                rdf:type(?from, domain:room).
                rdf:type(?to, domain:room).
                ?from != ?to.
              }
            ]]>
          </guard>
        </parameters>
        <preconditions type="text/sparql+calculus">…</preconditions>
        <effects type="text/sparul+calculus">…</effects>
        <script type="text/javascript">
          <![CDATA[
            function move_custom_generate(…)
            {
              /* something like */
              var a = global.createAction('move', ...);
              return a;
            }
          ]]>
        </script>
      </operator>
    </operators>
  </body>
</domain>

This capability and expressiveness could add complexity to representing solutions or output plans; solutions might need to be able to import reusable domain modules.

Any thoughts on these topics?