Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend scope of _NEW in ExecEngine from NewStruct to complete violation statement #675

Closed
RieksJ opened this issue Jul 4, 2017 · 1 comment

Comments

@RieksJ
Copy link
Contributor

RieksJ commented Jul 4, 2017

In order to create functionality for creating a new atom-object in a new interface (for which #674 has requested navigation functionality), it is quite helpful if the scope of use of the keyword _NEW, which currently can only be used within the ExecEngine function NewStruct, is extended to the entire violation statement.

While this new functionality will render the function 'NewStruct' obsolete (as shown below), we should keep it for now for backward compatibility.

An example of what currently does not, but should be made to work, is:

createCtrlReq :: Objective * Objective [PROP]
MEANING "The objective has requested that a new Objective be created that serves as one of its controls"

ROLE ExecEngine MAINTAINS "Create control objective"
RULE "Create control objective": createCtrlReq /\ objOwner;objOwner~ |- I-createCtrlReq
VIOLATION (TXT "{EX} InsAtom;Objective" -- Create new Objective (i.e. the control)
          ,TXT "{EX} InsPair;isCtrlOfObj;Objective;_NEW;Objective;", SRC I
-- Providing default values for TOT-relations is necessary to ensure that the transaction will be committed:
          ,TXT "{EX} InsPair;objOwner;Objective;_NEW;BusinessFunction;", SRC objOwner
          ,TXT "{EX} InsPair;objID;Objective;_NEW;ObjID;required"
          ,TXT "{EX} InsPair;objDescr;Objective;_NEW;ObjDescr;required"
-- Upon a commit, we should invoke INTERFACE "NewlyCreatedControl" with the newly created atom:
          ,TXT "{EX} SetNavToOnCommit;/NewlyCreatedControl/_NEW"
-- We have serviced the request, so we can turn it off:
          ,TXT "{EX} DelPair;createCtrlReq;Objective;", SRC I, TXT ";Objective;", TGT I
          )
@RieksJ RieksJ self-assigned this Jul 4, 2017
RieksJ added a commit that referenced this issue Jul 4, 2017
@RieksJ
Copy link
Contributor Author

RieksJ commented Jul 4, 2017

The request has been implemented in feature/navigate. Here are some notes:

  • Below, by an {EX}-statement we mean any function that is defined in InsDelPair.php. Whether or not other functions recognize the _NEW token depends on their implementation.
  • As expected, the {EX}-statements will be executed in the order in which they are provided.
  • When the first {EX}-statement starts to execute, _NEW has no atom set.
  • When an {EX}-statement uses _NEW while no atom has been set, a dirty error is generated.
  • Both NewStruct and InsAtom will create an atom and set a corresponding value for _NEW.
  • When an {EX}-statement uses _NEW while an atom has been set (by the most recent execution of NewStruct or InsAtom), that atom will replace the occurrance of _NEW

The provided example has been seen to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants