r66973 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66972‎ | r66973 | r66974 >
Date:16:46, 27 May 2010
Author:mkroetzsch
Status:deferred
Tags:
Comment:
add modification date and namespace information to RDF export (Bug 22723)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/export/SMW_Exporter.php
@@ -55,9 +55,6 @@
5656 $result = $subject->getExportData();
5757
5858 // first set some general parameters for export
59 - global $smwgOWLFullExport; // export like individual (even if Category/Property)
60 - $indexp = ( ( ( $subject->getNamespace() != SMW_NS_PROPERTY ) &&
61 - ( $subject->getNamespace() != NS_CATEGORY ) ) || $smwgOWLFullExport );
6259 $category_pe = null;
6360 $subprop_pe = null;
6461 switch ( $subject->getNamespace() ) {
@@ -68,9 +65,7 @@
6966 $label = $subject->getText();
7067 break;
7168 case SMW_NS_PROPERTY:
72 - if ( $indexp ) {
73 - $category_pe = SMWExporter::getSpecialElement( 'rdfs', 'subClassOf' );
74 - }
 69+ $category_pe = SMWExporter::getSpecialElement( 'rdf', 'type' );
7570 $subprop_pe = SMWExporter::getSpecialElement( 'rdfs', 'subPropertyOf' );
7671 $equality_pe = SMWExporter::getSpecialElement( 'owl', 'equivalentProperty' );
7772 $types = $semdata->getPropertyValues( SMWPropertyValue::makeProperty( '_TYPE' ) );
@@ -97,6 +92,8 @@
9893 $ed = new SMWExpData( new SMWExpResource( SMWExporter::$m_exporturl . '/' . $subj_title->getPrefixedURL() ) );
9994 $result->addPropertyObjectValue( SMWExporter::getSpecialElement( 'rdfs', 'isDefinedBy' ), $ed );
10095 $result->addPropertyObjectValue( SMWExporter::getSpecialElement( 'rdf', 'type' ), new SMWExpData( $maintype_pe ) );
 96+ $ed = new SMWExpData( new SMWExpLiteral( $subject->getNamespace(), null, 'http://www.w3.org/2001/XMLSchema#integer' ) );
 97+ $result->addPropertyObjectValue( SMWExporter::getSpecialElement( 'swivt', 'wikiNamespace' ), $ed );
10198 if ( $modifier != '' ) { // make variant and possibly add meta data on base properties
10299 if ( $subject->getNamespace() == SMW_NS_PROPERTY ) {
103100 $ed = new SMWExpData( new SMWExpLiteral( $modifier, null, 'http://www.w3.org/2001/XMLSchema#string' ) );
@@ -109,7 +106,6 @@
110107 // export properties based on stored data
111108 foreach ( $semdata->getProperties() as $key => $property ) {
112109 if ( $property->isUserDefined() ) {
113 - if ( !$indexp ) continue; // no properties for schema elements
114110 $pe = SMWExporter::getResourceElement( $property );
115111 foreach ( $semdata->getPropertyValues( $property ) as $dv ) {
116112 $ed = $dv->getExportData();
@@ -134,6 +130,9 @@
135131 case '_SUBP':
136132 $pe = $subprop_pe;
137133 break;
 134+ case '_MDAT':
 135+ $pe = SMWExporter::getSpecialElement( 'swivt', 'wikiPageModificationDate' );
 136+ break;
138137 case '_REDI': /// TODO: currently no check for avoiding OWL DL illegal redirects is done
139138 if ( $subject->getNamespace() == SMW_NS_PROPERTY ) {
140139 $pe = null; // checking the typing here is too cumbersome, smart stores will smush the properties anyway, and the others will not handle them equivalently

Status & tagging log