MaspImplementationDiscussion is intended for discussion of possible implementations for the ideas in MaspBrainstorming, or at least presenting a semi-concrete sample language. ---- '''Simple Data Example''' Suppose I want to implement storage of data about some books. Some of the attributes of a book will be single e.g. the title. Others will have the posibility to have more than one value e.g. author. In the terms of MaspBrainstorming the books can be stored in a map for books, with a key of some sort and an attribute of title. There can be another map for authors but there needs to be provision for multiple links from a book to its authors. In terms of CeePlusPlus (see TheCppStandardLibrary) the first could use '''std::map''' while the second could use '''std::multimap'''. I cannot see on MaspBrainstorming how such a case would be handled and it may be that you have not reached that level of detail. This is a request for clarification. -- JohnFletcher ''One issue I see is how relationships are specified in source code. If the "engine" is something like that described in DynamicRelational, then each row automatically gets a unique ID such that we don't have to ask for one. Some kind of key placeholder may be needed. Brainstorm pseudo-code:'' bookKey = row:books(title="How to Eat Fast", isbn=isbnVar, pubdate="2010-12-31"); authKey = row:author(first="Bob" last="Marley"); // add a new author row:bookauthors(bookref=bookKey, authref=authKey); authKey = row:author(first="Joe", last="Cruzer"); // add a new author (#2) row:bookauthors(bookref=bookKey, authref=authKey); ''"row:x" is like a function that adds a row to table x and returns its unique row address. Note that one could do this in some cases:'' row:bookauthors(bookref=row:books(title="How to Eat Fast", isbn=isbnVar, pubdate="2010-12-31"), authref=row:author(first="Bob", last="Marley")); --top I wouldn't want to be so heavily tied to the order of declaration. Maybe consider something like: declare b,bm,jc bookauth(book=b,auth=bm) bookauth(book=b,auth=jc) author(k=bm, fn="Bob", ln="Marley") author(k=jc, fn="Joe", ln="Cruzer") book (k=b, t="How to Eat Fast", isbn=isbnVar, pubdate="2010-12-31"} However, a lot more work is needed. How do we later extract information about the book, given "Eat Fast" and that it was published after 2006? Will the syntax for this fit nicely with the rest of the language? ''The above "declare" example is highly declarative. I'm curious, what would be the equivalent in Lisp, Masp's primary competitor? You seem to be leaning ProLog there.'' The above syntax is borrowed (roughly) from Oz. I'm not sure I understand your meaning by 'equivalent in Lisp'. One could create an equivalent syntax using Lisp's RealMacros and either a global number or gensym. Or you could use mutable cells and set! to hold a direct reference to the associated objects. You'll need to get Masp past conception before it will have competition. ''I meant it was trying to keep most of the other features and styles of Lisp, those that don't depend exclusively on EssExpressions. Lisp is still a sequential language, at least in its common usage. I'm not exploring non-sequentialness here. You are welcome to do such, but it's not something I feel like delving into deeply right now myself, and is perhaps orthogonal to the root-structure issue.'' ''As far as querying, a single table query could resemble:'' myResults = table:books(title="%Eat Fast%", pubdate > "1960-01-01") One would escape "%" if they were literal instead of wildcards. More complex operations can borrow from SmeQl (surprise surprise) -t. To persist our result: save:myResults(name="targetTable") If there is already a table of the same name, it will append it. Perhaps a "newOnly" attribute can be available to prevent accidental merging. If we want to meta-tize the verb, table name, and/or parameters, perhaps allow something like: $myVerb = "save" $myTableName = "myResults" $myParams = "author='Hemingway'" $myVerb:$myTableName($myParams) ---- '''Possible CeePlusPlus implementation''' I like to test ideas with an implementation and I was working about ten years ago with an implementation using MetaKit of something which I called '''Categories'''. Metakit provides for tables in a dynamic way. At that time there was also EfourGraph being developed. This sits on top of MetaKit and provides a linked structure of nodes on top of the tables, and also for the import and export of XML. Both the libraries come with interfaces to PythonLanguage, and Tcl. I have also interfaced examples to RubyLanguage using SWIG. I did that work before I was aware of RDF but can now see a mapping between my ideas and an ontology. I have been recently dusting off the codes and getting them working in the current environment. -- JohnFletcher ---- '''Current Interest in Application''' One current interest I have is a ReflectionToolForEngineers (see separate page) -- JohnFletcher