Hi guys,

Op 20-9-2013 4:12, legoktm schreef:
Hi Jeroen,

Sorry about the late response...
Talked with Jeroen a bit about this on irc. Forgot to send an email here.

On Fri, Sep 6, 2013 at 11:47 AM, Jeroen De Dauw <[email protected] <mailto:[email protected]>> wrote:

    Hey,

    While looking at the source of the pywikipediabot in the past, I
    noticed that it contained a bunch of Wikibase specific code
    (sometimes even Wikidata specific). The code I saw often did a
    poor job at separating different concerns, and did some weird
    things to represent parts of the Wikibase data model.

I wonder if Jeroen looked at the code in compat or in core. Core is much cleaner than compat. Jeroen?


Right now I think our biggest issue is that Claim subclasses PropertyPage. I originally wrote this thinking it would be convenient, but now after using the code for a while, the only function we actually use is PropertyPage.datatype(), which can easily be fixed. I'll start working on that.
Good idea. We should try to stick to https://meta.wikimedia.org/wiki/Wikidata/Notes/Data_model as much as possible, so implementing things in Pywikipedia when things come available on Wikidata itself. We shouldn't forgot about Pywikipedia itself. I ran into a page problem earlier.

Take the class Page:

Three calling formats are supported:

          - If the first argument is a Page, create a copy of that object.
            This can be used to convert an existing Page into a subclass
            object, such as Category or ImagePage.  (If the title is also
            given as the second argument, creates a copy with that title;
            this is used when pages are moved.)
          - If the first argument is a Site, create a Page on that Site
            using the second argument as the title (may include a section),
            and the third as the namespace number. The namespace number is
mandatory, even if the title includes the namespace prefix. This
            is the preferred syntax when using an already-normalized title
            obtained from api.php or a database dump.  WARNING: may produce
            invalid objects if page title isn't in normal form!
          - If the first argument is a Link, create a Page from that link.
            This is the preferred syntax when using a title scraped from
            wikitext, URLs, or another non-normalized source.

I think it would be nice if subclasses of page (like ItemPage) also support these three formats. What do you think? Use case for this is generators. If I use a generator on Wikidata it returns page objects, would be nice to just be able to say itempage = pywikibot.ItemPage(page).

Maarten
_______________________________________________
Pywikipedia-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Reply via email to