X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCategoriesRdf.php;h=463f6e846ba12ffd65c4ccc4904093a1aabd4606;hb=cf3bdd40a3fd22045703c1e188115fc87386fa65;hp=e19dc2aadbb37c94f52ef8397792b05c29ab193c;hpb=a8ec960e9d910acbcd0d50efad3bd73e3ae812aa;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/CategoriesRdf.php b/includes/CategoriesRdf.php index e19dc2aadb..463f6e846b 100644 --- a/includes/CategoriesRdf.php +++ b/includes/CategoriesRdf.php @@ -37,7 +37,13 @@ class CategoriesRdf { /** * Current version of the dump format. */ - const FORMAT_VERSION = "1.0"; + const FORMAT_VERSION = "1.1"; + /** + * Special page for Dump identification. + * Used as head URI for each wiki's category dump, e.g.: + * https://en.wikipedia.org/wiki/Special:CategoryDump + */ + const SPECIAL_DUMP = 'Special:CategoryDump'; /** * @var RdfWriter */ @@ -84,12 +90,30 @@ class CategoriesRdf { $this->rdfWriter->say( 'rdfs', 'label' )->value( $titletext ); } + /** + * Make URL from title label + * @param string $titleLabel Short label (without namespace) of the category + * @return string URL for the category + */ + public function labelToUrl( $titleLabel ) { + return $this->titleToUrl( Title::makeTitle( NS_CATEGORY, $titleLabel ) ); + } + /** * Convert Title to link to target page. * @param Title $title - * @return string + * @return string URL for the category */ private function titleToUrl( Title $title ) { return $title->getFullURL( '', false, PROTO_CANONICAL ); } + + /** + * Get URI of the dump for this particular wiki. + * @return false|string + */ + public function getDumpURI() { + return $this->titleToUrl( Title::makeTitle( NS_MAIN, self::SPECIAL_DUMP ) ); + } + }