Page MenuHomePhabricator

SMW_dumpRDF.php does not appear to work for SMW >= 1.5.5
Closed, InvalidPublic

Description

Author: amh.public

Description:
Temporary patch to SMW_Serializer_RDFXML.php as suggested by Markus on semediawiki-user mailing list

The SMW_dumpRDF script does not appear to work properly for MW 1.16.2, SMW
1.5.5.2 or 1.5.6, on PHP 5.2.10. I have a variety of other extensions installed, but these problems persist even if I disable all other extensions (none of which require patching MW or SMW code). All properties in the system have their own pages and types, and all types have their own pages.

The script will go through some content and generate a file up to about 330 KB, then stop with the following error message:

Catchable fatal error: Argument 1 passed to SMWSerializer::requireDeclaration() must be an instance of SMWExpResource, instance of SMWExpData given, called in /path/to/extensions/SemanticMediaWiki/includes/export/SMW_Serializer_RDFXML.php on line 158 and defined in /path/to/extensions/SemanticMediaWiki/includes/export/SMW_Serializer.php on line 218

I have only tested this on a system with multiple wikis that use a lot of shared code and symlinks, e.g., "cd /path/to/mwinstall; export MW_INSTALL_PATH=. && php extensions/SemanticMediaWiki/maintenance/SMW_dumpRDF.php -o /path/to/file"

The result is the same whether I use "-o /path/to/file" or "> /path/to/file".

The "/path/to" above represents the actual path; it gets reported in full by the error message and correctly reports the symlink target.

The attached patch from Markus to includes/export/SMW_Serializer_RDFXML.php seems to allow the export to work. I have not fully validated the export data, but the dump appears to capture everything it is supposed to.


Version: unspecified
Severity: enhancement

Attached:

Details

Reference
bz27779

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:28 PM
bzimport set Reference to bz27779.

amh.public wrote:

Additional comment: The export outputs "rdf:datatype" instead of "rdf:Datatype". Protege (4.1b) complains about this: it causes reasoners not to start because the schema at http://www.w3.org/2000/01/rdf-schema labels datatype as "Datatype" and Protege imports all the files at the top of an SMW RDF export.

A simple

perl -i.bak -pe 's/rdf:datatype/rdf:Datatype/g' filename

fixes the file so Protege likes it, but perhaps you may want to change line 145 of SMW_Serializer_RDFXML.php to

							$this->post_ns_buffer .= ' rdf:Datatype="' . $object->getDatatype() . '"';

(see also SMW_QP_RSSlink.php)

I am not sure if other OWL/RDF editors are as picky, but hopefully this will help limit any problems.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

Adding "need-review" keyword.

mwjames subscribed.

Running [0] against SMW master doesn't show any of the observed issues therefore closing it. In regards to the "Datatype and Protege imports" discussion, please open a new issue at [1].

[ 0 ] DumpRdfMaintenanceTest.php
[ 1 ] github.com issues