MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Spec_1.1_Errata",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "7555": {
                "pageid": 7555,
                "ns": 0,
                "title": "SaveMap",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "Saves the current map to a file. The image file should be saved with the correct name. It should match our image file: same dimensions, same cities, same colors, same partitions, etc. Roads should be drawn as black (java.awt.Color.BLACK) line segments. Everything else from Part 1 will be the same (e.g. Cities should be drawn as black (java.awt.Color.BLACK) named points) with one exception: '''To differentiate from Roads, quadtree partitions should now be gray (java.awt.Color.GRAY) crosses.'''\n\n== Parameters ==\n* name (filename to save the image to)\n\n== Possible ''<output>'' ==\n* (None)\n\n== Possible ''<error>'' types ==\n* (None)\n\n== ''<success>'' Example ==\n<code>\n    <success>\n        <command name=\"saveMap\" id=\"6\"/>\n        <parameters>\n            <name value=\"map_1\"/>\n        </parameters>\n        <output/>\n    </success>\n</code>"
                    }
                ]
            },
            "7565": {
                "pageid": 7565,
                "ns": 0,
                "title": "ShortestPath",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "Prints the shortest path and direction traveled (from the perspective of someone driving down the current road) between the cities named by the '''start''' and '''end''' attributes, where the length of the road is the Euclidean distance between the cities. Success is reported if such a path exists. (Generally we will only test this on connected graphs; we may test on disconnected graphs for extra credit later, however). The <success> element in response to this command is empty and has no '''message''' attribute. It has one child element, <path>, which itself has a sequence of road and direction elements (<right/>, <left/>, and <straight/>) as children. The <path> element has two attributes which must be set: '''length''', which reports the double precision length of the total path, rounded to 3 decimal places, and '''hops''' which indicates the number of unique '''edges''' traveled to get from the start to the end.\n\nTo make things more fun, we are going to use CanvasPlus sometimes when calling shortestPath. If a saveMap attribute is present, you need to create a new CanvasPlus object containing the shortestPath and save it to an image file with the value of the saveMap attribute. Here\u2019s what the shortest path should look like: You should include a black rectangle for the bounds of the spatial map just like in saveMap. All cities and roads contained by the path should be in this visual map. The start point should be green (java.awt.Color.GREEN). The end point should be red (java.awt.Color.RED). All cities in between and all connecting roads should be blue (java.awt.Color.BLUE). Since the customer doesn\u2019t care about how the spatial map is stored, we don\u2019t need to see the rest of the spatial map (partitions and other cities and roads). To reiterate, to keep it simple, just create a new CanvasPlus object and include on the cities and roads on the path. Lastly, remember to dispose of the CanvasPlus object when you are done with it.\n\nFinally, to make things even make things even more fun, we are going to turn your shortestPath output into readable HTML. If a saveHTML attribute is present, you follow the same steps you did with the saveMap attribute instructions, but now name it the value of the saveHTML attribute. You need to do this because the HTML document will need your shortestPath image and your success node. But don\u2019t worry about any extra work here, it\u2019s all pretty much been done for you. First of all we need to make a new Document object and make a copy of our success node since it belongs to our results document. Then we just need to transform the XML using an XSLT (eXtensible Stylesheet Language Transformations\u2013don\u2019t worry if you\u2019ve never heard of this) file that I wrote into a pretty HTML document. Since Java\u2019s XML outputter prints attributes in alphabetical order it can be confusing to read them so hopefully this will make it easier for you to test your Dijkstra classes. The code for you to do this is below (and the XSLT file should be in the newest iteration of the JAR file):\n<code>\n    org.w3c.dom.Document shortestPathDoc = XmlUtility.getDocumentBuilder().newDocument();\n    org.w3c.dom.Node spNode = shortestPathDoc.importNode(successNode, true);\n    shortestPathDoc.appendChild(spNode);\n    XmlUtility.transform(shortestPathDoc, new File(\"shortestPath.xsl\"), new File(saveHTMLName + \".html\"));\n</code>\nNote that both saveMap and saveHTML attributes could be present without a conflict, instead, two image files and an HTML file would be produced. As always, examples will be provided.\n\n== Parameters (In output order) ==\n* start\n* end\n\n== Possible ''<output>'' ==\nA <path> tag with attributes length, hops will be contained in output and will contain 1 <road> tag, followed by zero or more sequences of a direction element followed by a road element. These should be in the order of the path taken and will appear as follows:\n<code>\n    <road start=\"road1\" end=\"road2\"/>\n</code>\n\n== Possible ''<error>'' types (In priority order) ==\n* nonExistentStart\n* nonExistentEnd\n* noPathExists\n\n== ''<success>'' Example ==\n<code>\n    <success>\n        <command name=\"shortestPath\" id=\"15\">\n        <parameters>\n            <start value=\"Annapolis\"/>\n            <end value=\"Derwood\"/>\n        </parameters>\n        <output>\n            <path length=\"12.000\" hops=\"4\">\n                <road start=\"Annapolis\" end=\"Bowie\"/>\n                <left/>\n                <road start=\"Bowie\" end=\"Washington\"/>\n                <right/>\n                <road start=\"Washington\" end=\"Bethesda\"/>\n                <straight/>\n                <road start=\"Bethesda\" end=\"Derwood\"/>\n            </path>\n        </output>\n    </success>\n</code>"
                    }
                ]
            }
        }
    }
}