Manual:categoryChangesAsRdf.php

From mediawiki.org
Other languages:

Details[edit]

categoryChangesAsRdf.php is a maintenance script that provides RDF representation of the recent changes to the category tree.

Options/Arguments[edit]

Option Description Required Default value
--output Output file. Will be overwritten. Optional stdout (console)
--start Starting timestamp (inclusive), in ISO or MediaWiki format Required
--end Ending timestamp (exclusive), in ISO or MediaWiki format Required

Usage[edit]

php maintenance/categoryChangesAsRdf.php [ --output| --start| --end ]

On standard console[edit]

Terminal
$ php maintenance/categoryChangesAsRdf.php --start "20211012000000" --end "20211126000000"

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#>
# Restores
# Additions
INSERT DATA {

<https://mediawikiexampledomain.com/wiki/index.php/Category:A> a mediawiki:Category ;
	rdfs:label "A" ;
	mediawiki:pages "2"^^xsd:integer ;
	mediawiki:subcategories "0"^^xsd:integer .

<https://mediawikiexampledomain.com/wiki/index.php/Category:B> a mediawiki:Category ;
	rdfs:label "B" ;
	mediawiki:pages "1"^^xsd:integer ;
	mediawiki:subcategories "1"^^xsd:integer .

<https://mediawikiexampledomain.com/wiki/index.php/Category:AC> a mediawiki:Category ;
	rdfs:label "AC" ;
	mediawiki:pages "0"^^xsd:integer ;
	mediawiki:subcategories "1"^^xsd:integer .

<https://mediawikiexampledomain.com/wiki/index.php/Category:A> mediawiki:isInCategory <https://mediawikiexampledomain.com/wiki/index.php/Category:AC> .

<https://mediawikiexampledomain.com/wiki/index.php/Category:AC> mediawiki:isInCategory <https://mediawikiexampledomain.com/wiki/index.php/Category:B> .

};
DELETE {
  <https://mediawikiexampledomain.com/wiki/index.php/Special:CategoryDump> schema:dateModified ?o .
}
WHERE {
  <https://mediawikiexampledomain.com/wiki/index.php/Special:CategoryDump> schema:dateModified ?o .
};
INSERT DATA {
  <https://mediawikiexampledomain.com/wiki/index.php/Special:CategoryDump> schema:dateModified "2021-11-26T00:00:00Z"^^xsd:dateTime .
}

Saving output as file[edit]

Terminal
$ php maintenance/categoryChangesAsRdf.php --output a.result --start "20211012000000" --end "20211126000000"

$ cat a.result

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#>
# Restores
# Additions
INSERT DATA {

<https://mediawikiexampledomain.com/wiki/index.php/Category:A> a mediawiki:Category ;
	rdfs:label "A" ;
	mediawiki:pages "2"^^xsd:integer ;
	mediawiki:subcategories "0"^^xsd:integer .

<https://mediawikiexampledomain.com/wiki/index.php/Category:B> a mediawiki:Category ;
	rdfs:label "B" ;
	mediawiki:pages "1"^^xsd:integer ;
	mediawiki:subcategories "1"^^xsd:integer .

<https://mediawikiexampledomain.com/wiki/index.php/Category:AC> a mediawiki:Category ;
	rdfs:label "AC" ;
	mediawiki:pages "0"^^xsd:integer ;
	mediawiki:subcategories "1"^^xsd:integer .

<https://mediawikiexampledomain.com/wiki/index.php/Category:A> mediawiki:isInCategory <https://mediawikiexampledomain.com/wiki/index.php/Category:AC> .

<https://mediawikiexampledomain.com/wiki/index.php/Category:AC> mediawiki:isInCategory <https://mediawikiexampledomain.com/wiki/index.php/Category:B> .

};
DELETE {
  <https://mediawikiexampledomain.com/wiki/index.php/Special:CategoryDump> schema:dateModified ?o .
}
WHERE {
  <https://mediawikiexampledomain.com/wiki/index.php/Special:CategoryDump> schema:dateModified ?o .
};
INSERT DATA {
  <https://mediawikiexampledomain.com/wiki/index.php/Special:CategoryDump> schema:dateModified "2021-11-26T00:00:00Z"^^xsd:dateTime .
}

See also[edit]