-
Notifications
You must be signed in to change notification settings - Fork 11
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
Explain Pine's SBVR in docs/SBVR.md #329
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,355 @@ | |||
# SBVR in Pine.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this document to stand on its own, I think it helps to provide an introductory paragraph and a tiny working example of an SBVR model that readers can carry in their minds as they read through the document. It could start as follows:
*SBVR* stands for "Semantics of Business Vocabulary and Business Rules" and
provides a way to capture specifications in natural language and represent
them in formal logic, so they can be machine processed. This document describes
how Pine understands SBVR. You can use the [sbvr lab](http://www.sbvr.co/) as a
companion to this document. For the deep dive, check out the [SBVR spec](http://www.omg.org/spec/SBVR/).
Here is an example model expressed in SBVR:
<a minimal pilot model>
docs/SBVR.md
Outdated
Vocabulary: <vocabulary-name> | ||
``` | ||
|
||
Every new definition is part of the last declared vocabulary. If no vocabulary has been explicitly declared, a `Default` vocabulary is implicitly assumed. Within vocabularies, term declarations introduces _types_: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be expanded a bit here: in what sense is a term a type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the explanation I put:
Terms are types: they represent a collection of instances that obey an uniform "interface" defined through fact types and rules.
|
||
### Database Table Name | ||
|
||
The `Database Table Name` defines the name of the database table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What implication does this have? Can this attribute only be applied to Terms
?
docs/SBVR.md
Outdated
| `It is forbidden that` | It is obligatory that not | | ||
| `It is permitted that` | It is not obligatory that not | | ||
|
||
Currently Pine parses modalities but assumes they are all equivalent to necessities. It also assumes that rules that can be represented directly in SQL (schema, UNIQUE/NOT NULL/etc) are alethic, and everything else deontic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting, never fully understood how we differentiate between the two. Can we add an example of a deontic rule here? Also, we should explicitly mention the runtime cost that is associated with the two: as the first comes for "free" since they are enforced by the DB, but we have to explicitly check for other rules after an insert/update. What happens in practice if a deontic rule is violated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within SBVR, the difference is about what to expect: violations of alethic rules are not expected at all, while violations of deontic rules are not desired but possible. As far as the database is concerned, the difference is how you get an error: either the DB refuses to work (alethic, can't do anything about that unless you change the schema behind Pine's back) or a a validation check fails (deontic, user-driver check that can be ignored). I haven't gone down the code path dealing with validation checks though.
It's hard to talk about runtime costs and the alethic/deontic split in practice because it depends on the DB, the Pine version, and how you phrase your constraint. The basic gist seems to be that if Pine sees an opportunity to encode a constraint into the schema, it takes it. Everything else is put into validation checks.
But regardless, SBVR modalities are completely irrelevant in practice. You could scrap them without losing functionality (even impossible
is treated as necessary
), so I don't think it makes much sense to delve into that.
6c82d0e
to
b2d6285
Compare
b2d6285
to
7134439
Compare
- Explain SBVR as understood by Pine in more programmer-friendly terms - Map out how Pine interprets SBVR's structured english Change-type: patch Signed-off-by: Carol Schulze <[email protected]>
7134439
to
9313b1e
Compare
terms