Im not sure what you mean by allowing one to manipulate the wiki as a database.  Could you clarify that for me?
 
The problem with allowing direct PHP code to bde input would be security. One could easily execute malitous code. When I finish the extension, the code will basically be transformed into php code for execution.
 
Any other thoughts or suggestions?
 
Christopher Baker

 
On 11/20/06, Fernando Correia <fernandoacorreia@gmail.com> wrote:
I'm just beginning to use Semantic MediaWiki. I think it improves very much on MediaWiki.

One thing that it does is to allow us to manipulate the wiki as a database.

Based on this point of view, I think your proposal will enhance the product and allow the users to extract and manipulate information in a richer way.

Just a thought: have you considered allowing the user to express this logic in PHP, and have one or more PHP classes to easily work with the query? One more programming language in the world...

Congratulations for the good work!


2006/11/19, Christopher Baker <slithytove2@gmail.com>:
I realize the length of this email, but i would greatly appreciate it if anybody would add their input. anythnig would help, really.


I was thinking recently about creating an element similar to ask (intended to work with the current ask, not replace it) that was of a more code-like nature, allowing for more control over display. It would have functions such as add, sub, div, and mult (each operating on two numbers) and also a sum, which would add up all the integer values.

There would also be a "query" function, which would take several sets of parameters. (more on this later) and would return an object that was refered to via other functions (attribute, attributes, relation, and relations). Brief descriptions follow. ( Q refers to the object that query(...) returned, S refers to a string, F refers to a float, (...) is a list, L refers to a list, D refers to a dictionary. functions are called with paranthesis. every line ends with a ";". if you wish a semicolon in the code, you must escape it as in many other languages (ie: "\;"). comments are shown with "//" and continue till the next unescaped semicolon. note that the bold is for demonstrating only and will not be in the final result.)
(the "dictionary" refered to above is a python-esque dictionary. this means that there is a key (which is a string) which coresponds to a list (may be a list of strings or a list of floats, but must be all the same))

the values of a dictionary may be refered to via D[S]=L, where S is the name of the key.
queries are acceptable in place of dictionaries as parameters, but dictionaries are not acceptable as queries.
extra whitespace at the begining and ending of lines will be ignored.

D
=query((S),(S ),S); // the first list of strings is page names (using * for a wildcard). the last string (the one not in a list) is the sort. The second list is very similar to the current ask. the list might look somethnig like ("category:checkbook","date:=+","date:=*","amount:=*","who:=*","memo:=*","chnum:=+","chnum:=*");

D
=attribute(S,Q); // the given string is the name of an attribute (error if not extant in Q ). the keys of D are the names of pages and the lists are lists of the values of the attribute;
D=attributes( S,Q); // the given string is the name of a page (error if not extant in Q). the keys of D are the names of attributes and the lists are lists of the values of the coresponding attribute;
D=relation(S, Q); // the given string is the name of a relation (error if not extant in Q). the keys of D are the names of pages and the lists are lists of the values of the relation;
D=relations(S,Q); // the given string is the name of a page (error if not extant in Q). the keys of D are the names of relations and the lists are lists of the values of the coresponding relations;

F=add( F,F); // return the two added together;
F=sub(F,F); // return the first minus the second;
F=mult(F,F); // return the two multiplied together;
F=div( F,F); // return the first divided by the second;

F=sum( D); // adds up all the values. error if it entounters a string. the key is ignored. can be used on the output of attribute, attributes, or query.;

F=length( D); // returns the number of keys in the dictionary or query;

the following is an example: (note no boldface is used)

// begin example;
q=query(("+"),("category:checkbook","date:=+","date:=*","amount:=*","who:=*","memo:=*","chnum:=+","chnum:=*"),"chnum");
print(sum(attribute("amount",q)));
print("\n\n\n");
bal=0;
rowh(("No","Pay to the order of","Memo","Date","Amount","Balance")); // this will be explained later
foreach(q,title) // this will be explained later
{
    a=attributes(title,q);
    row((a["chnum"],a["who"],a["memo"],a["date"],a["amount"],bal)); // this will be explained later
    bal=add(bal,a["amount"]);
};
row(("","","","","",bal));
rowf(); // this will be explained later
// end example;

the following is an explaination of the new function, as well as a few more not used above (following the same conventions as above):

rowh((S)); // creates a header for a table like the current ask does. the strings are the title of the columns;
row((S or F)); // adds a row to the current table. the items will print in the same order as they appear;
rowf(); // ends the current table;

foreach(D,variable) {...}; // iterates through the query, assigning the variable (do not quote it) to the value of the key. also works with queries. the contents inside "{" and "}" are the same as elsewhere, except that they have another variable with which to work;

print(S or F); // prints the string or float;

table(Q); // print the query as the current ask would;



To anybody who got this far, or gave input: Thank you very much!

Christopher Baker

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Semediawiki-user mailing list
Semediawiki-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-user