Re: [SMW-devel] {{#ask}}
Perfect - it works great for what I was planning to use it for! Now almost no barriers are there ;) Sergey On Nov 27, 2007 4:43 PM, Markus Krötzsch <[EMAIL PROTECTED]> wrote: > On Dienstag, 27. November 2007, Sergey Chernyshev wrote: > > WOW! Markus, this is great present for being back from vacation! ;) I'll > > test it on my instances as soon as I'll get some time with computer > > tomorrow. > > Great, hope you like it. Surprisingly, most of the work had to go into > modifying Special:Ask to allow linking to queries using internal links, > and > into supporting the new separation of printout requests and queries (which > also makes way for some more "presents"). I had to adopt the Special:ask > interface a little to account for this. I will drop another short note > about > recent changes and then be offline for a few days. I guess RC3 would be in > order after this. > > Markus > > > > > > Sergey > > > > On Nov 23, 2007 4:01 PM, Markus Krötzsch <[EMAIL PROTECTED]> > wrote: > > > And another note: {{#ask}} is in SVN (in a first version). > > > > > > Working example query: > > > > > > {{#ask: [[Category:Country]] [[borders::Nigeria]] | > > > ?population| > > > ?area#km² = ''Size''| > > > format=list| > > > limit = 3| > > > link=all| > > > intro=Test_| > > > }} > > > > > > Moreover, it is now of course possible to use templates and their > params > > > rather freely in {{#ask}}. Actually even some very unreasonable things > > > work, > > > but many cool things should also be possible. One real issue might be > > > that uninitiated users might nest {{#ask}} in order to emulate > > > -subqueries, even though the latter are much more efficient and > > > complete. Of course nesting sometimes is desirable: > > > > > > {{#ask: > > > [[Category:Country]] > > > [[population::>{{#ask:headers=hide|?Population|[[Uganda]]}} ]] | > > > sort=population| > > > ?population > > > }} > > > > > > This indeed works now. > > > > > > Here is what should hopefully work for #ask on SVN: > > > > > > * all printout formats other than "debug" (which still gives some > HTML), > > > * all known parameters (though some now are more flexible since you > can > > > use > > > wiki-markup as values), > > > * printout requests with the syntax "? property#unit = label", > > > * basic queries, nested queries, value ranges, wildcards, and yet > > > * should work as it did before (I hope). > > > > > > Here is what certainly does not work: > > > > > > * links to further results don't work in wikitext (we need another > > > URL-scheme > > > for that, but "external" links may be my first fix), > > > * printouts of Categories do not work via "? Category" yet, > > > * disjunctions in queries obviously do not work yet, since "|" is > already > > > taken in templates (Sergey suggested a solution that would require > > > queries to > > > be the last #ask-parameter, but we may even get around this by > providing > > > an > > > alternative syntax for "||"), > > > * a query with limit 0 might show a broken further results link, > > > * templated and embedded printers may pull annotations into the > article > > > where > > > the query is -- this needs some advanced fix as there is currently no > way > > > for > > > us to distinguish #ask-printed results from the text someone entered > > > directly. > > > > > > I guess there are more things, but at least most of the above should > be > > > fixed > > > soon. Feel free to try out the devel version (otherwise it's pretty > much > > > RC2, > > > no updates needed) and let me know what breaks/works/is still missing. > > > > > > Cheers, > > > > > > Markus > > > > > > -- > > > Markus Krötzsch > > > Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe > > > phone +49 (0)721 608 7362fax +49 (0)721 608 5998 > > > [EMAIL PROTECTED]www http://korrekt.org > > > > -- > Markus Krötzsch > Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe > phone +49 (0)721 608 7362fax +49 (0)721 608 5998 > [EMAIL PROTECTED]www http://korrekt.org > - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
[SMW-devel] Recent additions/towards 1.0RC3
Hi all, just to let all of you know what I do in my spare time, here is a summary of some significant feature additions that are now in SVN and that will soon appear as part of SMW1.0RC3 (so no-one later complains not to have known about the new features ;). Note this is not installed on ontoworld.org yet either, and other wikis (example below) also may have slightly older SVN copies only. * Inline queries now can be asked with a parser function #ask. The old continues to work, but #ask usually is just better and will be the suggested method in the future. For now, all documentation is this example query: {{#ask: [[Category:Country]] [[borders::Nigeria]] | ?population| ?area#km² = Size| format=list| limit = 3| link=all| intro=Testquery:_| }} The query is the stuff without "=" or leading "?", the lines with "?" are printout requests with the expected meaning, and the other lines are plain parameters. The advantage of this is that the above is fully compatible with MediaWiki templates and template parameters, a long-requested feature. Moreover, non-query parts now integrate fully with query results, e.g. you can write a table header in MediaWiki syntax, followed by a query that builds the table contents (using template output), followed by the MediaWiki table footer -- the result will be one properly formatted table. * You can now use "mainlabel=-" to hide the first (main) column in an inline query. This works for and #ask alike. * You can now use an "empty" printout request to reinsert the first column elsewhere. I.e. you would write something like "?=Maincolumn|" as a printout parameter. This is supported only for #ask. The last two combined allow you to do nice formatting tricks very easily. Have a closer look at the timeline on http://semantic-web-grundlagen.de/index.php/SWT1_WS07/08 (German, but anyway). The query used for that is {{#ask:[[Datum::+]] [[Serie::SWebT1 WS07/08]]| ?Titel| ?Kategorie=| ?Startzeit=| ?Dozent=| ?='''Info und Unterlagen'''| ?Unterlagen=| mainlabel=-| link=all| format=timeline| timelinebands=WEEK,MONTH| timelineposition=today| timelinesize=200px| limit=100 }} * Special:ask has changed, since printout statements are now no longer part of the query (old queries with inline-printouts still work but are discouraged). Also, clicking on "further results ..." now does not show the ugly query code right away. You can view and edit it, but you can also ignore it if you really are interested in the results only! * Semantic links to "pages" of the form "Media:..." now work better. You will get a direct link to the file on all pages (including all query results). Requires MediaWiki 1.11.0 or greater to work. Some more fixes will also come before RC3, and I guess RC4 will eventually be the last one before 1.0 (some features, service links and type Bool, are still missing). Cheers, Markus -- Markus Krötzsch Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362fax +49 (0)721 608 5998 [EMAIL PROTECTED]www http://korrekt.org signature.asc Description: This is a digitally signed message part. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] {{#ask}}
On Dienstag, 27. November 2007, Sergey Chernyshev wrote: > WOW! Markus, this is great present for being back from vacation! ;) I'll > test it on my instances as soon as I'll get some time with computer > tomorrow. Great, hope you like it. Surprisingly, most of the work had to go into modifying Special:Ask to allow linking to queries using internal links, and into supporting the new separation of printout requests and queries (which also makes way for some more "presents"). I had to adopt the Special:ask interface a little to account for this. I will drop another short note about recent changes and then be offline for a few days. I guess RC3 would be in order after this. Markus > > Sergey > > On Nov 23, 2007 4:01 PM, Markus Krötzsch <[EMAIL PROTECTED]> wrote: > > And another note: {{#ask}} is in SVN (in a first version). > > > > Working example query: > > > > {{#ask: [[Category:Country]] [[borders::Nigeria]] | > > ?population| > > ?area#km² = ''Size''| > > format=list| > > limit = 3| > > link=all| > > intro=Test_| > > }} > > > > Moreover, it is now of course possible to use templates and their params > > rather freely in {{#ask}}. Actually even some very unreasonable things > > work, > > but many cool things should also be possible. One real issue might be > > that uninitiated users might nest {{#ask}} in order to emulate > > -subqueries, even though the latter are much more efficient and > > complete. Of course nesting sometimes is desirable: > > > > {{#ask: > > [[Category:Country]] > > [[population::>{{#ask:headers=hide|?Population|[[Uganda]]}} ]] | > > sort=population| > > ?population > > }} > > > > This indeed works now. > > > > Here is what should hopefully work for #ask on SVN: > > > > * all printout formats other than "debug" (which still gives some HTML), > > * all known parameters (though some now are more flexible since you can > > use > > wiki-markup as values), > > * printout requests with the syntax "? property#unit = label", > > * basic queries, nested queries, value ranges, wildcards, and yet > > * should work as it did before (I hope). > > > > Here is what certainly does not work: > > > > * links to further results don't work in wikitext (we need another > > URL-scheme > > for that, but "external" links may be my first fix), > > * printouts of Categories do not work via "? Category" yet, > > * disjunctions in queries obviously do not work yet, since "|" is already > > taken in templates (Sergey suggested a solution that would require > > queries to > > be the last #ask-parameter, but we may even get around this by providing > > an > > alternative syntax for "||"), > > * a query with limit 0 might show a broken further results link, > > * templated and embedded printers may pull annotations into the article > > where > > the query is -- this needs some advanced fix as there is currently no way > > for > > us to distinguish #ask-printed results from the text someone entered > > directly. > > > > I guess there are more things, but at least most of the above should be > > fixed > > soon. Feel free to try out the devel version (otherwise it's pretty much > > RC2, > > no updates needed) and let me know what breaks/works/is still missing. > > > > Cheers, > > > > Markus > > > > -- > > Markus Krötzsch > > Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe > > phone +49 (0)721 608 7362fax +49 (0)721 608 5998 > > [EMAIL PROTECTED]www http://korrekt.org -- Markus Krötzsch Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362fax +49 (0)721 608 5998 [EMAIL PROTECTED]www http://korrekt.org signature.asc Description: This is a digitally signed message part. - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] A new SMW Special page: Redirected annotations
I gave some benchmark examples here: http://sourceforge.net/mailarchive/message.php? msg_name=A9698228-735A-4BEB-9CC7-CC76015BE4BE%40audrajohnson.com I ran them on my MacBook Pro with a 2Ghz Intel Core Duo and 2 GB of RAM. I also included the final SQL select the example search runs, comparing what the SQL is for redirects as equivalents and not including redirects. (It's possible that the 34 minutes would have been less if I hadn't gotten bored waiting and started browsing the internet waiting for it to finish.) The size of my wiki isn't very large--3642 entries in the page table, 174 in redirect, and smw_relations has 10777 rows--so I don't think it's an unwieldy data set. The size of the categories in the search were: 6 entries and no subcategories, 141 entries with 6 subcategories, 99 entries with 1 subcategory. --Audra On Nov 26, 2007, at 10:31 PM, Sergey Chernyshev wrote: > Audra, > > Can you describe the size of your wiki and amount of redirects? 34 > minutes seems to be a huge number. > Can you also give an example of SMW query that ran that long? > > Sergey > > > > On Nov 18, 2007 7:05 PM, Audra Johnson <[EMAIL PROTECTED]> wrote: > A few weeks ago, I discovered that searches with a few subqueries > were dreadfully slow and found the cause to be making annotated > redirects equivalent to their targets. I suggested making redirect > equivalency a SMW option--but when I went scanning for how to > implement it, I gleefully found that it was already included! The > setting is: > > $smwgQEqualitySupport = true; // Should #redirects be evaluated as > equality between page names? > > (It should probably include a note about efficiency for its comment, > just like the one for $smwgQDefaultNamespaces--taking out redirect > equality support can make a HUGE difference for more complex > queries. HUGE being the difference between a three subquery search > taking 34 minutes with redirect equivalency and .3 seconds without.) > > In any case, my semantic wiki has been happily humming and searching > along since I set $smwgQEqualitySupport to false.But I also need > a way to tell where annotations in the wiki are pointing to > redirected pages, so they can be fixed. > > So I've made a special page for redirected annotations that extends > SMWQueryPage. This will make it easy for people to find where > annotations are pointing to redirected pages and fix them to point at > the right ones. > > Messages that would are added for this page: > >// Messages for Redirected Annotations Special >'redirectedannotations' => 'Redirected annotations', >'smw_redirectedannotations_docu' => 'The object of these > annotations > points to a redirected page.', >'smw_redirectedannotations_template' => 'On page $1, the > annotation > $2::$3 redirects to $4.', > > It required one additional function to SMW_SQLStore in the "Special > page functions" section: > > function getRedirectedAnnotationsSpecial($requestoptions = NULL) { >wfProfileIn > ("SMWSQLStore::getRedirectedAnnotationsSpecial (SMW)"); >$db =& wfGetDB( DB_SLAVE ); >$options = ' ORDER BY subject_title'; > >if ($requestoptions->limit > 0) { >$options .= ' LIMIT ' . $requestoptions->limit; >} >if ($requestoptions->offset > 0) { >$options .= ' OFFSET ' . $requestoptions- > >offset; >} > >extract( $db->tableNames('smw_relations', > 'redirect') ); > >$res = $db->query("SELECT subject_title, > subject_namespace, > relation_title, object_title, object_namespace, rd_title, > rd_namespace FROM $smw_relations " >. "INNER JOIN $redirect ON > $smw_relations.object_id = > $redirect.rd_from" >. $options, > 'SMW::getRedirectedAnnotationsSpecial'); >$result = array(); > >while($row = $db->fetchObject($res)) { >$subject_page = Title::newFromText($row- > >subject_title, $row- > >subject_namespace); >$relation_page = Title::newFromText($row- > >relation_title, > SMW_NS_PROPERTY); >$object_page = Title::newFromText($row- > >object_title, $row- > >object_namespace); >$rd_page = Title::newFromText($row- > >rd_title, $row->rd_namespace); >$result[] = array($subject_page, > $relation_page, $object_page, > $rd_page); >} > >wfProfileOut > ("SMWSQLStore::getRedirectedAnnotationsSpecial (SMW)"); >return $result; >} > > And it needs to be added in the enableSemantics() function in > SMW_GlobalFunctions.php: > > $wgSpecialPages['RedirectedAnnotations'] = array > ('SMWSpecialPage','RedirectedAnnotations', > 'smwfDoSpecialRedirectedAnnotations', $smwgIP . '/spe