Semanticmediawiki: </rdf:RDF> closing tag is missing in file exported from dump颅RDF.php

Created on 17 Nov 2019  路  10Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.1.0
  • MW version: 1.33.0
  • PHP version: 7.3.11
  • MySQL version: 5.6.45-86.1

Issue

</rdf:RDF> closing tag is missing in file file exported from dump颅RDF.php.

Example

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF[
    <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
    <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
    <!ENTITY owl 'http://www.w3.org/2002/07/owl#'>
    <!ENTITY swivt 'http://semantic-mediawiki.org/swivt/1.0#'>
    <!ENTITY wiki 'http://wikincat.org/wiki/Special:URIResolver/'>
    <!ENTITY category 'http://wikincat.org/wiki/Special:URIResolver/Category-3A'>
    <!ENTITY property 'http://wikincat.org/wiki/Special:URIResolver/Property-3A'>
    <!ENTITY wikiurl '//wikincat.org/wiki/'>
]>

<rdf:RDF
    xmlns:rdf="&rdf;"
    xmlns:rdfs="&rdfs;"
    xmlns:owl ="&owl;"
    xmlns:swivt="&swivt;"
    xmlns:wiki="&wiki;"
    xmlns:category="&category;"
    xmlns:property="&property;">

    <owl:Ontology>
        <swivt:creationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-11-17T20:34:25+00:00</swivt:creationDate>
        <owl:imports rdf:resource="http://semantic-mediawiki.org/swivt/1.0"/>
    </owl:Ontology>
    <swivt:Subject rdf:about="...">
    ...
    </swivt:Subject>

Steps to reproduce

Run dump颅RDF.php and open the file in a browser as xml (the browser will complain about the missing closing tag).

bug

Most helpful comment

@mwjames This should probably be back-ported?

The root cause has been in the code since (I think) SMW 1.8 but that never popped up because we had no tests that would strive this "edge" case and above was just a coincidence that it appeared in connection with an predefined property alias, some property description (as monolingual text that is represented as sub-entity hereby strives the edge), and some unresolved references.

All 10 comments

I just have seen the log and it says:

Writing OWL/RDF dump to sub/rdf/wikincat.rdf ...
[7598a286a45461d8e3b6da82] [no req]   SMW\Exception\SubSemanticDataException from line 206 of w/extensions/SemanticMediaWiki/src/DataModel/SubSemanticData.php: Data for a subobject of Media_type cannot be added to Has_media_type.
Backtrace:
#0 w/extensions/SemanticMediaWiki/includes/SemanticData.php(814): SMW\DataModel\SubSemanticData->addSubSemanticData(SMW\SQLStore\EntityStore\StubSemanticData)
#1 w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/StubSemanticData.php(404): SMW\SemanticData->addSubSemanticData(SMW\SQLStore\EntityStore\StubSemanticData)
#2 w/extensions/SemanticMediaWiki/src/SQLStore/EntityStore/StubSemanticData.php(202): SMW\SQLStore\EntityStore\StubSemanticData->initSubSemanticData(SMW\DIProperty)
#3 w/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php(158): SMW\SQLStore\EntityStore\StubSemanticData->getSubSemanticData()
#4 w/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php(567): SMWExportController->serializePage(SMW\DIWikiPage, integer)
#5 w/extensions/SemanticMediaWiki/includes/export/SMW_ExportController.php(516): SMWExportController->printAll(boolean, integer, integer)
#6 w/extensions/SemanticMediaWiki/maintenance/dumpRDF.php(174): SMWExportController->printAllToFile(string, boolean, integer, integer)
#7 w/extensions/SemanticMediaWiki/maintenance/dumpRDF.php(108): SMW\Maintenance\DumpRdf->exportRdfToOutputChannel()
#8 w/maintenance/doMaintenance.php(96): SMW\Maintenance\DumpRdf->execute()
#9 w/extensions/SemanticMediaWiki/maintenance/dumpRDF.php(188): require_once(string)
#10 {main}

Maybe </rdf:RDF> is missing because of this.

Data for a subobject of Media_type cannot be added to Has_media_type.

I think this issue was afecting only me by a mixture of:

So I removed the "allowed values" from my Has Media type property, rebuild the data and then dump颅RDF.php worked fine.

Somehow Has Media type (note the uppercase M, my local property) was interfering to Has media type (the alias to SMW Media type special property).

I am closing this because I think it was affecting only me, in a too specific use case.

[0] http://www.rdaregistry.info/Elements/u/#P60050 ("Has media type" imported from external vocabulary).
[1] https://wikincat.org/w/index.php?title=Property%3AHas_Media_type&type=revision&diff=17248&oldid=14629

Somehow Has Media type (note the uppercase M, my local property) was
interfering to Has media type (the alias to SMW Media type special
property).

I am closing this because I think it was affecting only me, in a too
specific use case.

This is a legit issue which has been dormant since the inception of
the RDF exporter.

It relates to predefined property aliases being exported as individual
entities and not as representation of the canonical property with that
it creates a situation where subobject assignments (i.e. could be
something like a property description or preferred property label
which are all represented as subobject to a canonical property) aren't
resolved correctly and eventually will fail with the reported
exception.

The exception thrown at the shown point is correct.

Suggested actions

  • Create an integration test that fails
  • Propose a fix (PS: the fix is simple but it wouldn't be an
    educational exercise if I spoil the fun here)
  • Verify that the previous failed test does pass after applying the fix

On 11/20/19, Jaider Andrade Ferreira notifications@github.com wrote:

I think this issue was afecting only me by a mixture of:

>

>

So I removed the "allowed values" from my Has Media type property,
rebuild the
data

and then dump颅RDF.php worked fine.

>

Somehow Has Media type (note the uppercase M, my local property) was
interfering to Has media type (the alias to SMW Media type special
property).

>

I am closing this because I think it was affecting only me, in a too
specific use case.

>

[0] http://www.rdaregistry.info/Elements/u/#P60050 ("Has media type"
imported from external vocabulary).

[1]
https://wikincat.org/w/index.php?title=Property%3AHas_Media_type&type=revision&diff=17248&oldid=14629

>

--

You are receiving this because you are subscribed to this thread.

Reply to this email directly or view it on GitHub:

https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/4356#issuecomment-555738792

Create an integration test that fails

Is it possible to create a JSON test that tests an error in the command line? I saw the docs and I did not find one.
I mean, the backtrace above only shows up in the console when I run dumpRDF.php.

Is it possible to create a JSON test that tests an error in the command line? I saw the docs and I did not find one.
I mean, the backtrace above only shows up in the console when I run dumpRDF.php.

[0] contains an example on how to test dumpRDF.php output.

            "type": "rdf",
            "about": "#0 (canonical `Display precision of` representation)",
            "dumpRDF": {
                "parameters": {
                    "page": "Property:Display precision of"
                }
            },
            "assert-output": {
                "to-contain": [
                    "<owl:Ontology rdf:about=\".*/Property-3ADisplay-2Bprecision-2Bof\">",

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/4391/files

@mwjames This should probably be back-ported?

@mwjames This should probably be back-ported?

The root cause has been in the code since (I think) SMW 1.8 but that never popped up because we had no tests that would strive this "edge" case and above was just a coincidence that it appeared in connection with an predefined property alias, some property description (as monolingual text that is represented as sub-entity hereby strives the edge), and some unresolved references.

Thanks for the info. I was not sure if we were talking about a recent regression. Ok, part of SMW 3.2.0 :)

Just to confirm: it's fixed. :+1:
Thanks, James.

Was this page helpful?
0 / 5 - 0 ratings