Forms scenario

From BiomedGT

Jump to: navigation, search

Templates in BiomedGT

Terminology content is provided to the Wiki via the "Common Terminology Templates (CTT)" mechanism. These templates have been designed to represent "atomic" units of information about a role, property, category or individual (which we will refer to collectively as entry) within the model. The Wiki itself is designed with the notion that every entry is represented by a wiki "article" (or page). Classes (or categories) are represented in the Category namespace, properties and roles in the Property namespace and individuals in the Main namespace (q: do we want to consider changing this?)

Statements about an entry can either take the form:

  • [[Category:Abc]]
    • If the "target entry" is in the Category namespace or Property (?double check this?), this asserts that the target entry is a rdfs:subClass of Category:Abc
    • If the "target entry" is in the Property namespace, this asserts that the target entry is an rdfs:instanceOf Category:Abc

or

  • [[property::Xyz]] (which is equivalent to [[property:=Xyz]]</nowiki>, a deprecated artifact of earlier Semantic MediaWiki implementations).
    • This either asserts that
      • The "target entry" has a DataProperty of "Xyz" -or-
      • The "target entry" has an ObjectProperty of "Xyz" within the same namespace as the target entry.

Instead of adding these statements directly, we have chosen to use Mediawiki templates as an intermediate mechanism. The assertion that "Category:Target" is a subClass of "Category:Abc" is accomplished by entering the following: {{LexWiki_Parent|Abc}} on the "Category:Target" article. Similarly, stating that "Category:Target" has a given definition is accomplished by entering: {{LexWiki_Definition|Target is a really great thing that...}} into the Category:Target article.

Using Semantic Forms to create Templates

The Semantic Forms extension is an add-on to the Semantic MediaWiki that builds new templates. As an example, the Template:LexWiki_Definition template adds a new definition to whatever page it occurs on. The definition that you see on Category:NCI_Diagnostic_or_Prognostic_Factor(C20047) is generated by {{LexWiki_Definition|1=Top level term which includes Biological Markers, Risk Factors, and Prognostic Factors.|source=NCI}}

Note: To see how an entry is represented in template format, go to Special:ExpandTemplates and enter 
      {{#tss:NCI|<concept code>|1}} into the "Input text:" field.  As an example, try 
      {{#tss:NCI|C20047|1}}.
Note: To see how an entry is actually rendered in the wiki itself, go to Special:ExpandTemplates and enter 
      {{#tss:NCI|<concept code>}} into the "Input text:" field.  As an example, try 
      {{#tss:NCI|C20047}}.

Semantic Forms enable forms-based creation of templates. If, for example, you wanted to add or modify a definition on a page, you could use the Form:Sandbox_Definition_Form - a form that only updates the definition on a given page. The page: Special:EditData/Sandbox_Definition_Form/Category:TEST_Sandbox(C62381) would take you to a form that allowed you to change the definition associated with Category:TEST_Sandbox(C62381)

We don't, however, want to make these sorts of changes directly to the wiki content itself. What we want to do, instead, is make a copy of the entry that we want to change and enter our change proposals there. This is what the "add proposal" button does on the right hand side of the screen. Note: This will only be visible if you have edit permissions on the wiki - you cannot add a proposal if you are not logged in. At the moment, clicking add proposal makes an image of the current page and creates a new entry in the Main namespace.

Note: We will probably want to create a different namespace to for proposals to prevent confusion with the root category

Currently Add Proposal button (a) Makes an image of the page (de-referencing the server call in the process) (b) Sets up an edit session for Draft_of_page name_by_user_at_timestamp (c) Invokes the form (if any), specified in the [[has default form::...]].


We use a couple of tricks to make this machinery work at the moment. You will note that the text for Category:TEST_Sandbox(C62381) includes several <noincludes>. If these noincludes were not present, anything that wasn't in a form would find itself in the free text box. We plan to change this to a "super hidden" form field that will allow us to just carry these items without having to result to noinclude tricks, which don't work if the page has secondary inclusions in any place.

You will also note that there is a [[Category:TEST_Sandbox(C62381)]] inside an includeonly box. This only appears when the page is included in another (in this case, the template) page, which allows the proposal to be assigned back to the original. This is something that needs fixing as well, as a change proposal is a meta-property, and is certainly not an instance of the category it is changing. We will probably end up injecting a line in the form that states that the proposal is an "proposal for" the original.

Extracting Form Information

Once the proposal page is saved, all sorts of interesting things can be done with it. If you return to the original page, you will note that, under the "D" articles, you will find a link to the draft change. The draft change itself is easily extracted via the Special:ExportRDF mechanism - Special:ExportRDF/Draft_of_TEST_Sandbox%28C62381%29_by_WikiSysop_at_20071004225530 In addition, the current settings that we are using in the SMW allow us to export all members of a particular category - Special:ExportRDF/Category:CurationStatus_New exports everything that is in the "new" status. If we decide to switch to a role vs. inheritance, the "backlinks=1" argument in dumpRDF should still give us what we need.

Warning:ExportRDF only publishes that what is inside of a SemanticMediaWiki tag. [[LexWiki_Definition:=A bar is a froo that has taken too many purple berries]] will generate RDF output. The text: "Definition: A froo is anything that is friendly and innumerable" will not appear in the RDF. The only way to retrieve this sort of information is through the Wiki Dump mechanism. You will note that there is a free text definition at the bottom of Category:TEST_Sandbox(C62381). You won't see this free text in the Special:ExportRDF/Category:TEST_Sandbox%28C62381%29 - you have to use Special:Export/Category:TEST_Sandbox%28C62381%29 instead. You will note that (a) there is some XML parsing that needs to occur (relatively easy) and (b) the Wiki text is in its raw, uninterpreted form.

Note: At the moment, the "Special:Export" above doesn't appear to be exporting the raw definition text. This is a software bug which needs correcting!!!

Personal tools