Difference between revisions of "Talk:WikiDB"

From TestWiki
Jump to: navigation, search
(Fetch and use elements of a table)
(Fetch and use elements of a table: @Ivo)
Line 45: Line 45:
  
 
Ivo Almeida
 
Ivo Almeida
 +
 +
: Hi Ivo - the first example you give is ''exactly'' how I plan the repeat tag to work!  I have not coded it yet, but basically the contents of the repeat tag will be repeated for each row, with variable substitution working the same way as for templates (I may even harness the template code to do this, if that is possible...).  If you want to [[Special:Emailuser/HappyDog|send me]] your e-mail address I will let you know when this change is in place.  Alternatively, just check back here from time to time.  Thanks for your interest.  --[[User:HappyDog|HappyDog]] 17:20, 20 September 2006 (BST)

Revision as of 17:20, 20 September 2006

This extension is really cool. Do you have any plans concerning external (read-only) queries to the database? --Martin 23:51, 10 July 2006 (BST)

Can you please expand on this - I'm not sure what you mean. --HappyDog 23:55, 10 July 2006 (BST)
Sure. Suppose I have wiki site which is primarily a user-editable database. Each wiki page may provide several database records (let's say information on sequences of proteins of a given family). There is some text which gives some information about the link between these database entries, that's the traditional wiki part. This cannot be put into the database because it's changing often, it may become large, and it doesn't have a meaningful format--the only field name which would be appropriate would be "comments". But the database records are essential for let's say the community of molecular biologists, who use client software to query and analyze the protein from the database. There may be wikis which want to use the database records as illustration, or maybe group the database records differently and comment on them. The idea is to not duplicate the database, but use feeds which would be updated and propagated from the source. My point of view comes from what I did for inserting bibliographic records (PMIDs from Medline and ISBNs from isbndb.org), in wikis: see Biblio extension. Someone also pointed out the Wikicite project. I don't know where these folks are going exactly, but the idea is to build a database of bibliographic references. Have a look. --Martin 00:19, 11 July 2006 (BST)
I haven't really given this any thought yet, and I will take a look at the links shortly, but on the surface what you say sounds quite plausible. How I would implement this is to use a new action argument, e.g. $action=rawdata (or an existing action if a suitable one exists - raw?). So if you entered e.g. http://some.domain.org/w/index.php?title=Table:Companies&action=rawdata, you would get the data (and schema?) from the Companies table in a standard format, probably XML. Does this sound like it would do the trick? (Bear in mind that if the table definition is altered, the XML output will change) --HappyDog 00:58, 11 July 2006 (BST)
I was thinking of something like an SQL SELECT statement. More specifically, the only features that I think would be useful would be:
  • download the whole database for local use as you just mentioned.
  • select one or several records by giving one column name and passing a list of strings. All records for which one of those strings matches is selected.
I don't know if you can do this simply using MediaWiki. Basically the URL I would pass would be like http://some.domain.org/w/index.php?title=Table:Companies&action=rawdata&select_id=12,34,567 where id is a column name and 12, 34 and 567 are acceptable id values. Maybe it is easier to just write an independent PHP script which queries the database according to the CGI arguments which are found. --Martin 01:40, 11 July 2006 (BST)
I think that level of detail is outside the scope of v1, however you're right, it would be fairly trivial to write a PHP script to parse and manipulate the raw data dump, particularly if it is in a standard format such as XML (or, it just occurs to me, SQL - I'm sure that would be possible, and then you could simply import it straight into a traditional database... hmmm... interesting thought!) --HappyDog 02:45, 11 July 2006 (BST)

Fetch and use elements of a table

Hi!

As you know, I expect this extension for a long time. Beside his earlier stage, it is a very important step, if we think to use MediaWiki seriously, in my point of view.

Well, my question is about fetch elements in the DB and use them in a infobox or elsewhere in a page. I think the <repeat> tag may be used for that, but I think this tag automatically shows a table with the data fetched.

What I need to do is something like:

 This are the companies at the DB:
 <repeat table="Companies3" criteria="Name!=Microsoft" sort="Logo desc">
   {{name}} is founded at {{founded}} and have a revenue of {{revenue}}
 </repeat>

which produces the next output:

Intel is founded at USA and have a revenue of #N/A     
Apple is founded at April 2005 and have a revenue of $7.42

Maybe we can even use the <repeat> tag with a additional template option, as in

<repeat table="Companies3" criteria="Name!=Microsoft" sort="Logo desc" template="Infobox company">
</repeat>


Best regards and again, thanks for your effort

Ivo Almeida

Hi Ivo - the first example you give is exactly how I plan the repeat tag to work! I have not coded it yet, but basically the contents of the repeat tag will be repeated for each row, with variable substitution working the same way as for templates (I may even harness the template code to do this, if that is possible...). If you want to send me your e-mail address I will let you know when this change is in place. Alternatively, just check back here from time to time. Thanks for your interest. --HappyDog 17:20, 20 September 2006 (BST)