API Docs for: 0.6.0
Show:

File: src/end.js.part


    //// OTHER SOURCE FILES ARE CONCATENATED IN ABOVE
    //// STARTING WITH start.js.part

    // Set some variables used in return statement.
    globalGetSet = S.util.getset;
    globalDefaultsQuery = S.defaults.query;
    globalDefaultsChart = S.defaults.chart;


    // Test if a thing names sgvizler already exists.
    if (window.sgvizler) {
        throw new Error("Javascript module 'sgvizler' already exists.");
    }

    /**
     * The sgvizler javascript reveals properties (attributes) and methods
     * (functions) through the what in this documentation is known as the
     * class `sgvizler`. This is also why there is both a module and a
     * class called `sgvizler`. The other class which offers a public API
     * is the `sgvizler.Query` class. All other classes in the
     * documentation are private.
     *
     * Members which internally are "public", i.e., available to other
     * classes within the sgvizler package, are marked
     * `@protected`. Members which are only available within its class are
     * marked `@private`.
     *
     * @class sgvizler
     * @static
     **/
    window.sgvizler = {


        //////////////////////////////////
        // The following properties and methods are documented where
        // they are written.

        VERSION: S.core.VERSION,
        HOMEPAGE: S.core.HOMEPAGE,

        chartsAdd: S.charts.add,
        datatablesAdd: S.datatables.add,

        registryChartFunctions: S.registry.chartFunctions,

        namespacePrefixesSPARQL: S.namespace.prefixesSPARQL,
        namespacePrefixify: S.namespace.prefixify,
        namespaceUnprefixify: S.namespace.unprefixify,

        containerDraw: S.container.draw,
        containerDrawAll: S.container.drawAll,

        formDraw: S.form.draw,
        formSubmit: S.form.submit,
        formReset: S.form.reset,

        Query: S.Query,

        visualization: S.visualization, // TODO: hide util?
        datatable: S.datatable,


        // getters, setters. cascade pattern.

        /**
         * Get the namespace for a prefix.
         * @method prefix
         * @public
         * @param {string} prefix
         * @return {string} The namespace recorded for the given prefix.
         * @since 0.6.0
         **/
        /**
         * Set the prefix for a namespace.
         * @method prefix
         * @public
         * @param {string} prefix
         * @param {string} namespace
         * @chainable
         * @since 0.6.0
         **/
        prefix: function (prefix, namespace) {
            if (namespace !== undefined) {
                S.namespace.set(prefix, namespace);
            }
            return (namespace !== undefined) ? this : S.namespace.get(prefix);
        },

        /**
         * Get Base URL.
         * @method defaultBaseURL
         * @public
         * @return {string} Returns an empty string if base URL is not set.
         * @since 0.6.0
         **/
        /**
         * Set Base URL. 
         * @method defaultBaseURL
         * @public
         * @param {string} url
         * @chainable
         * @since 0.6.0
         **/
        baseURL: function (url) {
            if (url !== undefined) {
                S.namespace.setBaseURL(url);
            }
            return (url !== undefined) ? this : S.namespace.getBaseURL() || "";
        },

        /**
         * Get default query string.
         * @method defaultQuery
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set default query string.
         * @method defaultQuery
         * @public
         * @param {string} queryString
         * @chainable
         * @since 0.6.0
         **/
        defaultQuery: function (queryString) {
            return globalGetSet('query', queryString, globalDefaultsQuery, this);
        },

        /**
         * Get default list of FROMs set to be included in SPARQL query.
         * @method defaultFroms
         * @public
         * @return {Array} An array of strings.
         * @chainable
         * @since 0.6.0
         **/
        /**
         * Set default list of FROMs to be included in SPARQL query.
         * @method defaultFroms
         * @public
         * @param {Array} froms An array of strings.
         * @chainable
         * @since 0.6.0
         **/
        defaultFroms: function (froms) {
            var getset = globalGetSet('froms', froms, globalDefaultsQuery, this);
            if (getset !== this) {
                getset = getset.slice(0);
            }
            return getset;
        },

        /**
         * Get default endpoint URL.
         * @method defaultEndpointURL
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set default endpoint URL.
         * @method defaultEndpointURL
         * @public
         * @param {string} endpointURL
         * @chainable
         * @example
         *     sgvizler.defaultEndpointURL('http://sparql.dbpedia.org');
         *   sets the default endpoint to DBpedia's.
         * @since 0.6.0
         **/
        defaultEndpointURL: function (endpointURL) {
            return globalGetSet('endpoint', endpointURL, globalDefaultsQuery, this);
        },

        /**
         * Get default endpoint output format.
         * @method defaultEndpointOutputFormat
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set default endpoint output format. Legal values are `'xml'`, `'json'`, `'jsonp'`.
         * @method defaultEndpointOutputFormat
         * @public
         * @param {string} format
         * @chainable
         * @since 0.6.0
         **/
        defaultEndpointOutputFormat: function (format) {
            return globalGetSet('endpoint_output_format', format, globalDefaultsQuery, this);
        },

        // TODO
        defaultEndpointResultsURLPart: function (value) {
            return globalGetSet('endpoint_results_urlpart', value, globalDefaultsQuery, this);
        },

        /**
         * Get URL to online SPARQL query validator.
         * @method defaultValidatorURL
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set URL to online SPARQL query validator. Appending a
         * SPARQL query to the end of this URL should give a page
         * which validates the given query.
         * @method defaultValidatorURL
         * @public
         * @param {string} url
         * @chainable
         * @since 0.6.0
         **/
        defaultValidatorURL: function (url) {
            return globalGetSet('validator_url', url, globalDefaultsQuery, this);
        },

        // TODO
        defaultLogContainer: function (value) {
            return globalGetSet('logcontainer', value, globalDefaultsQuery, this);
        },
        // TODO

        /**
         * These are the java ones, taken from [the
         * javadocs](http://docs.oracle.com/javase/1.4.2/docs/api/java/util/logging/Level.html):
         *
         * Permissible values are:
         *
         *   - SEVERE (highest value)
         *   - WARNING
         *   - INFO
         *   - CONFIG
         *   - FINE
         *   - FINER
         *   - FINEST (lowest value)
         * @method defaultLoglevel
         */
        defaultLogLevel: function (value) {
            return globalGetSet('loglevel', value, globalDefaultsQuery, this);
        },

        /**
         * Get the name of the default datatable preprocessing
         * function.
         * @method defaultDatatableFunction
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set the name of the default datatable preprocessing function. The
         * function should be available in the global object, or
         * registered with dependencies in Sgvizler's registry;
         * see sgvizler.datatablesAdd()
         * @method defaultDatatableFunction
         * @public
         * @param {string} functionName
         * @chainable
         * @since 0.6.0
         **/
        defaultDatatableFunction: function (functionName) {
            return globalGetSet('datatable', functionName, globalDefaultsQuery, this);
        },

        /**
         * Get the name of the default chart function.
         * @method defaultChartFunction
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set the name of the default chart function. The
         * function should be availble in the global object, or
         * registered with dependencies in Sgvizler's registry;
         * see sgvizler.chartsAdd()
         * @method defaultChartFunction
         * @public
         * @param {string} functionName
         * @chainable
         * @since 0.6.0
         **/
        defaultChartFunction: function (functionName) {
            return globalGetSet('chart', functionName, globalDefaultsQuery, this);
        },

        /**
         * Get the default height of chart containers.
         * @method defaultChartHeight
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set the default height of chart containers.
         * @method defaultChartHeight
         * @public
         * @param {number} height
         * @chainable
         * @since 0.6.0
         **/
        defaultChartHeight: function (height) {
            return globalGetSet('height', height, globalDefaultsChart, this);
        },

        /**
         * Get the default width of chart containers.
         * @method defaultChartWidth
         * @public
         * @return {string}
         * @since 0.6.0
         **/
        /**
         * Set the default width of chart containers.
         * @method defaultChartWidth
         * @public
         * @param {number} width
         * @chainable
         * @since 0.6.0
         **/
        defaultChartWidth: function (width) {
            return globalGetSet('width', width, globalDefaultsChart, this);
        },

        /**
         * TODO
         * @method defaultChartSpecificOption
         * @public
         * @chainable
         * @since 0.6.0
         **/
        defaultChartSpecificOption: function (chart, option, value) {
            S.defaults.setChartSpecificOption(chart, option, value);
            return this;
        }
    };

    jQuery.ajaxSetup(
        {
            cache: true,
            accepts: {
                xml:   "application/sparql-results+xml",
                json:  "application/sparql-results+json",
                jsonp: "application/sparql-results+json"
            }
        }
    );

}(window));