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

Allow I in lefthand side of rule in ENFORCE statement #1520

Open
hanjoosten opened this issue Oct 27, 2024 · 5 comments
Open

Allow I in lefthand side of rule in ENFORCE statement #1520

hanjoosten opened this issue Oct 27, 2024 · 5 comments

Comments

@hanjoosten
Copy link
Member

See issue #1519.

The ENFORCE statement is syntax sugar for exec engine rules. When I is used in the left hand side of the equation, the generation of rules can be done based on the following examples (given by @stefjoosten):

De regel:


ENFORCE IDENTperson :  I[Person] :< personFirstName;personFirstName~ /\ personLastName;personLastName~ /\ personPhoneNumber;personPhoneNumber~ /\ personEmailaddress;personEmailaddress~

moet door de compiler vertaald worden in:


ROLE ExecEngine MAINTAINS IDENTperson

RULE IDENTperson : personFirstName;personFirstName~ /\ personLastName;personLastName~ /\ personPhoneNumber;personPhoneNumber~ /\ personEmailaddress;personEmailaddress~ |- I[Person]

VIOLATION (TXT "{EX} MrgAtoms;Person;", SRC I, TXT ";Person;", TGT I )

De regel:


ENFORCE OntdubbelGastgezinnen: IDENTperson :  I[Gastgezin] :< gezinslid;gezinslid~

vertalen we naar:


ROLE ExecEngine MAINTAINS "Ontdubbel Gastgezinnen"

   RULE OntdubbelGastgezinnen : gezinslid;gezinslid~ |- I[Gastgezin]

   VIOLATION (TXT "{EX} MrgAtoms;Gastgezin;",SRC I, TXT ";Gastgezin;", TGT I)

@hanjoosten
Copy link
Member Author

@stefjoosten , could you also give an example of the translation of the rule the other way round:

RULE r : I[A] >: someExpression

@hanjoosten
Copy link
Member Author

hanjoosten commented Nov 5, 2024

@stefjoosten mailed to me:

ENFORCE I[Persoon] >: term[Persoon]

Als term[Persoon] een deelverzameling is van I[Persoon], dan gebeurt er niets omdat er geen inconsistentie (overtreding) is.
Als (a,b) een element is van term[Persoon] en a is ongelijk aan b, dan willen we deze inconsistentie sowieso niet in I[Persoon] stoppen, want alleen gelijke atomen mogen in I[Persoon] zitten.
Als (a,a) een element is van term[Persoon] , dan zit (a,a) allang in I, dus is er ook geen inconsistentie.

Dus willen wij deze enforce regel niet implementeren.

@hanjoosten
Copy link
Member Author

I gave the comment of @stefjoosten some thought. I disagree with the statement

Als (a,a) een element is van term[Persoon] , dan zit (a,a) allang in I, dus is er ook geen inconsistentie.

This is a counter example:

ENFORCE I[Persoon] >: 'Sinterklaas'[Persoon]

If the database doesn't contain the Person Sinterklaas, there is an inconsistency.

@stefjoosten
Copy link
Contributor

Agreed. This is a good use case for I >:.

@hanjoosten
Copy link
Member Author

@stefjoosten , why close a valid issue that isn't implemented yet?

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

No branches or pull requests

2 participants