DPL talk:Manual - General Usage and Invocation Syntax

From FollowTheScore
Jump to: navigation, search

Duplicating page TOC

Any tips for using this extension to duplicate a page's TOC? --Two7s clash 17:35, 17 April 2010 (UTC)

Is it possible to create a nice image gallery using dpl as a parser function rather than the "gallery" tags?

This would make incorporation into templates easier.
I think this should be possible. It very much depends on what you call "nice" ;-)
DPL allows you to create arbitrary wikicode which you can pipe into another extension (like e.g. gallery).
Have you seen Test escapelinks?
Gero 17:58, 22 July 2007 (CEST)

Calling Semantic MediaWiki from within DPL

Is it possible to use SMW <ask> tags from within DPL? Thanks.

Answer

You can use any other extension within the result loop of a DPL query. Note that you have to use the special "double angle" brackets, like this : «ask ....». This prevents the Mediawiki parser from trying to expand embedded tags too early. If you wanted to use parser function syntax you would have to write ²{ask ...}² instead of the traditional double curly braces for the same reason.

DPL is a very lightweight approach to getting the best out of a wiki just as it is. Semantic Web approaches typically require some additional effort from the authors, like describing the semantic flavor of a relation. In turn they get more quality in terms of answering specific questions. OWL and RDF are certainly interesting but they seem to have failed to get wide-spread acceptance so far.

If you are really knowledgable regarding SMW I would be open to combine the best of both worlds (i.e. DPL + the classic wiki on one hand and RDF/OWL/Semantic Modelling on the other hand).

One idea in my mind is that the textual phrases around the place where a link is placed in a text may contain typical 'trigger words' which describe the semantic connection which is represented by the link...

Is there a similar test wiki for ask (or other semantic wiki approaches like thid DPLDEMO wiki? As far as I understand SMW requires changes at the database tables ...

Gero 23:09, 31 August 2007 (CEST)

http://ontoworld.org/ is Semantic MediaWiki's (SMW) main wiki, I believe. As I emailed you (and the SMW mailing list) the other day, Gero:

From: Eep²
Sent: Tuesday, August 28, 2007 10:50 PM

I just came up with an example where DPL replaces SMW while trying to figure out how to display the same page as 2 different things (like an action vs. object). Using DPL, I can simply create lists of which pages in a category link to page/subpage ("property/value") or namespace (or not):page ("property:value"). So, using this design, I can embed a DPL query to list all pages in the "Games" category that link to the current page as a subpage (or page in a namespace) that links to an action, effect, object, etc--and all on the same page.

{{#dpl:
category=Games
|linksto=action/{{PAGENAME}} <!-- or action:{{PAGENAME}} -->
|redirects=include
|resultsheader=<h2>Games (%PAGES%)</h2>
|noresultsheader=<h2>Games (0)</h2>''No games have this action.''
}}

{{#dpl:
category=Games
|namespace=Action
|linksto={{PAGENAME}}
|redirects=include
|resultsheader=<h2>Games (%PAGES%)</h2>
|noresultsheader=<h2>Games (0)</h2>''No games have this action.''
}}

The only problem is DPL doesn't handle redirects seamlessly (like MediaWiki's Special:Whatlinkshere page does) and requires obscure nested queries (and yet another template--DPL is a template abuser/whore, as is Semantic Forms).

