Wiki database
From Wikipedia, the free encyclopedia
This article may contain original research or unverified claims. Please improve the article by adding references. See the talk page for details. (September 2007) |
A wiki-based database is a collection of wiki files that can be accessed using SQL-like commands. The first (and, as of 2006, the only) such system was designed and developed by Reliable Software as part of their P2P version-control system, Code Co-op, which features a Peer-to-peer wiki system.
[edit] Database
The database is implemented as a collection of wiki files (records) stored inside namespaces, which play the role of tables. In a file-based P2P wiki, a namespace/table is implemented as a subdirectory of the main wiki directory.
The files (records) may contain any wiki markup, but in order to be accessible through SQL commands, they must define some tuples, or property-value pairs. This is done by embedding a wiki table inside a record. The first column of this wiki table defines the names of properties, the second specifies their values. For instance, a record in the Student table (namespace) may contain the following wiki table:
Name | Chad Codewell |
Courses | Programming, Anger Management |
which defines two properties, Name and Courses, and assigns values to them.
[edit] Queries
The properties defined inside records may be used to formulate SQL queries. For instance, the following query may be embedded in a wiki file (a query line starts with a question mark):
?SELECT Name FROM Student WHERE Courses CONTAINS "Anger Management" ORDER BY Name
When the wiki file is displayed, the SELECT statement is expanded into a wiki table that lists the results of the query. In the above example, the result might look like this:
ID | Name |
---|---|
Student:13 | Chad Codewell |
Student:18 | Lewis Black |
The ID column shows the name of the record (in a file-based system, this is the name of the file minus the extension .wiki). It also serves as a wiki link to the record. When the user clicks on it, the whole record is displayed like any other wiki file.
[edit] Forms
Wiki files may contain markup for displaying HTML forms. The target of a form (the action associated with the form) may be another wiki file. When the form is accepted, the target wiki file is displayed. The properties defined by the form can be accessed in the target file using the syntax [?propName]. In particular, the values from a form may be used in SQL queries in the target page.
A form may also be used to create new records. In that case, the target file would contain the INSERT command that creates a new record and fills its property table with specified values. For instance, continuing the above example, the target file may contain:
?INSERT INTO Student (Name = [?name], Courses = [?courses])
where the values of the properties are set by a form that activats this file.
|