On Tuesday 07 November 2006 09:31, tamara.matevc wrote: > ==How to sort by second name== > http://ontoworld.org/wiki/Help_talk:Inline_queries > > Hello, I am quite new in this beautiful field od semantic wiki. Does > anybody know how to sort by second name, not by first name? In our wiki we > are writing like <nowiki>[[Category:Artist|Second name, name]]</nowiki> and > when I am writing an inline queries, I would like to have it also in this > way. > > So insted of: > > <ask>[[Category:Actor]][[born in::*]]</ask> > > I would like to get this: > > ;Andy Anderson > ;Matthijs van de Sande Bakhuyzen > ;Jim Bakkum > ;Benny Benson > ;Amanda Bynes > ;Nicolas Cage > ;Charly Checker > ;Sacha Baron Cohen > ;Melody Klaver > ;Gregory Peck > ;Channing Tatum > > Or should I ask this somewhere else?
No, that's the right list, I think. SMW supports ordering by any (naturarily orderable) property, not just by the article title. What you need to do, however, is to annotate each article with some property by which it should be ordered. In your case, this means that the last name of each actor should be specified on its article page. For example: = Article on "Attribute:last name" = The attribute '''last name''' is a [[has type::Type:String|string]] that gives the last name of a person ... = Article on "Andy Anderson" = '''Andy [[last name:=Anderson]]''' is an actor who ... = Article where you want your listing = The following is a list of all actors, ordered alphabetically: <ask sort="last name"> [[Category:Actor]] [[last name:=+]] [[born in::*]] </ask> Note that [[last name:=+]] filters articles that have last name defined. If something has no last name, it will not appear. Indeed, you can only sort by properties which each of your results is guaranteed to have. This has performance reasons. However, the attribute "last name" is not displayed (there is no *-term for it), so it does not clutter your output with redundant info. It should be clear that the above can be used to have any kinds of sort keys with articles, even if the sort keys are not data that one would normally display. In most cases, however, one can use some attribute that appears naturally as part of the existing data anyway. Using templates, one can also have default values for certain values, in order to ensure that the sort attribute always has some value. This way, one solves part of the problem that articles without sortkeys are not shown in sorting queries. Cheers, Markus -- Markus Krötzsch Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe [EMAIL PROTECTED] phone +49 (0)721 608 7362 www.aifb.uni-karlsruhe.de/WBS/ fax +49 (0)721 693 717
pgp1x9INhkLAU.pgp
Description: PGP signature
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Semediawiki-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/semediawiki-user