No silly link syntax and no excessive server hits with SMW having to figure out all those relations (since DPL doesn't require an extra database table). SMW's "facts" about section is replaced with DPL's list ouput which can be configured to be ANYWHERE on the page, ordered however, and as a table, list, etc, thus not forcing a specific ordering/layout method.

Tell me, what is the point of SMW again?

Time to stop reinventing the wheel and work together, DPL/SMW devs...


> From: Eep²
> Sent: Thursday, August 23, 2007 11:53 PM

> I realize the differences between DPL and SMW but I just think SMW is too complicated for its own good. If the semantic web is EVER going to become a "killer app", it's going to have to become a LOT easier to use and FAR less complicated. The move from relation+attribute to just property is a beginning, but I still don't see the advantage of using Semantic MediaWiki over a "set unionizer" like DPL or even the MediaWiki API (query). I have SMW installed on my wiki but it frustrates me to no end, what with causing just about every page to take much longer to load because of excessive server hits (status bar flashes like mad), to the uncustomizable "facts about" section that tends to dominate every page a relationship/attribute is on, SMW is more annoyance than advantage, I feel.

> For example, on a relation page (such as http://www.tnlc.com/wiki/index.php?title=Relation:Effect ) [no longer exists due to SMW deactivation], I want to be able to customize how that list is shown, like in a table with ALL effects per game instead of only the first 3 (and without all those annoying "+ <magnifying glass>" links!). Also, having to create a relation page in order to get the relations defined with it, is lame, especially when all relations will just essentially have "see <link>" in them to the actual article of the same name (minus the "relation:" namespace, of course). I just see relations as glorified categories. If MediaWiki just had a way to format the category list, that would be at least as good as what SMW does with relations.

> Attributes seem just like template fields to me so why reinvent the wheel?

> Tell me what is the point of using SMW over categories and templates and an extension like DPL which can query template fields against categories, namespaces, articles (and sections of them), outputting the result in a near-completely customizable way (albeit with redundant templates and way too much coding)? SMW needs to at LEAST get as customizable as DPL--but preferably much more user-friendlier--before I'll consider switching over to it.

> Some basic suggestions:
> * Combine special pages: > - Relations, UnusedRelations, and WantedRelations into a single Special:Relations page with sortable tables. There just isn't enough data to justify having them split up--especially on smaller wikis with few relations. > - Attributes and UnusedAttributes > - Templates and UnusedTemplates > - Statistics and ExtendedStatistics > - SearchByRelation, SearchByAttribute, and Ask (which is nefariously dubbed "Semantic search") > * The relations and attributes special pages should have built-in search forms from the relevent "SearchBy" special page.

> There are just way too many special pages that really don't need to exist and clutter up the special page list (especially if it's not sectioned as mine as at http://tnlc.com/wiki/index.php?title=Special:Specialpages


> From: Sergey Chernyshev
> Sent: Thursday, August 23, 2007 7:00 AM

> Eep, I don't think you realize the differences between DPL and SMW - DPL is not glorified SMW, it's simplified query extension comparing to SMW and their approaches are fundamentally different.

> It's quite hard to explain to non-technical person, but SMW has "Semantic" in it because it's based on the ideas of Semantic Web, triples, RDF model (not to be confused with RDF/XML serialization which it also supports) and so on.

> These differences make collaboration between these two projects quite problematic. And I understand why it's hard to get for a non-technical person. In any case, it's for developers of SMW and DPL to decide on such things.

> And not to give you the wrong idea of SMW community denying DPL features, I can assure you that they are desired in SMW, but due to the nature of the approach it should be done differently - ideally, all information of MediaWiki "Title" object should be available for querying the same way it's parsed content is available, this way it will be possible to use this data in any combinations with other data in the system.

> I'll be happy to hear from developers of all the extensions and hope that this demand for the functionality from end-user will not get missed in the pile of other features.


> On 8/23/07, Eep² wrote:

> Psst, that's where the "collaboration" part comes in. Surely you've heard of it...if not, http://en.wikipedia.org/wiki/Collaboration

> By working with Gero (only current DPL developer that I'm aware of) in adding semantic support to DPL, you won't need to "reinvent the wheel" by adding it into Semantic Forms. DPL is basically a glorified Semantic MediaWiki (SMW) anyway, allowing lists of articles that link to other articles, and MANY other variations of list creation. You (and SMWdevs) really need to familiarize yourself with it as it essentially replaces most of SMW functionality more easily without having to add odd link markup ("::" and ":="), dorking with relations/attributes/types/properties (whatever), etc. DPL takes existing MediaWiki functionality (links, categories, and namespaces) and simply combines them (set unions, essentially) that can replace most of what SMW is all about.

> I'm finding using DPL to be FAR easier than SMW. Instead of showing complicated relations/attributes, I simple use DPL to generate a list of articles in a specific category that link to a specific word (and its redirects). So, instead of having to go to some obscure relation:weather page, I simple go to weather (which redirects to category:weather) and see all articles in the "games" category that link to "weather". And the same with "wind" (which is an article in the "weather" category). Simple; basic, default MediaWiki functionality used intuitively without requiring extra database tables and increased server load looking up all those relations/attributes for EVERY page (which, in turn, slows down the wiki, causing pages to load longer).

> To SMW-related devs (that includes you, Yaron, and Gero), I suggest working together collaboratively to find the best implementation of dynamic data in MediaWiki--and a GUI to easily manipulate it. DPL is perhaps the closest, integrating Simple Forms into its query page, but the connection between creating forms to generate tabular database-like articles for listing into tables or other various inclusion options (as DPL can do) hasn't been formed yet in Semantic MediaWiki. I see the big picture where all of these extensions can go once they come together and start working together--I hope you devs do too now...


> From: Yaron Koren
> Sent: Wednesday, August 22, 2007 2:33 PM

> DPL is Dynamic Page Lists, a MediaWiki extension I mentioned in my email.

> Eep, as you may or may not realize, Semantic MediaWiki and Semantic Forms are two separate extensions, with two separate sets of > developers. It's Semantic MediaWiki that does data access, and I have no control over the development of that one (not that I > would necessarily add metadata support to it if I could, but it's a moot point anyway.)


> On 8/22/07, Michael F Uschold wrote:
> I just googled [DPL wiki] and found nothing useful. What is DPL?


> On 8/22/07, Eep² wrote:

> Er, why not just work with DPL in getting it to access semantic data? Collaboration...

-Eep² 23:30, 31 August 2007 (CEST)

<dpl> vs {{#dpl

i am using
|includematch=/type\s*=\s*[^|]*/s
in <dpl> and need to switch the entire code to {{#dpl:. That line causes errors in {{#dpl:. Is it possible to use it, and if so, what changes do i need to make?

Kay

Try replacing the "[^|]" with "[^¦]". Otherwise the "|" gets interpreted as the start of the next parameter. Not sure if anything else needs to be done. --Rezyk 21:05, 3 July 2008 (CEST)

Using DPL to make a list of Newly created pages

Hi, I want to add a list of the 5 newest pages that have been created on my main page. Is it possible to use DPL to make a list of newly created pages? Sparkzilla 00:58, 6 February 2009 (UTC)

  • The following DPL code should do the trick:
    {{#dpl:titlematch=%%|ordermethod=firstedit|count=5|order=descending}}

    ...though, you might also be able to add arguments to a template call of Special:Newpages to get what you want. See this help on Wikipedia for more info.--Volts 19:37, 6 February 2009 (UTC)

Magic words and Parser extension method

The manual says: Magic words like {{PAGENAME}} or {{CURRENTDAY}} cannot be used with Parser extension method. Is that still true? I am using version 1.8.9 and the code below works fine for me:

<DPL>
 category={{PAGENAME}}
 include={Infobox Server}:OS
 table=class="prettytable sortable",,OS
</DPL>

MichielV 13:15, 7 January 2010 (UTC)

MediaWiki changed the parser behaviour in the latest versions - which means that you can NOW use template calls in the way you do it. But there are still some minor differences (at least I observed some strange effects with early versions of the new parser) - and it does not work in older versions (some of which are still in use). That is why I would prefer to leave the general disclaimer in the manual. Please feel free, however, to add a remark about the changed behaviour for template expansion in the newer MW versions (I do not remember the version where this changed). --Gero 21:14, 7 January 2010 (UTC)