https://bugzilla.wikimedia.org/show_bug.cgi?id=44696

--- Comment #13 from MWJames <[email protected]> ---
(In reply to comment #11)
> Hi James, what was the reference for?  BTW, I'm afraid I'm not qualified to
> hack on the wiki code myself.

It will give some insights in how serialization works in SMW works and why [1]
wasn't a fit as it only eliminates a possible tag parameter at the head by
replacing  

$results[$diWikiPage->getTitle()->getFullText()] = $result;
with
$results[] = $result;

This solves the issue half way because if you happen to use a property like
"Has_xml'_label" and use it as printout parameter, it would face the same
problem but at this level you need to know to which printout you are referring
since it a reference key to the printrequests array .

While the subject "tag" at the head might seem as information redundancy (it
isn't but that's not the issue of this discussion), you clearly can't get away
by eliminating the property label from the structure as it is used as key for
the a purpose to eliminate redundancy by splitting printrequest and result
information.

XML (pretty-print) output

<?xml version="1.0"?>
<api>
  <query>
    <printrequests>
      <printrequest label="" typeid="_wpg" mode="2" format="" />
      <printrequest label="Has date" typeid="_dat" mode="1" format="ISO" />
      <printrequest label="Has xml" typeid="_wpg" mode="1" format="" />
      <printrequest label="Has xml&#039; label" typeid="_wpg" mode="1"
format="" />
    </printrequests>
    <results>
      <XML_Example fulltext="XML Example" fullurl=".." namespace="0"
exists="1">
        <printouts>
          <Has_date>
            <value>631152000</value>
          </Has_date>
          <Has_xml>
            <value fulltext="Test" fullurl=".." namespace="0" exists="" />
          </Has_xml>
          <Has_xml'_label>
            <value fulltext="Test" fullurl=".." namespace="0" exists="" />
          </Has_xml'_label>
        </printouts>
      </XML_Example>
    </results>
    <meta hash="d3a1a814ff424003d9cfaa9a3ab7221f" count="1" offset="0" />
  </query>
</api>

JSON (pretty-print) output

{
    "query": {
        "printrequests": [
            {
                "label": "",
                "typeid": "_wpg",
                "mode": 2,
                "format": false
            },
            {
                "label": "Has date",
                "typeid": "_dat",
                "mode": 1,
                "format": "ISO"
            },
            {
                "label": "Has xml",
                "typeid": "_wpg",
                "mode": 1,
                "format": ""
            },
            {
                "label": "Has xml' label",
                "typeid": "_wpg",
                "mode": 1,
                "format": ""
            }
        ],
        "results": {
            "XML Example": {
                "printouts": {
                    "Has date": [
                        "631152000"
                    ],
                    "Has xml": [
                        {
                            "fulltext": "Test",
                            "fullurl": "...",
                            "namespace": 0,
                            "exists": false
                        }
                    ],
                    "Has xml' label": [
                        {
                            "fulltext": "Test",
                            "fullurl": "...",
                            "namespace": 0,
                            "exists": false
                        }
                    ]
                },
                "fulltext": "XML Example",
                "fullurl": "...",
                "namespace": 0,
                "exists": true
            }
        },
        "meta": {
            "hash": "d3a1a814ff424003d9cfaa9a3ab7221f",
            "count": 1,
            "offset": 0
        }
    }
}

[1] https://gerrit.wikimedia.org/r/#/c/47707/

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to