JSON Export of Wiki Keys (Key Start, Switch, Image Switch etc.)

From Biowikifarm Metawiki
Revision as of 16:47, 21 February 2013 by Andreas Plank (Talk | contribs) (Created page with "{{Ombox|text='''This is a draft version''' meant for discusion and improvement of exporting Wiki Key data to [http://www.json.org/ JSON]}} JSON structure expressing a ''sing...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


JSON structure expressing a single Wiki page with or without decisiontrees (=keys, Key Start, Switch, Image Switch etc.)

{
  "id":"Lamium_(Deutschland)",
  "url":"http://…/Lamium_(Deutschland)",
  "content":[
    {
    "_comment":"Notes: html is optional, occurs multiple times only if interrupted by switch, imageswitch or decisiontree. switch or imageswitch occur usually only once, decisiontree may more frequently occur multiple times. The sequence of such elements is unbounded, but usually low."
    },
    {
      "type":"html",
      "html":"<p>…</p>"
    },
    {
      "type":"switch",
      "fragment_id": "wiki-key-id",
      "metadata": {"creators":"…","parent_taxon":"…"},
      "decision": [{}],
      "_comment": "NOTE: switch or imageswitch allow only a single decision element; still put into array to simplify comparison with decisiontree, which usually has multiple decision elements."
    },
    {
      "type":"html",
      "html":"<p>…</p>"
    },
    {
      "type":"imageswitch",
      "fragment_id": "wiki-key-id",
      "metadata": {"creators":"…","parent_taxon":"…", "other parameter etc."},
      "decision": [{"see elaboration below"}]
    },
    {
      "type":"html",
      "html":"<p>…</p>"
    },
    {
      "type":"decisiontree",
      "fragment_id": "cult {{Key Start|id=\"cult\"}}",
      "metadata": {"creators":"…","parent_taxon":"…"},
      "decision": [{},{},{}]
    },
    {
      "type":"html",
      "html":"<p>…</p>"
    }
  ]
}

Elaboration of the decision object used above:

{"decision" : [
  {
    "decision_id":"Lamium_(Deutschland)_d1",
    "decision_code":"1 (=couplet id)",
    "alternative": [
      {
        "alt_id": "Lamium_(Deutschland)_d1_1",
        "alt_code": "** ('a', '-' or empty)",
        "statement" : "lead text",
        "next_code": "4",
        "next_id": "Lamium_(Deutschland)_d4",
        "result"
        "remarks"
        "description"
        "side_image" : [
          {
            "_comment" : "= image a to image e",
            "caption"  : "Bildunterschrift",
            "label" : "a",
            "url420px" :"http:",
            "url1000px":"http:",
            "custom_height":,
            "custom_width":,
            "custom_url": "= http-url of image scaled to custom height/width",
            "url_hires":"http:",
            "meta_url" : "http://offene-natu.../File:"
           },
          {
            "caption"  : "Bildunterschrift",
            "label" : "b",
            "url420px" :"http:",
            "url1000px":"http:",
            "custom_height": "",
            "custom_width":"",
            "custom_url":  "= http-url of image scaled to custom height/width",
            "url_hires":"http:",
            "meta_url" : "http://offene-natu.../File:"
           }
             ],
        "bottom_image" : [
          {
          "_comment" : "= image j to image k",
          "caption"  : "Bildunterschrift"
          }
          ],
        "extra_image" : [
          {
          "_comment" : "= image m to image r",
          "caption"  : "Bildunterschrift",
          }
        ],
      },
      {
      "NEXT ALTERNATIVE"
      },
      {
      "NEXT ALTERNATIVE"
      }      
    ]
  },
  {
    "NEXT DECISION"
  }
  ]
}