9use Wikimedia\Purtle\RdfWriter;
18 private const ONTOLOGY_PREFIX =
'mediawiki';
22 private const ONTOLOGY_URL =
'https://www.mediawiki.org/ontology#';
26 public const OWL_URL =
'https://www.mediawiki.org/ontology/ontology.owl';
36 private const SPECIAL_DUMP =
'Special:CategoryDump';
43 $this->rdfWriter = $writer;
50 $this->rdfWriter->prefix( self::ONTOLOGY_PREFIX, self::ONTOLOGY_URL );
51 $this->rdfWriter->prefix(
'rdfs',
'http://www.w3.org/2000/01/rdf-schema#' );
52 $this->rdfWriter->prefix(
'owl',
'http://www.w3.org/2002/07/owl#' );
53 $this->rdfWriter->prefix(
'schema',
'http://schema.org/' );
54 $this->rdfWriter->prefix(
'cc',
'http://creativecommons.org/ns#' );
65 $this->rdfWriter->about( $this->titleToUrl( $titleFrom ) )
66 ->say( self::ONTOLOGY_PREFIX,
'isInCategory' )
67 ->is( $this->titleToUrl( $titleTo ) );
83 $this->rdfWriter->about( $this->titleToUrl( $title ) )
85 ->is( self::ONTOLOGY_PREFIX,
'Category' );
87 $this->rdfWriter->is( self::ONTOLOGY_PREFIX,
'HiddenCategory' );
89 $titletext = $title->getText();
90 $this->rdfWriter->say(
'rdfs',
'label' )->value( $titletext );
92 $this->rdfWriter->say( self::ONTOLOGY_PREFIX,
'pages' )->value( $pages );
94 $this->rdfWriter->say( self::ONTOLOGY_PREFIX,
'subcategories' )->value( $subcategories );
112 private function titleToUrl(
Title $title ) {