Hello,
I'm trying to build a table with the IDs of the categorylinks table: Id of the cl_to | Id of the cl_from
It seems simple, by however I'm totally confused by its structure.
Please, help;
François
On Apr 9, 2005 9:09 AM, FxParlant f-x.p@laposte.net wrote:
Hello,
I'm trying to build a table with the IDs of the categorylinks table: Id of the cl_to | Id of the cl_from
It seems simple, by however I'm totally confused by its structure.
Please, help;
François
François,
I'm not certain I fully understand what you want to do. However, I'll give some information that I hope will help. If you need more, please let me know.
In the categoryLinks table:
cl_from is the id of the article where the [[category:foo]] entry appears. cl_to is the _title_ of the category page (in this example, "foo". The "category:" prefix is assumed).
Note that since there can be multiple category entries on any page, the cl_from field is not unique.
Note that cl_to is stored as a title instead of as an id because it is possible to add [[category:bar]] to a page when there is no category page named "bar".
The combination of (cl_from, cl_to) should be unique. Multiple instances of the same category entry in an article are only entered into categoryLinks once.
I hope this helps!
--Rich Holton
[[W:en:User:Rholton]]
Thanks Richard,
It's nice you took time to answer. I'm writing an extension (another totally useless one) and I need to build a link table of the Category pages, but with the IDs. It's a complete mysql question, but I'm sure there are geeks here (as you seem to be) who know fairly well mediawiki and could help:
I need to have the cl_to and cl_from converted to the ID of these pages (exactly the same as for the normal links table)...This already gives me headaches:(
As for another constraint, I need to take into account only the links between category pages (from namespace=14 to namespace=14)
If you still have strength ... :D
François
Richard Holton wrote:
On Apr 9, 2005 9:09 AM, FxParlant f-x.p@laposte.net wrote:
Hello,
I'm trying to build a table with the IDs of the categorylinks table: Id of the cl_to | Id of the cl_from
It seems simple, by however I'm totally confused by its structure.
Please, help;
François
François,
I'm not certain I fully understand what you want to do. However, I'll give some information that I hope will help. If you need more, please let me know.
In the categoryLinks table:
cl_from is the id of the article where the [[category:foo]] entry appears. cl_to is the _title_ of the category page (in this example, "foo". The "category:" prefix is assumed).
Note that since there can be multiple category entries on any page, the cl_from field is not unique.
Note that cl_to is stored as a title instead of as an id because it is possible to add [[category:bar]] to a page when there is no category page named "bar".
The combination of (cl_from, cl_to) should be unique. Multiple instances of the same category entry in an article are only entered into categoryLinks once.
I hope this helps!
--Rich Holton
[[W:en:User:Rholton]]
On 4/9/05, FxParlant f-x.p@laposte.net wrote:
Thanks Richard,
It's nice you took time to answer. I'm writing an extension (another totally useless one) and I need to build a link table of the Category pages, but with the IDs. It's a complete mysql question, but I'm sure there are geeks here (as you seem to be) who know fairly well mediawiki and could help:
I need to have the cl_to and cl_from converted to the ID of these pages (exactly the same as for the normal links table)...This already gives me headaches:(
As for another constraint, I need to take into account only the links between category pages (from namespace=14 to namespace=14)
If you still have strength ... :D
François
Ok. First you'll need to create the new table. Something like:
CREATE TABLE foo ( foo_from int unsigned NOT NULL default 0, foo_to int unsigned NOT NULL default 0, UNIQUE KEY foo_from (foo_from ,foo_to), KEY (foo_to) );
Then, fill in the new table from what already exists in CategoryLinks and Cur
INSERT INTO foo (foo_from, foo_to) SELECT cl_from, cur_id FROM categoryLinks, cur WHERE cur_namespace=14 AND cur_title = cl_to
This (in effect) takes each record in the categoryLinks table and finds the matching record in cur based on a match between cur_title and cl_to. If the resulting record in cur is also from namespace 14, then it takes the cl_from in categoryLinks and the cur_id from cur and writes those as a record to the new "foo" database.
Does this do what you want? If you have any questions, please ask.
-- Rich Holton
[[W:en:User:Rholton]]
For clarification, you mean category pages with categories on them?
On Apr 9, 2005 4:06 PM, Richard Holton richholton@gmail.com wrote:
Ok. First you'll need to create the new table. Something like:
CREATE TABLE foo ( foo_from int unsigned NOT NULL default 0, foo_to int unsigned NOT NULL default 0, UNIQUE KEY foo_from (foo_from ,foo_to), KEY (foo_to) );
Then, fill in the new table from what already exists in CategoryLinks and Cur
INSERT INTO foo (foo_from, foo_to) SELECT cl_from, cur_id FROM categoryLinks, cur WHERE cur_namespace=14 AND cur_title = cl_to
This (in effect) takes each record in the categoryLinks table and finds the matching record in cur based on a match between cur_title and cl_to. If the resulting record in cur is also from namespace 14, then it takes the cl_from in categoryLinks and the cur_id from cur and writes those as a record to the new "foo" database.
Would [[:Category:Foo]] type links be included in this? (This makes a normal link to the page Category:Foo).
-- Jamie ------------------------------------------------------------------- http://endeavour.zapto.org/astro73/ Thank you to JosephM for inviting me to Gmail! Have lots of invites. Gmail now had 2GB.
Hi,
The problem I'm facing, is that I must have in a first query, the pages with their different namespaces(0 or 14) and titles, and in a second one, the links between them.
As you all know, some links are in the "links" table, and some other are in the "categgorylinks" (or am I mistaken).
The problem is that I MUST NOT (unless I want my engine to die) have links from pages who are not mentioned in the first query. Unfortunately most of the links in "categorylinks", as mentioned by Richard, are not yet created in the cur table. Furthermore, it is also very difficult to restrict the pair of links from the "links" table, to be BOTH with namespace=0 or namespace=14.
Nevertheless here is the "result" I could manage, only with the category pages of my site.
http://www.fxparlant.net/Special:Touchgraph (there must be a mistake in the html because the applet fails in Firefox... but works in IE)...just move the first node
Thanks to Jamie and Richard, for their support ... I'm off to bed :D
See you all tomorrow François
Jamie Bliss wrote:
For clarification, you mean category pages with categories on them?
On Apr 9, 2005 4:06 PM, Richard Holton richholton@gmail.com wrote:
Ok. First you'll need to create the new table. Something like:
CREATE TABLE foo ( foo_from int unsigned NOT NULL default 0, foo_to int unsigned NOT NULL default 0, UNIQUE KEY foo_from (foo_from ,foo_to), KEY (foo_to) );
Then, fill in the new table from what already exists in CategoryLinks and Cur
INSERT INTO foo (foo_from, foo_to) SELECT cl_from, cur_id FROM categoryLinks, cur WHERE cur_namespace=14 AND cur_title = cl_to
This (in effect) takes each record in the categoryLinks table and finds the matching record in cur based on a match between cur_title and cl_to. If the resulting record in cur is also from namespace 14, then it takes the cl_from in categoryLinks and the cur_id from cur and writes those as a record to the new "foo" database.
Would [[:Category:Foo]] type links be included in this? (This makes a normal link to the page Category:Foo).
-- Jamie
http://endeavour.zapto.org/astro73/ Thank you to JosephM for inviting me to Gmail! Have lots of invites. Gmail now had 2GB.
Dang, that's cool! I'd like to see the equivelent for Wikipedia.
It works for FireFox, if you have the new VM (v5) from Sun.
ps- your title displays as <touchgraph>.
On Apr 9, 2005 7:13 PM, FxParlant f-x.p@laposte.net wrote:
Hi,
The problem I'm facing, is that I must have in a first query, the pages with their different namespaces(0 or 14) and titles, and in a second one, the links between them.
As you all know, some links are in the "links" table, and some other are in the "categgorylinks" (or am I mistaken).
The problem is that I MUST NOT (unless I want my engine to die) have links from pages who are not mentioned in the first query. Unfortunately most of the links in "categorylinks", as mentioned by Richard, are not yet created in the cur table. Furthermore, it is also very difficult to restrict the pair of links from the "links" table, to be BOTH with namespace=0 or namespace=14.
Nevertheless here is the "result" I could manage, only with the category pages of my site.
http://www.fxparlant.net/Special:Touchgraph (there must be a mistake in the html because the applet fails in Firefox... but works in IE)...just move the first node
Thanks to Jamie and Richard, for their support ... I'm off to bed :D
See you all tomorrow François
Jamie Bliss wrote:
For clarification, you mean category pages with categories on them?
On Apr 9, 2005 4:06 PM, Richard Holton richholton@gmail.com wrote:
Ok. First you'll need to create the new table. Something like:
CREATE TABLE foo ( foo_from int unsigned NOT NULL default 0, foo_to int unsigned NOT NULL default 0, UNIQUE KEY foo_from (foo_from ,foo_to), KEY (foo_to) );
Then, fill in the new table from what already exists in CategoryLinks and Cur
INSERT INTO foo (foo_from, foo_to) SELECT cl_from, cur_id FROM categoryLinks, cur WHERE cur_namespace=14 AND cur_title = cl_to
This (in effect) takes each record in the categoryLinks table and finds the matching record in cur based on a match between cur_title and cl_to. If the resulting record in cur is also from namespace 14, then it takes the cl_from in categoryLinks and the cur_id from cur and writes those as a record to the new "foo" database.
Would [[:Category:Foo]] type links be included in this? (This makes a normal link to the page Category:Foo).
-- Jamie
http://endeavour.zapto.org/astro73/ Thank you to JosephM for inviting me to Gmail! Have lots of invites. Gmail now had 2GB.
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
On Apr 9, 2005 11:53 PM, Jamie Bliss astronouth7303@gmail.com wrote:
Would [[:Category:Foo]] type links be included in this? (This makes a normal link to the page Category:Foo).
No, because that creates an entry in the normal 'links' table, not the 'categorylinks' one - otherwise the software wouldn't be able to spot the difference when listing the category.
mediawiki-l@lists.wikimedia.org