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';
39 private readonly RdfWriter $rdfWriter,
47 $this->rdfWriter->prefix( self::ONTOLOGY_PREFIX, self::ONTOLOGY_URL );
48 $this->rdfWriter->prefix(
'rdfs',
'http://www.w3.org/2000/01/rdf-schema#' );
49 $this->rdfWriter->prefix(
'owl',
'http://www.w3.org/2002/07/owl#' );
50 $this->rdfWriter->prefix(
'schema',
'http://schema.org/' );
51 $this->rdfWriter->prefix(
'cc',
'http://creativecommons.org/ns#' );
62 $this->rdfWriter->about( $this->titleToUrl( $titleFrom ) )
63 ->say( self::ONTOLOGY_PREFIX,
'isInCategory' )
64 ->is( $this->titleToUrl( $titleTo ) );
80 $this->rdfWriter->about( $this->titleToUrl( $title ) )
82 ->is( self::ONTOLOGY_PREFIX,
'Category' );
84 $this->rdfWriter->is( self::ONTOLOGY_PREFIX,
'HiddenCategory' );
86 $titletext = $title->getText();
87 $this->rdfWriter->say(
'rdfs',
'label' )->value( $titletext );
89 $this->rdfWriter->say( self::ONTOLOGY_PREFIX,
'pages' )->value( $pages );
91 $this->rdfWriter->say( self::ONTOLOGY_PREFIX,
'subcategories' )->value( $subcategories );
109 private function titleToUrl(
Title $title ) {