Hi Flip, This is a very interesting problem you pose. I'm glad more people are getting involved in Semantic MediaWiki from a data- and numbers-oriented perspective, and this is probably the most mathematical application I've heard of yet for SMW.
Unfortunately, it will not be easy to implement your idea in SMW. Ideally, your data would be represented through n-ary relations, to indicate that a certain output has a year, a country, and an amount. N-ary relations are unfortunately not yet handled by SMW. Lest I bore everyone with another discussion, you can read probably more than you ever wanted to know about n-ary relations here (and at the corresponding Talk page): http://ontoworld.org/wiki/N-ary_relations However, what you're asking for is possible, using a hack. Lately I seem to only talk about two things on this list: n-ary relations, and my own site. So, as to not break with tradition, on my site, Discourse DB, there's a hack in place similar to what you could do. Discourse DB has "position" pages whose title is a combination of a topic and a position; see, for example: http://discoursedb.org/wiki/Fair_Minimum_Wage_Act_of_2007_/_Act_should_be_passed Within this page, through the "Position" template, there's code that uses string functions to isolate the "topic" and "position" parts of the title, and create a semantic relation to each one, so that all information connected to this page is also connected indirectly to the two components. In your case, instead of putting all the data in one table on one page, you could structure pages as country-year combinations, like, say, "China 1963". Each such page would have attributes that looked like "[[Megatons of rice produced:=76439]]", in addition to two relations that look like "[[Has country::China]]" and [[Has year::1963]]". The latter two would be automatically generated, through some string functions, from the title. For the mathematical questions, those look to be outside the scope of inline queries. Your best bet is to use SPARQL queries on the RDF data exported by your site (and to make sure your RDF data gets refreshed every so often, like once a day). Once again, Discourse DB has something similar, on the "analysis" page, which retrieves data using SPARQL, then does some crunching on it using Perl, to provide some analytical information: http://discoursedb.org/analysis.html So: not easy, somewhat awkward, but doable. -Yaron On 5/30/07, Flip Mozart <[EMAIL PROTECTED]> wrote: > Hi all! > > I'm building a wiki that contains a couple of data in table form. (See > example below.) While it is very convenient to create one page for one > table, I am somewhat at a loss how to add semantic annotations to this kind > of data. > > At the same time, I would like to add semantics to my wiki so that the > system can answer non-trivial user questions such as: > > 1) Which country in Asia had the highest (or lowest) rice production in the > year 1963? > > 2) What is the total rice production of China in the four year period from > 1963 to 1966? > > 3) In 1967, Cambodia's rice production comprise what percent or fraction of > the total rice production in the world? > > 4) Through 1961-1970, which countries experienced an increase (decrease) in > rice production? > > I'm sure people can think of more complicated queries than the ones I listed > above. Any ideas on how to annotate (or model) such wiki pages? > > Regards, > > Serge > > ---------------------------------- > > Table 1. Rough rice production (000 t), by country and geographical region, > 1961-2005. > > Year World Asia Bangla- Bhutan Cambodia China > desh > > 1961 215655 198778 14426 37 2383 56218 > 1962 226555 207411 13305 38 2039 65675 > 1963 247139 227561 15935 39 2622 76439 > 1964 263019 242167 15754 40 2760 85854 > 1965 254081 232173 15751 41 2500 90706 > 1966 261194 240229 14363 42 2376 98404 > 1967 277463 253587 16757 43 2457 96735 > 1968 288714 263979 17016 44 3251 97717 > 1969 295654 270809 18007 45 2503 97999 > 1970 316384 290101 16715 46 3814 113102 > > > Send instant messages to your online friends http://uk.messenger.yahoo.com > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Semediawiki-user mailing list > Semediawiki-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/semediawiki-user > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Semediawiki-user mailing list Semediawiki-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-user