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

Cmacc data model - #18

Open
HazardJ opened this issue Jul 27, 2016 · 1 comment
Open

Cmacc data model - #18

HazardJ opened this issue Jul 27, 2016 · 1 comment

Comments

@HazardJ
Copy link
Member

HazardJ commented Jul 27, 2016

Breaking this out from the discussion of IPFS:

What is the core Cmacc data model. This is an active discussion now because @wilmveel has done great work on a somewhat different model. - Here is my best abstraction:

Cmacc can be described as three levels of expansion (2 currently implemented, 1 speculative):

  1. {variablename} in a value (k/v), expanded by matching "variablename" with a key name in a dictionary.
  2. [filename] in a dictionary, expanded by matching the name of another dictionary, from a default list of dictionaries.
  3. [[folder]] in the dictionary (or an included dictionary), expanded by matching another list of dictionaries.
    All this can be understood as files in folders. It can also be done in any other format, including databases. It may be helpful to consider files in folders as the canonical form of dictionary since they are i) widely used and understood, even by casual users, ii) the format of git and software collaboration.

.3. is currently not implemented, the sole dictionary is /Doc/ (though with the [?http://...] convention one can include another dictionary ad hoc.)

.2. [file] has an "include as" notion - if the key is not blank, then the keys in the linked dictionary will be treated as prefixed by the key. ( 1.=[Z/ol/4] ). The {variables} in values in the linked dictionary will also be i) treated as prefixed, ii) if no match is found, treated by removing the prefix. Where there is recursive prefixing, the right-most prefix is removed first. (This deprefixing works exactly in Primavera's implementation. It is a consequence of her use of objects, not as a result of my specification. That is a very satisfying confirmation of the logic of the model.)

Additional features:
A. [[folder]] in the dictionary (or an included dictionary), expanded by matching another list of dictionaries. (See above.) Has the same notion of override and prefixing, so:
=[[lookHereFirst]]
=[[LookHereSecond]]
Buyer/=[[PrefixWithBuyer/AndDeprefixInternalLinksWhenNotFound]]

B. "Magic folders". A special file that can be put in a folder and acts like a .zip file - i.e. it expresses a sub-tree of the folder. But calculated instead of being a bunch of actual files. Useful for such things as the thousands of section widgets - http://www.commonaccord.org/i.php?v=l&f=G/Z/. The magic folder should generate and return a file if there is no actual file there. If an actual file exists, then that file overrides the magic folder. (Same override paradigm. Failure to find a file causes the system to look up the folder tree, recursively, looking for a file with a particular name, e.g. "MagicFolder.cmazip".) Some uses will seem very text-oriented, for instance specifying the exact selection of exceptions to confidentiality. (Here is the use case to be solved: http://www.commonaccord.org/i.php?v=s&f=G/Agt-NDA-CmA/Sec/Relate/Conf/Except/Item/0.md.) But this will also allow some uses that approach "algorithmic" law. A complex structure can be programmed as a string that pretends to be a file name. A bridge between "codification" and "code-ification."

C. Generally, integration with graph queries. The current model can be understood as a specific form of graph query. In a graph, with node A as root, starting at node B, using key C, expand and return this as "document" or "print" view, or tell me all the possibilities for matching key "D". Etc. For (ersatz) edges and data, see the "JSON-ish" view, e.g. http://www.commonaccord.org/i.php?v=j&f=G/ABA-MSPA-SPA-CmA/Form/SPA/0.md.

@HazardJ
Copy link
Member Author

HazardJ commented Mar 27, 2022

Current implementations of some or all of the paradigm are:

  1. The canonical perl by Primavera - https://github.com/CommonAccord/Cmacc-Org/blob/master/vendor/cmacc-app/parser.pl
  2. A version in Python that uses data in JSON (and an on-the-fly converter from flat files) by students at BrownU. Very light testing showed complete conformance, though I understand that it is not lazy in seeking out dictionaries - https://github.com/adonalsium/common_accord/blob/dev/README.md
  3. A tiny start by students at Northwestern - also Python - https://github.com/CommonAccord/NW-NDA/blob/main/99/WiP/Schedule/String.py

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

1 participant