Manual:dumpCategoriesAsRdf.php
Appearance
MediaWiki file: dumpCategoriesAsRdf.php | |
---|---|
Location: | maintenance/ |
Source code: | master • 1.42.3 • 1.41.4 • 1.39.10 |
Classes: | DumpCategoriesAsRdf |
Details
[edit]The dumpCategoriesAsRdf.php maintenance script generates a Resource Description Framework (RDF) dump of categories in a wiki.
Options
[edit]Option | Required | Default value | |
---|---|---|---|
--output | Output file. Will be overwritten. | Optional | stdout |
--format | Set the dump format | Optional | ttl |
Usage
[edit]php maintenance/dumpCategoriesAsRdf.php [ --output| --format ]
Dumping categories as ttl format in terminal's standard output
[edit]Terminal
$ php maintenance/dumpCategoriesAsRdf.php @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix mediawiki: <https://www.mediawiki.org/ontology#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix schema: <http://schema.org/> . @prefix cc: <http://creativecommons.org/ns#> . <https://example.com/wiki/index.php/Special:CategoryDump> a schema:Dataset, owl:Ontology ; cc:license <> ; schema:softwareVersion "1.1" ; schema:dateModified "2021-09-19T15:51:30Z"^^xsd:dateTime ; schema:isPartOf <https://example.com/> ; owl:imports <https://www.mediawiki.org/ontology/ontology.owl> . <https://example.com/wiki/index.php/Category:Emergency> a mediawiki:Category ; rdfs:label "Emergency" ; mediawiki:pages "1"^^xsd:integer ; mediawiki:subcategories "0"^^xsd:integer . <https://example.com/wiki/index.php/Category:Management> a mediawiki:Category ; rdfs:label "Management" ; mediawiki:pages "2"^^xsd:integer ; mediawiki:subcategories "0"^^xsd:integer . <https://example.com/wiki/index.php/Category:Project> a mediawiki:Category ; rdfs:label "Project" ; mediawiki:pages "1"^^xsd:integer ; mediawiki:subcategories "2"^^xsd:integer . <https://example.com/wiki/index.php/Category:Management> mediawiki:isInCategory <https://example.com/wiki/index.php/Category:Project> . <https://example.com/wiki/index.php/Category:Emergency> mediawiki:isInCategory <https://example.com/wiki/index.php/Category:Project> .
Dumping categories as rdf format in terminal's standard output
[edit]Terminal
$ php maintenance/dumpCategoriesAsRdf.php --format rdf <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:mediawiki="https://www.mediawiki.org/ontology#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:schema="http://schema.org/" xmlns:cc="http://creativecommons.org/ns#"> <rdf:Description rdf:about="https://example.com/wiki/index.php/Special:CategoryDump"> <rdf:type rdf:resource="http://schema.org/Dataset"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/> <cc:license rdf:resource=""/> <schema:softwareVersion>1.1</schema:softwareVersion> <schema:dateModified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2021-09-19T16:02:08Z</schema:dateModified> <schema:isPartOf rdf:resource="https://example.com/"/> <owl:imports rdf:resource="https://www.mediawiki.org/ontology/ontology.owl"/> </rdf:Description> <rdf:Description rdf:about="https://example.com/wiki/index.php/Category:Emergency"> <rdf:type rdf:resource="https://www.mediawiki.org/ontology#Category"/> <rdfs:label>Emergency</rdfs:label> <mediawiki:pages rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</mediawiki:pages> <mediawiki:subcategories rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</mediawiki:subcategories> </rdf:Description> <rdf:Description rdf:about="https://example.com/wiki/index.php/Category:Management"> <rdf:type rdf:resource="https://www.mediawiki.org/ontology#Category"/> <rdfs:label>Management</rdfs:label> <mediawiki:pages rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</mediawiki:pages> <mediawiki:subcategories rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</mediawiki:subcategories> </rdf:Description> <rdf:Description rdf:about="https://example.com/wiki/index.php/Category:Project"> <rdf:type rdf:resource="https://www.mediawiki.org/ontology#Category"/> <rdfs:label>Project</rdfs:label> <mediawiki:pages rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</mediawiki:pages> <mediawiki:subcategories rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">2</mediawiki:subcategories> </rdf:Description> <rdf:Description rdf:about="https://example.com/wiki/index.php/Category:Management"> <mediawiki:isInCategory rdf:resource="https://example.com/wiki/index.php/Category:Project"/> </rdf:Description> <rdf:Description rdf:about="https://example.com/wiki/index.php/Category:Emergency"> <mediawiki:isInCategory rdf:resource="https://example.com/wiki/index.php/Category:Project"/> </rdf:Description>
Dumping categories as ttl format in export.ttl file
[edit]Terminal
$ php maintenance/dumpCategoriesAsRdf.php --output export.ttl