how to do a boolean AND regarding categories?
how to do a boolean AND regarding categories?
Is there a way to create a page in my sandbox that would display, the way Latin text requests are listed, a page listing Renaissance sacred pieces in Latin on CPDL? The goal is to avoid using the search feature and have the output sorted alphabetically and be able to jump to a given starting letter easily etc. As icing, I'd also like to sometmes be able to edit it to specify that it show only pieces by a certain composer. Is this doable and, if so, can someone tell me how? Thanks.
Re: how to do a boolean AND regarding categories?
Hi vaarky,
<DPL>
category=cat_1
...
category=cat_n
order=ascending
ordermethod=title
</DPL>
is the basic construct to get a listing of articles in cat_1,...,cat_n. In other words, the boolean "and" is accomplished by citing multiple instances of "category=". But if there are still more than some fixed number (the upper limit is currently 500), then only the 500 articles will be displayed. To get, say, 200 articles displayed, starting with the 601st article add lines:
count=200
offset=600
You will need this for the the cats "Renaissance music" & "Works in Latin", since there are currently about 1700 such works (and even Palestrina has a little over 200 works in Latin, but at least this is less than the 500 upper limit). Hence, the code for Ren & Latin, 601 through 800 looks like (with the optional line columns set to 2 to produce two-column output):
<DPL>
category=Renaissance music
category=Works in Latin
ordermethod=title
order=ascending
offset=600
count=200
columns=2
</DPL>
When viewing these, it's probably best to enter the info and then simply preview (rather than save) your sandbox (or other page).
I've just made a Template:MultiCatList to automate these ideas (it will be extended later). The code:
{{MultiCatList|Renaissance music|Works in Latin|col=2|skip=1200|number=400}}
lists all works common to Ren & Latin, in two columns, skipping the first 1200, and displaying (up to) 400 results. The col, skip, number paramters are optional and default to 1, 0, 500* respectively.
Note: the number parameter now defaults to 500 instead of the previous 200.
So...
{{MultiCatList|Renaissance music|Works in Latin|SATB}}
lists the first 500 Ren, Latin, SATB works in a single column.
{{MultCatList|William Byrd|Works in Latin|skip=100|number=50}} lists the Byrd Latin works from 101 through 150.
As an added feature, the total number of pages is listed at the beginning (helps in knowing how much you might wish to peruse!).
It's not quite possible to implement something like category listings - which allow looking at the next (or previous) 200 items, or (with Template:CatAZ) clicking on a letter of the alphabet and obtaining a listing that starts there. However, it is possible to obtain listings of pages whose titles start with any letter (or combination of letters) - more later.
I hope this is of use to you.
Chuck
Edit: I've changed the default for "number" to 500 (from 200) and implemented a "match" parameter that can be used to list pages whose titles start with any letter (or match any combination of letters) - see my latest post below.
<DPL>
category=cat_1
...
category=cat_n
order=ascending
ordermethod=title
</DPL>
is the basic construct to get a listing of articles in cat_1,...,cat_n. In other words, the boolean "and" is accomplished by citing multiple instances of "category=". But if there are still more than some fixed number (the upper limit is currently 500), then only the 500 articles will be displayed. To get, say, 200 articles displayed, starting with the 601st article add lines:
count=200
offset=600
You will need this for the the cats "Renaissance music" & "Works in Latin", since there are currently about 1700 such works (and even Palestrina has a little over 200 works in Latin, but at least this is less than the 500 upper limit). Hence, the code for Ren & Latin, 601 through 800 looks like (with the optional line columns set to 2 to produce two-column output):
<DPL>
category=Renaissance music
category=Works in Latin
ordermethod=title
order=ascending
offset=600
count=200
columns=2
</DPL>
When viewing these, it's probably best to enter the info and then simply preview (rather than save) your sandbox (or other page).
I've just made a Template:MultiCatList to automate these ideas (it will be extended later). The code:
{{MultiCatList|Renaissance music|Works in Latin|col=2|skip=1200|number=400}}
lists all works common to Ren & Latin, in two columns, skipping the first 1200, and displaying (up to) 400 results. The col, skip, number paramters are optional and default to 1, 0, 500* respectively.
Note: the number parameter now defaults to 500 instead of the previous 200.
So...
{{MultiCatList|Renaissance music|Works in Latin|SATB}}
lists the first 500 Ren, Latin, SATB works in a single column.
{{MultCatList|William Byrd|Works in Latin|skip=100|number=50}} lists the Byrd Latin works from 101 through 150.
As an added feature, the total number of pages is listed at the beginning (helps in knowing how much you might wish to peruse!).
It's not quite possible to implement something like category listings - which allow looking at the next (or previous) 200 items, or (with Template:CatAZ) clicking on a letter of the alphabet and obtaining a listing that starts there. However, it is possible to obtain listings of pages whose titles start with any letter (or combination of letters) - more later.
I hope this is of use to you.
Chuck
Edit: I've changed the default for "number" to 500 (from 200) and implemented a "match" parameter that can be used to list pages whose titles start with any letter (or match any combination of letters) - see my latest post below.
Charles H. Giffen
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
Re: how to do a boolean AND regarding categories?
Oh, my! This is wonderful, thanks.
By the way, is there a wiki book you recommend? I'm considering the MediaWiki book from O'Reilly.
By the way, is there a wiki book you recommend? I'm considering the MediaWiki book from O'Reilly.
Re: how to do a boolean AND regarding categories?
You're welcome!
I don't know what book on WikiMedia to recommend, since I've really come at it from WikiPedia and ChoralWiki, picking up things as I've needed them. I usually go to Special:Version at CPDL (I've even put a link to this on my User:CHGiffen page), which has links to MediaWiki, PHP, My SQL, and the installed extensions Replace Text, Cite, DynamicPageList2, Inputbox, ParserFunctions, Poem, and StringFunctions (at present). These links then typically provide not only installation instructions but also online usage guides/manuals. And, of course, I sometimes try to check code by others here and elsewhere to see if there are examples to crib from.
My plan for Template:MultiCatList is to add the ability to allow one to list those pages beginning with a given letter of the alphabet. It's not difficult, but I just didn't have enough time to do it yesterday. Unfortunately, though, it's not directly possible to provide CatAZ or (previous 200)(next 200) type navigation bars via DPL except in those instances where specific pages have been created for each of the items. I've done this for: The first and last are linked to from the Main Page (and the second from "Popular scores" at present).
Chuck
I don't know what book on WikiMedia to recommend, since I've really come at it from WikiPedia and ChoralWiki, picking up things as I've needed them. I usually go to Special:Version at CPDL (I've even put a link to this on my User:CHGiffen page), which has links to MediaWiki, PHP, My SQL, and the installed extensions Replace Text, Cite, DynamicPageList2, Inputbox, ParserFunctions, Poem, and StringFunctions (at present). These links then typically provide not only installation instructions but also online usage guides/manuals. And, of course, I sometimes try to check code by others here and elsewhere to see if there are examples to crib from.
My plan for Template:MultiCatList is to add the ability to allow one to list those pages beginning with a given letter of the alphabet. It's not difficult, but I just didn't have enough time to do it yesterday. Unfortunately, though, it's not directly possible to provide CatAZ or (previous 200)(next 200) type navigation bars via DPL except in those instances where specific pages have been created for each of the items. I've done this for: The first and last are linked to from the Main Page (and the second from "Popular scores" at present).
Chuck
Charles H. Giffen
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
Re: how to do a boolean AND regarding categories?
There is now another optional parameter "match" to Template:MultiCatList which works more or less as follows:
Also, the default for the "number" parameter has been increased from 200 to 500 (the allowable maximum).
Chuck
- setting match=Q ... displays results whose title begins with Q
- setting match=%Byrd ... displays results with "Byrd" somewhere in the title
- match=A%{{!}}%Palestrina - or - match=%Palestrina%{{!}}A ... displays results whose title begins with A or have "Palestrina" somewhere in the title.
- setting match=P%{{!}}Q%{{!}}R ... displays results whose title begins with either P, Q or R
Also, the default for the "number" parameter has been increased from 200 to 500 (the allowable maximum).
Chuck
Charles H. Giffen
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
Re: how to do a boolean AND regarding categories?
Thanks--eager to experiment after I get back from my trip.
Re: how to do a boolean AND regarding categories?
Couldn't wait, and thought I'd see if I can find which Praetorius piece the mystery Amen is part of, or at least how many SATB pieces there would be to eyeball if trying the brute force approach to check if it's part of a bigger piece that's even on CPDL.
Renaissance & SATB worked great, but I'm getting an error on composers (because they're not a category)? I tried the following variants (still in preview mode), but didn't really understand how match is injected into the template. Help? I'll have you feeling like "no good deed ever goes unpunished" before long.
{{MultiCatList|Michael Praetorius|SATB}}
{{MultiCatList|Michael_Praetorius|SATB}}
{{MultiCatList|"Michael Praetorius"|SATB}}
{{MultiCatList|Renaissance music|match="Michael Praetorius"|SATB}}
Renaissance & SATB worked great, but I'm getting an error on composers (because they're not a category)? I tried the following variants (still in preview mode), but didn't really understand how match is injected into the template. Help? I'll have you feeling like "no good deed ever goes unpunished" before long.
{{MultiCatList|Michael Praetorius|SATB}}
{{MultiCatList|Michael_Praetorius|SATB}}
{{MultiCatList|"Michael Praetorius"|SATB}}
{{MultiCatList|Renaissance music|match="Michael Praetorius"|SATB}}
Re: how to do a boolean AND regarding categories?
Hi Vaarky, all parameters must be names of categories, and there's no such "Category:Michael Praetorius". But, these is a "Category:Michael Praetorius compositions"
So, the following should work:
{{MultiCatList|Michael Praetorius compositions|SATB}}
This approach will only bring the pages which have template Composer applied, so it's not 100% garanteed.
So, the following should work:
{{MultiCatList|Michael Praetorius compositions|SATB}}
This approach will only bring the pages which have template Composer applied, so it's not 100% garanteed.
Re: how to do a boolean AND regarding categories?
Thanks, Carlos. Meanwhile I figured out how to use "match" (I was omitting the % symbol after the equal sign). I also looked at the raw DPL code on the Christmas/Advent page, so that helped me understand how to get it working using that. But I do prefer to use a pre-existing category for conciseness, so prefer your suggestion of Michael Praetorius compositions.
Re: how to do a boolean AND regarding categories?
Is there a polite order for putting categories in order to reduce load on CPDL? For example, should the most down-narrowing one (e.g. William Byrd compositions) be placed earlier than something such as SATB which would get a ton of hits?
Re: how to do a boolean AND regarding categories?
Related question, if I may--
What determines if something shows up under Michael Praetorius compositions? I couldn't identify the code in a score page that includes this among its categories--is one of the templates adding it and if so which one? I didn't see Ludwig Senfl compositions where it would appear on the bottom of a score page. Hope I'm not overlooking something obvious...
What determines if something shows up under Michael Praetorius compositions? I couldn't identify the code in a score page that includes this among its categories--is one of the templates adding it and if so which one? I didn't see Ludwig Senfl compositions where it would appear on the bottom of a score page. Hope I'm not overlooking something obvious...
Re: how to do a boolean AND regarding categories?
Wow! so much activity and so many questions, but you seem to have figured most of them out.
As for Praetorius and the mystery Amen,
{{MultiCatList|Renaissance music|SATB|match=%Michael Praetorius}}
would do the trick - and (potentially) give more Praetorius SATB compositions than "Category:Michael Praetorius compositions"
I used the following code yesterday as an aid to completkng the previously incomplete Categories "Thomas Crecquillon compositions" and "Adrian Willaert compositions" (Crecquillon illustrated):
{{#dpl:category=Sheet music|titlematch=@Crecquillon@|ordermethod=title|order=ascending}}
(there was no need to use @Thomas Crecquillon@). I simply compared the above DPL list with Category:Thomas Crecquillon compositions, then found the (two) missing items and inserted the Composer templated. The Willaert category involved maybe half a dozen items to change. In both cases, there were few enough items that I also was able to do some template, filepath fixes, etc.
I even was able to spot a case (one of many existing across ChoralWiki) which spurred me on to make the new Template:MultiVoicing (after botching an attempt at directly extending Template:Voicing) to handle works pages which have more than one voicing.
Chuck
While I'm not sure about this, my best guess would be yes: put the smallest category first.Is there a polite order for putting categories in order to reduce load on CPDL? For example, should the most down-narrowing one (e.g. William Byrd compositions) be placed earlier than something such as SATB which would get a ton of hits?
It's the Template:Composer that put Category:<composername> compositionsWhat determines if something shows up under Michael Praetorius compositions? I couldn't identify the code in a score page that includes this among its categories--is one of the templates adding it and if so which one? I didn't see Ludwig Senfl compositions where it would appear on the bottom of a score page. Hope I'm not overlooking something obvious...
As for Praetorius and the mystery Amen,
{{MultiCatList|Renaissance music|SATB|match=%Michael Praetorius}}
would do the trick - and (potentially) give more Praetorius SATB compositions than "Category:Michael Praetorius compositions"
I used the following code yesterday as an aid to completkng the previously incomplete Categories "Thomas Crecquillon compositions" and "Adrian Willaert compositions" (Crecquillon illustrated):
{{#dpl:category=Sheet music|titlematch=@Crecquillon@|ordermethod=title|order=ascending}}
(there was no need to use @Thomas Crecquillon@). I simply compared the above DPL list with Category:Thomas Crecquillon compositions, then found the (two) missing items and inserted the Composer templated. The Willaert category involved maybe half a dozen items to change. In both cases, there were few enough items that I also was able to do some template, filepath fixes, etc.
I even was able to spot a case (one of many existing across ChoralWiki) which spurred me on to make the new Template:MultiVoicing (after botching an attempt at directly extending Template:Voicing) to handle works pages which have more than one voicing.
Chuck
Charles H. Giffen
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
CPDL Board of Directors Chair
Admin at & Manager of ChoralWiki
Re: how to do a boolean AND regarding categories?
Ah, gotcha. Noticed the new Multivoicing template--cool! I've already made some notes of alternate voicings for CPDL pieces and can go back to add them.
I can't tell you what a Snoopy dance of delight I am doing over MultiCatList. It also got me realizing how that I can grok DPL so I may start dabbling. Thanks again.
I can't tell you what a Snoopy dance of delight I am doing over MultiCatList. It also got me realizing how that I can grok DPL so I may start dabbling. Thanks again.