Well, I thought I needed the page ID of each page in order to connect properties to categories; but I see now that the new "smw_inst2" table stores category information - clever design, I must say, since it allows categories and "instance of" properties to work in the same way. So it looks like I don't actually need that ID for anything.


On Thu, Jun 19, 2008 at 5:03 AM, Markus Krötzsch <markus@semantic-mediawiki.org> wrote:
On Donnerstag, 19. Juni 2008, Yaron Koren wrote:
> Hi,
> It looks like the MediaWiki page ID is not used in the new tables in SMW
> 1.2 - instead, each page has an internal "SMW ID"; and even in the
> "smw_ids" table, which is used to connect properties to the actual wiki
> pages, only the title and namespace of the page show up, not the page ID.
> Is that true?

Yes. And the internal ID management is also taking redirects into account, and
several implementation details may change. I suggest to not build code that
depends on the details.

> And if so, is there a reason for it?

Yes: many objects used by SMW do not have page IDs, which forced us to do
large joins with title+namespace in the past. Only a separate ID management
can allow us to use numbers for everything.

This also greatly simplifies the implementation for multi-valued properties:
Instead of having special tables, we just use internal IDs (that are not
related to any page) to encode multi-valued properties.

> For certain usages (at
> least, for my Semantic Drilldown extension) it seems like it would be more
> efficient to have that page ID there somewhere; though I could be wrong.

When dealing with pure SMW data, the only place where having an ID may
increase efficiency is when it can safe a DB call for MediaWiki to find the
page ID for displaying some link (IDs are used to check if an article
exists). Otherwise, it does not seem that there is much reason to use IDs --
unless you want to access MediaWiki-only data in addition to SMW data.

Can you specify which access methods you need to realise with SD? Maybe we can
make an extended storage interface for that.

-- Markus

Markus Krötzsch
Semantic MediaWiki    http://semantic-mediawiki.org
http://korrekt.org    markus@semantic-mediawiki.org