Yaron Koren wrote: > > ... suggestion for how automatic-page-creation can be > > defined within form definitions (or wherever else you think it should > > happen)
I'll be back with more on this later, but for a start I think one must give some thought to the following: = Template approach = Given the need for a way to auto create n--n relations (pages which binds together two other pages with a page reference ("single link") for each) I think that one must have at least one ParserFunction which can be executed from a template rather than from the form itself. Thoughts that comes to mind are: 1. Relations (from auto created a new page referring to the main page) depends on titles. Can one assume that the title of the ("main") page is yet known before hitting the submit button? (consider titles being created with |the form option "page name=|/formula"/ for unique titles/)./ 2. If creating pages with a subform, what if the main page/form is cancelled instead of confirmed? Any other new auto pages referring back to the main form (which were canceled ) would then become "orphans" in regard of a has relation (Main<>----HasPage). Example: [Car]<>----wheels-*-[wheel] Optional approach: If pages are not created until the main form (of the car) is submitted then the wheels won't be created and left on their own if the main form is canceled. But there are cases where orphans wouldn't matter, so allowing inform creation could also be an option in the form definition: {{{createpagebytemplate|template|...|...|...|allow-inform-create}}} 3. If it's possible to deal with the (not yet) created auto-title of the main form (see ยง1), and if optionally allowing pagecreate from such a form, then that very title perhaps could be calculated "in advance" and stored in a variable available on the form, and when the button for create page with a subform is pressed, it can be passed on as a parameter to the create template? Example: [This Title]<-role1---[RelationClass]----role2->[Other Title] {{{createpagebytemplate|template|RelationClass|role1={{#var:this-title}}|role2=other title|allow-inform-create}}} 4. If the parameter newtitle= isn't passed on to the template it can concatenate the two role-titles into a a new title (this is as good a auto-title as any other, if that's desired, which it would, in many cases, I believe). 5. Ownership - While you're at it, add to the semantics of a SMW property to "own" it's values, that is, the value lives/exist as long as the Property owner (the page) lives/exist, and when the page referring to a value is deleted, then also the value is deleted (including "values" of Type:Page... :). This would complement the (auto) createpage-functionality perfectly since it would be possible to fully implement the semantics of the UML notation <.>---- (*filled* diamond) which means "owns". <>---- ("diamond") = Has. In UML terms a "has" relation is an "aggregation" but that alone doesn't imply ownership. <.>--- ("filled diamond") = Owns. The value lives and dies with the "owner" (owner is to the left of the diamond). Needs some SMW notation on the Property page: [[owns values::true]]. Default = false and thus can be omitted. SMW then also takes care of deleting "owned" pages. 6. Btw, when thinking about it, the number of parameters sent to the template can't be known in advance, perhaps it's best to have the following notation in the form instead: {{{createpagebytemplate|allow-inform-create}}} {{{template|RelationClass|role1={{#var:this-title}}|role2=other title|...|...N other properties to be set}}} {{{endcreatepage}}} OK, this was just to get the discussion started. You have the advanced experience with Forms so now you find the weak spots in the above. :) I'll be back with more insights as I'm implementing more of the Semantic Forms notation in my generator. Currently it already handles basic properties, with options, like |mandatory| etc, controlled from the UML model through deriving from multiplicity for links (multiplicity > 0 -> mandatory). Also manual notation for regular attributes can be defined in the doc-view, with the following valid notation: smw.mandatory=true, or sMw.MandatOry = 1; etc. In short, I'm learning SF as we go... :) Regards, // Rolf Lampa ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel