You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/11/05 11:52:30 UTC

[25/52] [partial] Reverting the erroneous merge by Sebastian according to the instructions in INFRA-6876

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/extras/webjars/snorql/src/main/resources/snorql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/snorql.js b/extras/webjars/snorql/src/main/resources/snorql.js
new file mode 100755
index 0000000..b1346de
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/snorql.js
@@ -0,0 +1,596 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var snorql = new Snorql();
+
+String.prototype.trim = function () {
+    return this.replace(/^\s*/, "").replace(/\s*$/, "");
+}
+
+String.prototype.startsWith = function(str) {
+	return (this.match("^"+str) == str);
+}
+
+function Snorql() {
+    // modify this._endpoint to point to your SPARQL endpoint
+    this._endpoint = _BASIC_URL + 'sparql/select';
+    // modify these to your liking
+    this._poweredByLink = 'http://marmotta.incubator.apache.org';
+    this._poweredByLabel = 'Snorql & Apache Marmotta';
+    this._enableNamedGraphs = false;
+
+    this._browserBase = null;
+    this._namespaces = {};
+    this._graph = null;
+    this._xsltDOM = null;
+
+    this.start = function() {
+        // TODO: Extract a QueryType class
+        this.setBrowserBase(document.location.href.replace(/\?.*/, ''));
+        this._displayEndpointURL();
+        //this._displayPoweredBy();
+        this.updateOutputMode();
+        var match = document.location.href.match(/\?(.*)/);
+        var queryString = match ? match[1] : '';
+        if (!queryString) {
+            document.getElementById('querytext').value = 'SELECT * WHERE {\n  ?s ?p ?o\n}\nLIMIT 10';
+            this._updateGraph(null, false);
+            return;
+        }
+        
+        var graph = queryString.match(/graph=([^&]*)/);
+        graph = graph ? decodeURIComponent(graph[1]) : null;
+        this._updateGraph(graph, false);
+        
+        var browse = queryString.match(/browse=([^&]*)/);
+        if (browse) {
+	        if (browse[1] == 'classes') {
+	            var resultTitle = 'List of all classes:';
+	            var query = 'SELECT DISTINCT ?class\n' +
+	                    'WHERE { [] a ?class }\n' +
+	                    'ORDER BY ?class';
+	        } else if (browse[1] == 'properties') {
+	            var resultTitle = 'List of all properties:';
+	            var query = 'SELECT DISTINCT ?property\n' +
+	                    'WHERE { [] ?property [] }\n' +
+	                    'ORDER BY ?property';
+	        } else if (browse[1] == 'graphs') {
+	            var resultTitle = 'List of all named graphs:';
+	            var query = 'SELECT DISTINCT ?namedgraph ?label\n' +
+	                    'WHERE {\n' +
+	                    '  GRAPH ?namedgraph { ?s ?p ?o }\n' +
+	                    '  OPTIONAL { ?namedgraph rdfs:label ?label }\n' +
+	                    '}\n' +
+	                    'ORDER BY ?namedgraph';
+	        }
+        }
+        
+        var properties = queryString.match(/property=([^&]*)/);
+        if (properties) {
+            var resultTitle = 'All uses of property ' + decodeURIComponent(properties[1]) + ':';
+            var query = 'SELECT DISTINCT ?resource ?value\n' +
+                    'WHERE { ?resource <' + decodeURIComponent(properties[1]) + '> ?value }\n' +
+                    'ORDER BY ?resource ?value';
+        }
+        
+        var classes = queryString.match(/class=([^&]*)/);
+        if (classes) {
+            var resultTitle = 'All instances of class ' + decodeURIComponent(classes[1]) + ':';
+            var query = 'SELECT DISTINCT ?instance\n' +
+                    'WHERE { ?instance a <' + decodeURIComponent(classes[1]) + '> }\n' +
+                    'ORDER BY ?instance';
+        }
+        
+        var describe = queryString.match(/describe=([^&]*)/);
+        if (describe) {
+            var resultTitle = 'Description of ' + decodeURIComponent(describe[1]) + ':';
+            var query = 'SELECT DISTINCT ?property ?hasValue ?isValueOf\n' +
+                    'WHERE {\n' +
+                    '  { <' + decodeURIComponent(describe[1]) + '> ?property ?hasValue }\n' +
+                    '  UNION\n' +
+                    '  { ?isValueOf ?property <' + decodeURIComponent(describe[1]) + '> }\n' +
+                    '}\n' +
+                    'ORDER BY (!BOUND(?hasValue)) ?property ?hasValue ?isValueOf';
+        }
+        
+        var queryMatch = queryString.match(/query=([^&]*)/);
+        if (queryMatch) {
+        	var resultTitle = 'SPARQL results:';
+        	var query = this._betterUnescape(queryMatch[1]);
+        
+        }
+        
+        var prefixes = this._getPrefixes();
+        if (queryString.match(/prefixes=/)) {
+        	prefixes = this._betterUnescape(queryString.match(/prefixes=([^&]*)/)[1]);
+        }
+        
+        var querytext = prefixes + " " + query;
+        document.getElementById('querytext').value = query;
+        this.displayBusyMessage();
+        var service = new SPARQL.Service(this._endpoint);
+        if (this._graph) {
+            service.addDefaultGraph(this._graph);
+        }
+
+        // AndyL changed MIME type and success callback depending on query form...
+        var dummy = this;
+
+   	    var exp = /^\s*(?:PREFIX\s+\w*:\s+<[^>]*>\s*)*(\w+)\s*.*/i;
+   	    var match = exp.exec(query);
+   	    if (match) {
+	        if (match[1].toUpperCase() == 'ASK') {
+	        	service.setOutput('boolean');
+	        	var successFunc = function(value) {
+	                dummy.displayBooleanResult(value, resultTitle);
+	            };
+	        } else if (match[1].toUpperCase() == 'CONSTRUCT' || match[1].toUpperCase() == 'DESCRIBE'){ // construct describe
+	    		service.setOutput('rdf'); // !json
+	    		var successFunc = function(model) {
+	                dummy.displayRDFResult(model, resultTitle);
+	            };
+	        } else {
+	        	service.setRequestHeader('Accept', 'application/sparql-results+json,*/*');
+	        	service.setOutput('json');
+	        	var successFunc = function(json) {
+	        		dummy.displayJSONResult(json, resultTitle);
+	        	};
+	        }
+   	    }
+
+        service.query(querytext, {
+            success: successFunc,
+            failure: function(report) {
+                var message = report.responseText.match(/<pre>([\s\S]*)<\/pre>/);
+                if (message) {
+                    dummy.displayErrorMessage(message[1]);
+                } else {
+                    dummy.displayErrorMessage(report.responseText);
+                }
+            }
+        });
+    }
+
+    this.setBrowserBase = function(url) {
+        this._browserBase = url;
+    }
+
+    this._displayEndpointURL = function() {
+    	var title = document.createElement("span");
+    	title.innerHTML = 'Querying <a href="' + this._endpoint + '">' + this._endpoint + '</a>';
+        this._display(title, 'title');
+        document.title = "Querying " + this._endpoint;
+    }
+
+    this._displayPoweredBy = function() {
+        $('poweredby').href = this._poweredByLink;
+        $('poweredby').update(this._poweredByLabel);
+    }
+
+    this.setNamespaces = function(namespaces) {
+        this._namespaces = namespaces;
+        var prefixes = this._getPrefixes();
+        document.getElementById('prefixes').value = prefixes;
+        this._display(document.createTextNode(prefixes), 'prefixestext');
+    }
+
+    this.switchToGraph = function(uri) {
+        this._updateGraph(uri, true);
+    }
+
+    this.switchToDefaultGraph = function() {
+        this._updateGraph(null, true);
+    }
+
+    this._updateGraph = function(uri, effect) {
+        if (!this._enableNamedGraphs) {
+            $('default-graph-section').hide();
+            $('named-graph-section').hide();
+            $('browse-named-graphs-link').hide();
+            return;
+        }
+        var changed = (uri != this._graph);
+        this._graph = uri;
+        var el = document.getElementById('graph-uri');
+        el.disabled = (this._graph == null);
+        el.value = this._graph;
+        if (this._graph == null) {
+            var show = 'default-graph-section';
+            var hide = 'named-graph-section';
+            $$('a.graph-link').each(function(link) {
+                match = link.href.match(/^(.*)[&?]graph=/);
+                if (match) link.href = match[1];
+            });
+        } else {
+            var show = 'named-graph-section';
+            var hide = 'default-graph-section';
+            $('selected-named-graph').update(this._graph);
+            var uri = this._graph;
+            $$('a.graph-link').each(function(link) {
+                match = link.href.match(/^(.*)[&?]graph=/);
+                if (!match) link.href = link.href + '&graph=' + uri;
+            });
+        }
+        $(hide).hide();
+        $(show).show();
+        if (effect && changed) {
+            new Effect.Highlight(show,
+                {startcolor: '#ffff00', endcolor: '#ccccff', resotrecolor: '#ccccff'});
+        }
+        $('graph-uri').disabled = (this._graph == null);
+        $('graph-uri').value = this._graph;
+    }
+
+    this.updateOutputMode = function() {
+        if (this._xsltDOM == null) {
+            this._xsltDOM = document.getElementById('xsltinput');
+        }
+        var el = document.getElementById('xsltcontainer');
+        while (el.childNodes.length > 0) {
+            el.removeChild(el.firstChild);
+        }
+        if (this._selectedOutputMode() == 'xslt') {
+            el.appendChild(this._xsltDOM);
+        }
+    }
+
+    this.resetQuery = function() {
+        document.location = this._browserBase;
+    }
+
+    this.submitQuery = function() {
+        var mode = this._selectedOutputMode();
+        if (mode == 'browse') {
+            document.getElementById('queryform').action = this._browserBase;
+        } else {
+            document.getElementById('queryform').action = this._endpoint;
+        }
+        document.getElementById('query').value = document.getElementById('querytext').value;
+        document.getElementById('jsonoutput').disabled = (mode != 'json');
+        if(mode == 'html') {
+           document.getElementById('jsonoutput').disabled = false;
+           document.getElementById('jsonoutput').value = 'html';
+        } else if(mode == 'csv') {
+            document.getElementById('jsonoutput').disabled = false;
+            document.getElementById('jsonoutput').value = 'csv';
+        } else if(mode == 'xml') {
+            document.getElementById('jsonoutput').disabled = false;
+            document.getElementById('jsonoutput').value = 'xml';
+        } else {
+           document.getElementById('jsonoutput').value = 'json';
+        }
+        document.getElementById('stylesheet').disabled = (mode != 'xslt' || !document.getElementById('xsltstylesheet').value);
+        if (mode == 'xslt') {
+            document.getElementById('stylesheet').value = document.getElementById('xsltstylesheet').value;
+        }
+        document.getElementById('queryform').submit();
+    }
+
+    this.displayBusyMessage = function() {
+        var busy = document.createElement('div');
+        busy.className = 'busy';
+        busy.appendChild(document.createTextNode('Executing query ...'));
+        this._display(busy, 'result');
+    }
+
+    this.displayErrorMessage = function(message) {
+        var pre = document.createElement('pre');
+        var json = JSON.parse(message);
+        if(json.message) {
+            pre.innerHTML = '<strong style="color: #ff0000">' + json.message; + "</strong>";
+        } else {
+            pre.innerHTML = message;
+        }
+        this._display(pre, 'result');
+    }
+
+    this.displayBooleanResult = function(value, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        if (value)
+        	div.appendChild(document.createTextNode("TRUE"));
+        else
+        	div.appendChild(document.createTextNode("FALSE"));
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result
+    }
+    
+    this.displayRDFResult = function(model, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        div.appendChild(new RDFXMLFormatter(model));
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result - necessary for boolean?
+    }
+
+    this.displayCSVResult = function(model, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        div.appendChild(new RDFCSVFormatter(model));
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result - necessary for boolean?
+    }
+
+    this.displayJSONResult = function(json, resultTitle) {
+        var div = document.createElement('div');
+        var title = document.createElement('h2');
+        title.appendChild(document.createTextNode(resultTitle));
+        div.appendChild(title);
+        if (json.results.bindings.length == 0) {
+            var p = document.createElement('p');
+            p.className = 'empty';
+            p.appendChild(document.createTextNode('[no results]'));
+            div.appendChild(p);
+        } else {
+            div.appendChild(new SPARQLResultFormatter(json, this._namespaces).toDOM());
+        }
+        this._display(div, 'result');
+        this._updateGraph(this._graph); // refresh links in new result
+    }
+
+    this._display = function(node, whereID) {
+        var where = document.getElementById(whereID);
+        if(whereID=='result')where.style.display='block';
+        if (!where) {
+            alert('ID not found: ' + whereID);
+            return;
+        }
+        while (where.firstChild) {
+            where.removeChild(where.firstChild);
+        }
+        if (node == null) return;
+        where.appendChild(node);
+    }
+
+    this._selectedOutputMode = function() {
+        return document.getElementById('selectoutput').value;
+    }
+
+    this._getPrefixes = function() {
+        prefixes = '';
+        for (prefix in this._namespaces) {
+            var uri = this._namespaces[prefix];
+            prefixes = prefixes + 'PREFIX ' + prefix + ': <' + uri + '>\n';
+        }
+        return prefixes;
+    }
+
+    this._betterUnescape = function(s) {
+        return unescape(s.replace(/\+/g, ' '));
+    }
+}
+
+/*
+ * RDFXMLFormatter
+ * 
+ * maybe improve...
+ */
+function RDFXMLFormatter(string) {
+	var pre = document.createElement('pre');
+	pre.appendChild(document.createTextNode(string));
+	return pre;
+}
+
+function RDFCSVFormatter(string) {
+    var pre = document.createElement('pre');
+    pre.appendChild(document.createTextNode(string));
+    return pre;
+}
+
+
+/*
+===========================================================================
+SPARQLResultFormatter: Renders a SPARQL/JSON result set into an HTML table.
+
+var namespaces = { 'xsd': '', 'foaf': 'http://xmlns.com/foaf/0.1' };
+var formatter = new SPARQLResultFormatter(json, namespaces);
+var tableObject = formatter.toDOM();
+*/
+function SPARQLResultFormatter(json, namespaces) {
+    this._json = json;
+    this._variables = this._json.head.vars;
+    this._results = this._json.results.bindings;
+    this._namespaces = namespaces;
+
+    this.toDOM = function() {
+        var table = document.createElement('table');
+        table.className = 'queryresults';
+        table.appendChild(this._createTableHeader());
+        for (var i = 0; i < this._results.length; i++) {
+            table.appendChild(this._createTableRow(this._results[i], i));
+        }
+        return table;
+    }
+
+    // TODO: Refactor; non-standard link makers should be passed into the class by the caller
+    this._getLinkMaker = function(varName) {
+        if (varName == 'property') {
+            return function(uri) { return '?property=' + encodeURIComponent(uri); };
+        } else if (varName == 'class') {
+            return function(uri) { return '?class=' + encodeURIComponent(uri); };
+        } else {
+            return function(uri) { return '?describe=' + encodeURIComponent(uri); };
+        }
+    }
+
+    this._createTableHeader = function() {
+        var tr = document.createElement('tr');
+        var hasNamedGraph = false;
+        for (var i = 0; i < this._variables.length; i++) {
+            var th = document.createElement('th');
+            th.appendChild(document.createTextNode(this._variables[i]));
+            tr.appendChild(th);
+            if (this._variables[i] == 'namedgraph') {
+                hasNamedGraph = true;
+            }
+        }
+        if (hasNamedGraph) {
+            var th = document.createElement('th');
+            th.appendChild(document.createTextNode(' '));
+            tr.insertBefore(th, tr.firstChild);
+        }
+        return tr;
+    }
+
+    this._createTableRow = function(binding, rowNumber) {
+        var tr = document.createElement('tr');
+        if (rowNumber % 2) {
+            tr.className = 'odd';
+        } else {
+            tr.className = 'even';
+        }
+        var namedGraph = null;
+        for (var i = 0; i < this._variables.length; i++) {
+            var varName = this._variables[i];
+            td = document.createElement('td');
+            td.appendChild(this._formatNode(binding[varName], varName));
+            tr.appendChild(td);
+            if (this._variables[i] == 'namedgraph') {
+                namedGraph = binding[varName];
+            }
+        }
+        if (namedGraph) {
+            var link = document.createElement('a');
+            link.href = 'javascript:snorql.switchToGraph(\'' + namedGraph.value + '\')';
+            link.appendChild(document.createTextNode('Switch'));
+            var td = document.createElement('td');
+            td.appendChild(link);
+            tr.insertBefore(td, tr.firstChild);
+        }
+        return tr;
+    }
+
+    this._formatNode = function(node, varName) {
+        if (!node) {
+            return this._formatUnbound(node, varName);
+        }
+        if (node.type == 'uri') {
+            return this._formatURI(node, varName);
+        }
+        if (node.type == 'bnode') {
+            return this._formatBlankNode(node, varName);
+        }
+        if (node.type == 'literal') {
+            return this._formatPlainLiteral(node, varName);
+        }
+        if (node.type == 'typed-literal') {
+            return this._formatTypedLiteral(node, varName);
+        }
+        return document.createTextNode('???');
+    }
+
+    this._formatURI = function(node, varName) {
+        var span = document.createElement('span');
+        span.className = 'uri';
+        var a = document.createElement('a');
+        a.href = this._getLinkMaker(varName)(node.value);
+        a.title = '<' + node.value + '>';
+        a.className = 'graph-link';
+        var qname = this._toQName(node.value);
+        if (qname) {
+            a.appendChild(document.createTextNode(qname));
+            span.appendChild(a);
+        } else {
+            a.appendChild(document.createTextNode(node.value));
+            span.appendChild(document.createTextNode('<'));
+            span.appendChild(a);
+            span.appendChild(document.createTextNode('>'));
+        }
+        match = node.value.match(/^(https?|ftp|mailto|irc|gopher|news):/);
+        if (match) {
+            span.appendChild(document.createTextNode(' '));
+            var externalLink = document.createElement('a');
+            externalLink.href = node.value;
+            img = document.createElement('img');
+            img.src = 'link.png';
+            img.alt = '[' + match[1] + ']';
+            img.title = 'Go to URI directly';
+            externalLink.appendChild(img);
+            span.appendChild(externalLink);
+        }
+        return span;
+    }
+
+    this._formatPlainLiteral = function(node, varName) {
+        var text = '"' + node.value + '"';
+        if (node['xml:lang']) {
+            text += '@' + node['xml:lang'];
+        }
+        return document.createTextNode(text);
+    }
+
+    this._formatTypedLiteral = function(node, varName) {
+        var text = '"' + node.value + '"';
+        if (node.datatype) {
+            text += '^^' + this._toQNameOrURI(node.datatype);
+        }
+        if (this._isNumericXSDType(node.datatype)) {
+            var span = document.createElement('span');
+            span.title = text;
+            span.appendChild(document.createTextNode(node.value));
+            return span;
+        }
+        return document.createTextNode(text);
+    }
+
+    this._formatBlankNode = function(node, varName) {
+        return document.createTextNode('_:' + node.value);
+    }
+
+    this._formatUnbound = function(node, varName) {
+        var span = document.createElement('span');
+        span.className = 'unbound';
+        span.title = 'Unbound'
+        span.appendChild(document.createTextNode('-'));
+        return span;
+    }
+
+    this._toQName = function(uri) {
+        for (prefix in this._namespaces) {
+            var nsURI = this._namespaces[prefix];
+            if (uri.indexOf(nsURI) == 0) {
+                return prefix + ':' + uri.substring(nsURI.length);
+            }
+        }
+        return null;
+    }
+
+    this._toQNameOrURI = function(uri) {
+        var qName = this._toQName(uri);
+        return (qName == null) ? '<' + uri + '>' : qName;
+    }
+
+    this._isNumericXSDType = function(datatypeURI) {
+        for (i = 0; i < this._numericXSDTypes.length; i++) {
+            if (datatypeURI == this._xsdNamespace + this._numericXSDTypes[i]) {
+                return true;
+            }
+        }
+        return false;
+    }
+    this._xsdNamespace = 'http://www.w3.org/2001/XMLSchema#';
+    this._numericXSDTypes = ['long', 'decimal', 'float', 'double', 'int',
+        'short', 'byte', 'integer', 'nonPositiveInteger', 'negativeInteger',
+        'nonNegativeInteger', 'positiveInteger', 'unsignedLong',
+        'unsignedInt', 'unsignedShort', 'unsignedByte'];
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/extras/webjars/snorql/src/main/resources/sparql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/sparql.js b/extras/webjars/snorql/src/main/resources/sparql.js
new file mode 100755
index 0000000..2b34538
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/sparql.js
@@ -0,0 +1,507 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**********************************************************
+  Copyright (c) 2006, 2007
+    Lee Feigenbaum ( lee AT thefigtrees DOT net )
+	Elias Torres   ( elias AT torrez DOT us )
+    Wing Yung      ( wingerz AT gmail DOT com )
+  All rights reserved.
+
+	Permission is hereby granted, free of charge, to any person obtaining a copy of
+	this software and associated documentation files (the "Software"), to deal in
+	the Software without restriction, including without limitation the rights to
+	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+	of the Software, and to permit persons to whom the Software is furnished to do
+	so, subject to the following conditions:
+
+	The above copyright notice and this permission notice shall be included in all
+	copies or substantial portions of the Software.
+
+	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+	SOFTWARE.
+**********************************************************/
+
+/**
+ * Example client interactions
+ *
+ 
+ 	var sparqler = new SPARQL.Service("http://sparql.org/sparql");
+	sparqler.addDefaultGraph("http://thefigtrees.net/lee/ldf-card"); // inherited by all (future) queries
+	sparqler.addNamedGraph("http://torrez.us/elias/foaf.rdf");
+	sparqler.setPrefix("foaf", "http://xmlns.com/foaf/0.1/"); // inherited by all (future) queries
+	sparqler.setPrefix("rdf", "http://xmlns.com/foaf/0.1/");
+	
+	sparqler.setRequestHeader("Authentication", "Basic: " + basicAuthString);
+	
+	//sparqler.wantOutputAs("application/json"); // for now we only do JSON
+
+	var query = sparqler.createQuery();
+	query.addDefualtGraph(...) query.addNamedGraph(...) query.setPrefix(...) query.setRequestHeader(...) // this query only
+
+	// query forms:
+
+	// passes standard JSON results object to success callback
+	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
+	query.query("SELECT ?who ?mbox WHERE { ldf:LDF foaf:knows ?who . ?who foaf:mbox ?mbox }",
+		{failure: onFailure, success: function(json) { for (var x in json.head.vars) { ... } ...}}
+	);
+
+	// passes boolean value to success callback
+	query.ask("ASK ?person WHERE { ?person foaf:knows [ foaf:name "Dan Connolly" ] }",
+		{failure: onFailure, success: function(bool) { if (bool) ... }}
+	); 
+
+	// passes a single vector (array) of values representing a single column of results to success callback
+	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
+	var addresses = query.selectValues("SELECT ?mbox WHERE { _:someone foaf:mbox ?mbox }",
+		{failure: onFailure, success: function(values) { for (var i = 0; i < values.length; i++) { ... values[i] ...} } }
+	); 
+
+	// passes a single value representing a single row of a single column (variable) to success callback
+	query.setPrefix("ldf", "http://thefigtrees.net/lee/ldf-card#");
+	var myAddress = query.selectSingleValue("SELECT ?mbox WHERE {ldf:LDF foaf:mbox ?mbox }",
+		{failure: onFailure, success: function(value) { alert("value is: " + value); } }
+	); 
+	
+	// shortcuts for all of the above (w/o ability to set any query-specific graphs or prefixes)
+	sparqler.query(...) sparqler.ask(...) sparqler.selectValues(...) sparqler.selectSingleValue(...)
+ 
+
+ */
+
+var SPARQL  = {}; // SPARQL namespace
+
+
+/**
+ * Both SPARQL service objects and SPARQL query objects receive one query utility method
+ * per entry in this dictionary. The key is the name of the method, and the value is a function
+ * that transforms the standard JSON output into a more useful form. The return value of a
+ * transformation function is passed into any 'success' callback function provided when the query
+ * is issued. The following transformations are included:
+ *   + query -- identity transform; returns the JSON structure unchanged
+ *   + ask -- for ASK queries; returns a boolean value indicating the answer to the query
+ *   + selectValues -- for SELECT queries with a single variable; returns an array containing
+ *       the answers to the query
+ *   + selectSingleValue -- for SELECT queries returning one column with one row; returns the
+ *       value in the first (and presumably, only) cell in the resultset
+ *   + selectValueArrays -- for SELECT queries returning independent columns; returns a hash
+ *       keyed on variable name with values as arrays of answers for that variable. Useful
+ *       for UNION queries.
+ *   Note that all of the transformations that return values directly lose any type information
+ *   and the ability to distinguish between URIs, blank nodes, and literals.
+ */
+SPARQL._query_transformations = {
+	query: function (o) { return o; },
+	ask: function (o) { return o["boolean"]; },
+	selectValues: function (o) {
+		var v = o.head.vars[0]; // assume one variable
+		var values = [];
+		for (var i = 0; i < o.results.bindings.length; i++)
+			values.push(o.results.bindings[i][v].value);
+		return values;
+	},
+	selectSingleValue: function(o) { return o.results.bindings[0][o.head.vars[0]].value; },
+	selectValueArrays: function(o) {
+		// factor by value (useful for UNION queries)
+		var ret = {};
+		for (var i = 0; i < o.head.vars.length; i++)
+			ret[o.head.vars[i]] = [];
+		for (var i = 0; i < o.results.bindings.length; i++)
+			for (var v in o.results.bindings[i])
+				if (ret[v] instanceof Array) ret[v].push(o.results.bindings[i][v].value);
+		return ret;
+	},
+    selectValueHashes: function(o) {
+        var hashes = [];
+        for (var i = 0; i < o.results.bindings.length; i++) {
+            var hash = {};
+            for (var v in o.results.bindings[i])
+                hash[v] = o.results.bindings[i][v].value;
+            hashes.push(hash);
+        }
+        return hashes;
+    }
+};
+
+SPARQL.statistics = {
+	queries_sent : 0,
+	successes    : 0,
+	failures     : 0
+};
+
+// A SPARQL service represents a single endpoint which implements the HTTP (GET or POST) 
+// bindings of the SPARQL Protocol. It provides convenience methods to set dataset and
+// prefix options for all queries created for this endpoint.
+SPARQL.Service = function(endpoint) {
+	//---------------
+	// private fields
+	var _endpoint = endpoint;
+	var _default_graphs = [];
+	var _named_graphs = [];
+	var _prefix_map = {};
+    var _method = 'POST';
+	var _output = 'json';
+	var _max_simultaneous = 0;
+	var _request_headers = {};
+
+	//----------
+	// accessors
+	this.endpoint = function() { return _endpoint; };
+	this.defaultGraphs = function() { return _default_graphs; };
+	this.namedGraphs = function() { return _named_graphs; };
+	this.prefixes = function() { return _prefix_map; };
+    this.method = function() { return _method; };
+    this.output = function() { return _output; };
+	this.maxSimultaneousQueries = function() { return _max_simultaneous; };
+	this.requestHeaders = function() { return _request_headers; };
+	
+	//---------
+	// mutators
+	function _add_graphs(toAdd, arr) {
+		if (toAdd instanceof Array)
+			for (var i = 0; i < toAdd.length; i++) arr.push(toAdd[i]);
+		else
+			arr.push(toAdd);
+	}
+	this.addDefaultGraph = function(g) { _add_graphs(g, this.defaultGraphs()); };
+	this.addNamedGraph = function(g) { _add_graphs(g, this.namedGraphs()); };
+	this.setPrefix = function(p, u) { this.prefixes()[p] = u; };
+	this.createQuery = function(p) { return new SPARQL.Query(this, p); };
+    this.setMethod = function(m) {
+        if (m != 'GET' && m != 'POST') throw("HTTP methods other than GET and POST are not supported.");
+        _method = m;
+    };
+	this.setOutput = function(o) { _output = o; };
+	this.setMaxSimultaneousQueries = function(m) { _max_simultaneous = m; };
+	this.setRequestHeader = function(h, v) { _request_headers[h] = v; };
+	
+	//---------------
+	// protected methods (should only be called within this module
+	this._active_queries = 0;
+	this._queued_queries = [];
+	this._next_in_queue  = 0;
+	this._canRun = function() { return this.maxSimultaneousQueries() <= 0 || this._active_queries < this.maxSimultaneousQueries();};
+	this._queue  = function(q,f, p) { 
+		if (!p) p = 0; 
+		if (p > 0) {
+			for (var i = 0; i < this._queued_queries.length; i++) {
+				if (this._queued_queries[i] != null && this._queued_queries[i][2] < p) {
+					this._queued_queries.splice(i, 0, [q, f, p]);
+					return;
+				}
+			}
+		}
+		this._queued_queries.push([q,f,p]); 
+	};
+	this._markRunning = function(q) { this._active_queries++; };
+	this._markDone    = function(q) { 
+		this._active_queries--; 
+		//document.getElementById('log').innerHTML+="query done. " + this._active_queries + " queries still active.<br>";
+		if (this._queued_queries[this._next_in_queue] != null && this._canRun()) {
+			var a = this._queued_queries[this._next_in_queue];
+			this._queued_queries[this._next_in_queue++] = null;
+			// a[0] is query object, a[1] is function to run query
+			//document.getElementById('log').innerHTML += "running query from Q<br>";
+			a[1]();
+		}
+	};
+
+	//---------------
+	// public methods
+
+	// use our varied transformations to create the various shortcut methods of actually 
+	// issuing queries without explicitly creating a query object
+	for (var query_form in SPARQL._query_transformations) {
+		// need the extra function to properly scope query_form (qf)
+		this[query_form] = (function(qf) {
+			return function(queryString, callback) {
+				var q = this.createQuery();
+				q._doQuery(queryString, callback, SPARQL._query_transformations[qf]);
+			};
+		})(query_form);
+	}
+	
+	//------------
+	// constructor
+    
+	if (!_endpoint)
+		return null;
+	
+	return this;
+}
+
+/**
+ * A SPARQL query object should be created using the createQuery method of a SPARQL
+ * service object. It allows prefixes and datasets to be defined specifically for
+ * a single query, and provides introspective methods to see the query string and the
+ * full (HTTP GET) URL of the query.
+ */
+SPARQL.Query = function(service, priority) {
+	//---------------
+	// private fields
+	var _conn = null;
+	var _service = service;
+	var _default_graphs = clone_obj(service.defaultGraphs()); // prevent future updates from affecting us
+	var _named_graphs = clone_obj(service.namedGraphs());
+	var _prefix_map = clone_obj(service.prefixes());
+	var _user_query = ''; // doesn't include auto-generated prefix declarations
+    var _method = service.method();
+	var _output = service.output();
+	var _priority = priority || 0;
+	var _request_headers = clone_obj(service.requestHeaders());
+
+	//------------------
+	// private functions
+	function _create_json(text) {
+		if (!text)
+			return null;
+		// make sure this is safe JSON
+		// see: http://www.ietf.org/internet-drafts/draft-crockford-jsonorg-json-03.txt
+
+		// (1) strip out quoted strings
+		var no_strings = text.replace(/"(\\.|[^"\\])*"/g, '');
+		// (2) make sure that all the characters are explicitly part of the JSON grammar
+		// (in particular, note as discussed in the IETF submission, there are no assignments
+		//  or function invocations allowed by this reg. exp.)
+		var hasBadCharacter = /[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(no_strings);
+		// (3) evaluate the JSON string, returning its contents
+		if (!hasBadCharacter) {
+			try {
+				return eval('(' + text + ')');
+			} catch (e) {
+				return null;
+			}
+		}
+		return null;
+	}
+
+	function clone_obj(o) {
+		var o2 = o instanceof Array ? [] : {};
+		for(var x in o) {o2[x] = o[x];}
+		return o2;
+	}
+
+	//----------------
+	// private methods
+	this._doCallback = function(cb, which, arg) {
+		//document.getElementById('log').innerHTML += "_doCallback ... <br>";
+		var user_data = "argument" in cb ? cb.argument : null;
+		if (which in cb) {
+			if (cb.scope) {
+                cb[which].apply(cb.scope, [arg, user_data]);
+			} else {
+				cb[which](arg, user_data);
+			}
+		}
+	}
+
+	this._queryFailure = function(xhr, arg) {
+		SPARQL.statistics.failures++;
+		_service._markDone(this);
+		this._doCallback(arg.callback, 'failure', xhr /* just pass through the connection response object */);
+	};
+	this._querySuccess = function(xhr, arg) {
+        //alert(xhr.responseText);
+		SPARQL.statistics.successes++;
+		_service._markDone(this);
+		this._doCallback(arg.callback, 'success', arg.transformer(
+			_output == 'json' ? _create_json(xhr.responseText) : xhr.responseText
+		));
+	};
+
+	function getXmlHttpRequest(url) {
+		// right now, this only does Firefox (Opera? Safari?)
+		return new XMLHttpRequest();
+	}
+
+	this._doQuery = function(queryString, callback, transformer) {
+		_user_query = queryString;
+		if (_service._canRun()) {
+			try {
+				if (_method != 'POST' && _method != 'GET')
+					throw("HTTP methods other than GET and POST are not supported.");
+
+				var url = _method == 'GET' ? this.queryUrl() : this.service().endpoint();
+				var xhr = getXmlHttpRequest(url);
+				var content = null;
+
+				try {
+                    if (!document.domain || ((url.match(/^http:\/\//) && url.slice(7, document.domain.length + 7) != document.domain || url.match(/^https:\/\//) && url.slice(8, document.domain.length + 8) != document.domain) && window.netscape && netscape.security && netscape.security.PrivilegeManager)) {
+						netscape.security.PrivilegeManager.enablePrivilege( "UniversalBrowserRead");
+						netscape.security.PrivilegeManager.enablePrivilege( "UniversalXPConnect");
+					}
+				} catch(e) {
+					alert("Cross-site requests prohibited. You will only be able to SPARQL the origin site: " + e);
+                    return;
+				}
+
+				xhr.open(_method, url, true /* async */);
+
+				// set the headers, including the content-type for POSTed queries
+				for (var header in this.requestHeaders())
+                    if (typeof(this.requestHeaders()[header]) != "function")
+	    				xhr.setRequestHeader(header, this.requestHeaders()[header]);
+				if (_method == 'POST') {
+					xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+					content = this.queryParameters();
+				}
+
+				SPARQL.statistics.queries_sent++;
+				_service._markRunning(this);
+
+				var callbackData = {
+					scope: this,
+					success: this._querySuccess,
+					failure: this._queryFailure,
+					argument: {
+						transformer: transformer,
+						callback: callback
+					}
+				};
+
+				// I've seen some strange race-condition behavior (strange since normally
+				// JS is single-threaded, so synchronization conditions don't occur barring
+				// reentrancy) with onreadystatechange. Instead, we poll asynchronously to
+				// determine when the request is done.
+				var token = window.setInterval(
+					function () {
+						if (xhr.readyState == 4) { // ready!
+							// clear this handler
+							window.clearInterval(token);
+							// we check the status to know which callback to call
+							if (xhr.status >= 200 && xhr.status < 300)
+								callbackData.success.apply(callbackData.scope, [xhr, callbackData.argument]);
+							else
+								callbackData.failure.apply(callbackData.scope, [xhr, callbackData.argument]);
+						}
+					},
+					200 /* maybe this should be customizable */
+				);
+
+				xhr.send(content);
+			} catch (e) {
+				alert("Error sending SPARQL query: " + e);
+			}
+		} else {
+			var self = this;
+			_service._queue(self, function() { self._doQuery(queryString, callback, transformer); }, _priority);
+		}
+	};
+
+
+	//----------
+	// accessors
+	this.request = function() { return _conn; };
+	this.service = function() { return _service; };
+	this.defaultGraphs = function() { return _default_graphs; };
+	this.namedGraphs = function() { return _named_graphs; };
+	this.prefixes = function() { return _prefix_map; };
+    this.method = function() { return _method; };
+    this.requestHeaders = function() { return _request_headers; };
+
+
+    /**
+     * Returns the SPARQL query represented by this object. The parameter, which can
+     * be omitted, determines whether or not auto-generated PREFIX clauses are included
+     * in the returned query string.
+     */
+	this.queryString = function(excludePrefixes) {
+		var preamble = '';
+		if (!excludePrefixes) {
+			for (var prefix in this.prefixes()) {
+				if(typeof(this.prefixes()[prefix]) != 'string') continue;
+				preamble += 'PREFIX ' + prefix + ': <' + this.prefixes()[prefix] + '> ';
+			}
+		}
+		return preamble + _user_query;
+	};
+
+    /**
+     * Returns the HTTP query parameters to invoke this query. This includes entries for
+     * all of the default graphs, the named graphs, the SPARQL query itself, and an
+     * output parameter to specify JSON (or other) output is desired.
+     */
+	this.queryParameters = function () {
+		var urlQueryString = '';
+		var i;
+
+		// add default and named graphs to the protocol invocation
+		for (i = 0; i < this.defaultGraphs().length; i++) urlQueryString += 'default-graph-uri=' + encodeURIComponent(this.defaultGraphs()[i]) + '&';
+		for (i = 0; i < this.namedGraphs().length; i++) urlQueryString += 'named-graph-uri=' + encodeURIComponent(this.namedGraphs()[i]) + '&';
+
+		// specify JSON output (currently output= supported by latest Joseki) (or other output)
+		urlQueryString += 'output=' + _output + '&';
+		return urlQueryString + 'query=' + encodeURIComponent(this.queryString());
+	}
+	
+    /**
+     * Returns the HTTP GET URL to invoke this query. (Note that this returns a full HTTP GET URL 
+     * even if this query is set to actually use POST.)
+     */
+	this.queryUrl = function() {
+		var url = this.service().endpoint() + '?';
+		return url + this.queryParameters();
+	};
+	
+	//---------
+	// mutators
+	function _add_graphs(toAdd, arr) {
+		if (toAdd instanceof Array)
+			for (var i = 0; i < toAdd.length; i++) arr.push(toAdd[i]);
+		else
+			arr.push(toAdd);
+	}
+	this.addDefaultGraph = function(g) { _add_graphs(g, this.defaultGraphs()); };
+	this.addNamedGraph = function(g) { _add_graphs(g, this.namedGraphs()); };
+	this.setPrefix = function(p, u) { this.prefixes()[p] = u; };
+    this.setMethod = function(m) {
+        if (m != 'GET' && m != 'POST') throw("HTTP methods other than GET and POST are not supported.");
+        _method = m;
+    };
+	this.setRequestHeader = function(h, v) { _request_headers[h] = v; };
+	
+	//---------------
+	// public methods
+
+	// use our varied transformations to create the various methods of actually issuing 
+	// queries
+	for (var query_form in SPARQL._query_transformations) {
+		// need the extra function to properly scope query_form (qf)
+		this[query_form] = (function(qf) {
+			return function(queryString, callback) {
+				this._doQuery(queryString, callback, SPARQL._query_transformations[qf]);
+			};
+		})(query_form);
+	}
+	
+
+	//------------
+	// constructor
+	
+	return this;
+}
+
+// Nothing to see here, yet.
+SPARQL.QueryUtilities = {
+};
+

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/extras/webjars/snorql/src/main/resources/style.css
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/style.css b/extras/webjars/snorql/src/main/resources/style.css
new file mode 100755
index 0000000..acc8746
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/style.css
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+.snorql {
+    background: none repeat scroll 0 0 #eeeeee;
+    font-family: sans-serif;
+    padding: 1em 1em 5em 1em;
+    border: 2px solid #000000;
+    border-radius: 5px;
+    margin: 2em auto 10em auto;
+}
+#footer_snorql { font-size: 60%; margin: 10px 0; text-align: center; }
+.subtitle { text-align: center; margin-top: 0; }
+form { margin: 0; }
+textarea { width: 100%; margin: 10px 0;border:1px solid #999; }
+.snorql pre#prefixestext { color: #555; margin: 10px 0;  width: auto; color: inherit; background-color: inherit; border: 0; }
+img { border: none; }
+.section { margin: 15px 0 0; padding: 0; }
+.busy { color: #888; }
+.link { background: url("link.png") center right no-repeat; padding-right: 13px; }
+.queryresults { border-collapse: collapse; margin-top: 0.3em; border: 1px solid gray;}
+.queryresults td, .queryresults th { padding: 0.2em 0.4em; vertical-align: top; }
+.uri { white-space: nowrap; }
+.uri a, a.uri { text-decoration: none; }
+.unbound { color: #888; }
+.queryresults a small { font-size: 100%; }
+.queryresults small { font-size: 100%; color: #666; }
+.queryresults .property { white-space: nowrap; }
+#rdficon { float: right; margin: 0.6em 1em; }
+.directory li { margin-bottom: 0.5em; }
+.directory small { font-size: 80%; color: #666; }
+
+.snorql h2 {
+   color: #666666;
+   margin: 0;
+   padding: 0;
+}
+.result h2 {
+    margin: 5px 0;
+    color: #666666;
+}
+/* .snorql #snorql_header, .snorql .section { background: #ccf; } */
+.snorql table.queryresults th { background: #666666; color: #ffffff; font-weight: bold; }
+.snorql table.queryresults tr.odd td { background-color: #aaaaaa !important; }
+.snorql table.queryresults tr.even td { background-color: #cccccc !important; }
+
+.browser h1, .browser h2 { color: #666666; }
+.browser #header, .browser .section { background: #666666; }
+.browser table.queryresults th { background: none repeat scroll 0 0 gray; color: white; }
+.browser table.queryresults tr.odd td { background-color: #aaaaaa !important; }
+.browser table.queryresults tr.even td { background-color: #cccccc !important; }
+
+#result {
+    border: 1px solid #999;
+    font-size: 12px;
+    overflow-x: auto;
+    padding: 5px;
+    width: 98%;
+    display:none;
+    background-color: white;
+}
+
+.snorql div.CodeMirror-scroll {
+    height: auto !important;
+    overflow-y: hidden !important;
+    overflow-x: auto !important;
+}
+
+.snorql div.CodeMirror-gutter pre, .snorql div.CodeMirror-lines pre {
+    overflow: inherit !important;
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/extras/webjars/snorql/src/main/resources/xml-to-html.xsl
----------------------------------------------------------------------
diff --git a/extras/webjars/snorql/src/main/resources/xml-to-html.xsl b/extras/webjars/snorql/src/main/resources/xml-to-html.xsl
new file mode 100755
index 0000000..1333027
--- /dev/null
+++ b/extras/webjars/snorql/src/main/resources/xml-to-html.xsl
@@ -0,0 +1,183 @@
+<?xml version="1.0"?>
+
+<!--
+
+XSLT script to format SPARQL Query Results XML Format into xhtml
+
+Copyright © 2004, 2005 World Wide Web Consortium, (Massachusetts
+Institute of Technology, European Research Consortium for
+Informatics and Mathematics, Keio University). All Rights
+Reserved. This work is distributed under the W3C® Software
+License [1] in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.
+
+[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+Version 1 : Dave Beckett (DAWG)
+Version 2 : Jeen Broekstra (DAWG)
+Customization for SPARQler: Andy Seaborne
+
+-->
+
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns="http://www.w3.org/1999/xhtml"
+		xmlns:res="http://www.w3.org/2005/sparql-results#"
+		exclude-result-prefixes="res xsl">
+
+  <!--
+    <xsl:output
+    method="html"
+    media-type="text/html"
+    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
+    indent="yes"
+    encoding="UTF-8"/>
+  -->
+
+  <!-- or this? -->
+
+  <xsl:output
+   method="xml" 
+   indent="yes"
+   encoding="UTF-8" 
+   doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+   doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+   omit-xml-declaration="no" />
+
+
+  <xsl:template name="header">
+    <div>
+      <h2>Header</h2>
+      <xsl:for-each select="res:head/res:link"> 
+	<p>Link to <xsl:value-of select="@href"/></p>
+      </xsl:for-each>
+    </div>
+  </xsl:template>
+
+  <xsl:template name="boolean-result">
+    <div>
+      <!--      
+	<h2>Boolean Result</h2>
+      -->      
+      <p>ASK => <xsl:value-of select="res:boolean"/></p>
+    </div>
+  </xsl:template>
+
+
+  <xsl:template name="vb-result">
+    <div>
+      <!--
+	<h2>Variable Bindings Result</h2>
+	<p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
+	<p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
+      -->
+
+      <table>
+	<xsl:text>
+	</xsl:text>
+	<tr>
+	  <xsl:for-each select="res:head/res:variable">
+	    <th><xsl:value-of select="@name"/></th>
+	  </xsl:for-each>
+	</tr>
+	<xsl:text>
+	</xsl:text>
+	<xsl:for-each select="res:results/res:result">
+	  <tr>
+	    <xsl:apply-templates select="."/>
+	  </tr>
+	</xsl:for-each>
+      </table>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="res:result">
+    <xsl:variable name="current" select="."/>
+    <xsl:for-each select="//res:head/res:variable">
+      <xsl:variable name="name" select="@name"/>
+      <td>
+	<xsl:choose>
+	  <xsl:when test="$current/res:binding[@name=$name]">
+	    <!-- apply template for the correct value type (bnode, uri, literal) -->
+	    <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
+	  </xsl:when>
+	  <xsl:otherwise>
+	    <!-- no binding available for this variable in this solution -->
+	  </xsl:otherwise>
+	</xsl:choose>
+      </td>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template match="res:bnode">
+    <xsl:text>_:</xsl:text>
+    <xsl:value-of select="text()"/>
+  </xsl:template>
+
+  <xsl:template match="res:uri">
+    <xsl:variable name="uri" select="text()"/>
+    <xsl:text>&lt;</xsl:text>
+    <xsl:value-of select="$uri"/>
+    <xsl:text>&gt;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="res:literal">
+    <xsl:text>"</xsl:text>
+    <xsl:value-of select="text()"/>
+    <xsl:text>"</xsl:text>
+
+    <xsl:choose>
+      <xsl:when test="@datatype">
+	<!-- datatyped literal value -->
+	^^&lt;<xsl:value-of select="@datatype"/>&gt;
+      </xsl:when>
+      <xsl:when test="@xml:lang">
+	<!-- lang-string -->
+	@<xsl:value-of select="@xml:lang"/>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="res:sparql">
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+      <head>
+	<title>SPARQL Query Results</title>
+	<style>
+	  <![CDATA[
+	  h1 { font-size: 150% ; }
+	  h2 { font-size: 125% ; }
+	  table { border-collapse: collapse ; border: 1px solid black ; }
+	  td, th
+ 	  { border: 1px solid black ;
+	    padding-left:0.5em; padding-right: 0.5em; 
+	    padding-top:0.2ex ; padding-bottom:0.2ex 
+	  }
+	  ]]>
+	</style>
+      </head>
+      <body>
+
+
+	<h1>SPARQL Query Results</h1>
+
+	<xsl:if test="res:head/res:link">
+	  <xsl:call-template name="header"/>
+	</xsl:if>
+
+	<xsl:choose>
+	  <xsl:when test="res:boolean">
+	    <xsl:call-template name="boolean-result" />
+	  </xsl:when>
+
+	  <xsl:when test="res:results">
+	    <xsl:call-template name="vb-result" />
+	  </xsl:when>
+
+	</xsl:choose>
+
+
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/extras/webjars/strftime/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/strftime/pom.xml b/extras/webjars/strftime/pom.xml
new file mode 100644
index 0000000..6f337ab
--- /dev/null
+++ b/extras/webjars/strftime/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.marmotta</groupId>
+        <artifactId>marmotta-parent</artifactId>
+        <version>3.1.0-incubating</version>
+        <relativePath>../../../parent/</relativePath> 
+    </parent>
+
+    <properties>
+        <webjar.version>1.3</webjar.version>
+    </properties>
+
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>strftime</artifactId>
+    <packaging>jar</packaging>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>yuicompressor-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>aggregate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <nomunge>true</nomunge>
+                    <sourceDirectory>${project.basedir}/src/main/resources</sourceDirectory>
+                    <output>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${webjar.version}/strftime.js</output>
+                </configuration>
+            </plugin>
+            <plugin>
+                <!-- these are "extras", so they come from 3rd parties, no RAT check! -->
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>src/**</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <excludes>
+                    <exclude>**/*.js</exclude>
+                </excludes>
+                <filtering>false</filtering>
+                <targetPath>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${webjar.version}</targetPath>
+            </resource>
+        </resources>
+     </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/extras/webjars/strftime/src/main/resources/strftime.js
----------------------------------------------------------------------
diff --git a/extras/webjars/strftime/src/main/resources/strftime.js b/extras/webjars/strftime/src/main/resources/strftime.js
new file mode 100644
index 0000000..4e84444
--- /dev/null
+++ b/extras/webjars/strftime/src/main/resources/strftime.js
@@ -0,0 +1,750 @@
+/*
+ strftime for Javascript
+ Copyright (c) 2008, Philip S Tellis <ph...@bluesmoon.info>
+ All rights reserved.
+ 
+ extended with german locales and %F formatter for Marmotta
+ Jakob Frank <ja...@apache.org>
+ 
+ This code is distributed under the terms of the BSD licence
+ 
+ Redistribution and use of this software in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+   * Redistributions of source code must retain the above copyright notice, this list of conditions
+     and the following disclaimer.
+   * Redistributions in binary form must reproduce the above copyright notice, this list of
+     conditions and the following disclaimer in the documentation and/or other materials provided
+     with the distribution.
+   * The names of the contributors to this file may not be used to endorse or promote products
+     derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file strftime.js
+ * \author Philip S Tellis \<philip@bluesmoon.info\>
+ * \version 1.3
+ * \date 2008/06
+ * \brief Javascript implementation of strftime
+ * 
+ * Implements strftime for the Date object in javascript based on the PHP implementation described at
+ * http://www.php.net/strftime  This is in turn based on the Open Group specification defined
+ * at http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html This implementation does not
+ * include modified conversion specifiers (i.e., Ex and Ox)
+ *
+ * The following format specifiers are supported:
+ *
+ * \copydoc formats
+ *
+ * \%a, \%A, \%b and \%B should be localised for non-English locales.
+ *
+ * \par Usage:
+ * This library may be used as follows:
+ * \code
+ *     var d = new Date();
+ *
+ *     var ymd = d.strftime('%Y/%m/%d');
+ *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \sa \link Date.prototype.strftime Date.strftime \endlink for a description of each of the supported format specifiers
+ * \sa Date.ext.locales for localisation information
+ * \sa http://www.php.net/strftime for the PHP implementation which is the basis for this
+ * \sa http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html for feedback
+ */
+
+//! Date extension object - all supporting objects go in here.
+Date.ext = Date.ext || {};
+
+//! Utility methods
+Date.ext.util = Date.ext.util || {};
+
+/**
+\brief Left pad a number with something
+\details Takes a number and pads it to the left with the passed in pad character
+\param x	The number to pad
+\param pad	The string to pad with
+\param r	[optional] Upper limit for pad.  A value of 10 pads to 2 digits, a value of 100 pads to 3 digits.
+		Default is 10.
+
+\return The number left padded with the pad character.  This function returns a string and not a number.
+*/
+Date.ext.util.xPad=function(x, pad, r)
+{
+	if(typeof(r) == 'undefined')
+	{
+		r=10;
+	}
+	for( ; parseInt(x, 10)<r && r>1; r/=10)
+		x = pad.toString() + x;
+	return x.toString();
+};
+
+/**
+\brief Currently selected locale.
+\details
+The locale for a specific date object may be changed using \code Date.locale = "new-locale"; \endcode
+The default will be based on the lang attribute of the HTML tag of your document
+*/
+Date.prototype.locale = 'en-GB';
+//! \cond FALSE
+if(document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang)
+{
+	Date.prototype.locale = document.getElementsByTagName('html')[0].lang;
+}
+//! \endcond
+
+/**
+\brief Localised strings for days of the week and months of the year.
+\details
+To create your own local strings, add a locale object to the locales object.
+The key of your object should be the same as your locale name.  For example:
+   en-US,
+   fr,
+   fr-CH,
+   de-DE
+Names are case sensitive and are described at http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+Your locale object must contain the following keys:
+\param a	Short names of days of week starting with Sunday
+\param A	Long names days of week starting with Sunday
+\param b	Short names of months of the year starting with January
+\param B	Long names of months of the year starting with February
+\param c	The preferred date and time representation in your locale
+\param p	AM or PM in your locale
+\param P	am or pm in your locale
+\param x	The  preferred date representation for the current locale without the time.
+\param X	The preferred time representation for the current locale without the date.
+
+\sa Date.ext.locales.en for a sample implementation
+\sa \ref localisation for detailed documentation on localising strftime for your own locale
+*/
+Date.ext.locales = Date.ext.locales || { };
+
+/**
+ * \brief Localised strings for English (British).
+ * \details
+ * This will be used for any of the English dialects unless overridden by a country specific one.
+ * This is the default locale if none specified
+ */
+Date.ext.locales.en = Date.ext.locales.en || {
+	a: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+	A: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+	b: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+	B: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+	c: '%a %d %b %Y %T %Z',
+	p: ['AM', 'PM'],
+	P: ['am', 'pm'],
+	x: '%d/%m/%y',
+	X: '%T'
+};
+
+//! \cond FALSE
+// Localised strings for US English
+Date.ext.locales['en-US'] = Date.ext.locales.en;
+Date.ext.locales['en-US'].c = '%a %d %b %Y %r %Z';
+Date.ext.locales['en-US'].x = '%D';
+Date.ext.locales['en-US'].X = '%r';
+
+// Localised strings for British English
+Date.ext.locales['en-GB'] = Date.ext.locales.en;
+
+// Localised strings for Australian English
+Date.ext.locales['en-AU'] = Date.ext.locales['en-GB'];
+//! \endcond
+
+Date.ext.locales.de = Date.ext.locales.de || {
+        a: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
+        A: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
+        b: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
+        B: ['Jänner', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
+        c: '%a %d %b %Y %T %Z',
+        p: ['', ''],
+        P: ['', ''],
+        x: '%d.%m.%Y',
+        X: '%T'
+    };
+Date.ext.locales['de-AT'] = Date.ext.locales['de-AT'] || Date.ext.locales.de;
+Date.ext.locales['de-CH'] = Date.ext.locales['de-CH'] || Date.ext.locales.de;
+Date.ext.locales['de-DE'] = Date.ext.locales['de-DE'] || Date.ext.locales.de;
+//! \brief List of supported format specifiers.
+/**
+ * \details
+ * \arg \%a - abbreviated weekday name according to the current locale
+ * \arg \%A - full weekday name according to the current locale
+ * \arg \%b - abbreviated month name according to the current locale
+ * \arg \%B - full month name according to the current locale
+ * \arg \%c - preferred date and time representation for the current locale
+ * \arg \%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99)
+ * \arg \%d - day of the month as a decimal number (range 01 to 31)
+ * \arg \%D - same as %m/%d/%y
+ * \arg \%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')
+ * \arg \%F - same as %Y-%m-%d
+ * \arg \%g - like %G, but without the century
+ * \arg \%G - The 4-digit year corresponding to the ISO week number
+ * \arg \%h - same as %b
+ * \arg \%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
+ * \arg \%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
+ * \arg \%j - day of the year as a decimal number (range 001 to 366)
+ * \arg \%m - month as a decimal number (range 01 to 12)
+ * \arg \%M - minute as a decimal number
+ * \arg \%n - newline character
+ * \arg \%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale
+ * \arg \%P - like %p, but lower case
+ * \arg \%r - time in a.m. and p.m. notation equal to %I:%M:%S %p
+ * \arg \%R - time in 24 hour notation equal to %H:%M
+ * \arg \%S - second as a decimal number
+ * \arg \%t - tab character
+ * \arg \%T - current time, equal to %H:%M:%S
+ * \arg \%u - weekday as a decimal number [1,7], with 1 representing Monday
+ * \arg \%U - week number of the current year as a decimal number, starting with
+ *            the first Sunday as the first day of the first week
+ * \arg \%V - The ISO 8601:1988 week number of the current year as a decimal number,
+ *            range 01 to 53, where week 1 is the first week that has at least 4 days
+ *            in the current year, and with Monday as the first day of the week.
+ * \arg \%w - day of the week as a decimal, Sunday being 0
+ * \arg \%W - week number of the current year as a decimal number, starting with the
+ *            first Monday as the first day of the first week
+ * \arg \%x - preferred date representation for the current locale without the time
+ * \arg \%X - preferred time representation for the current locale without the date
+ * \arg \%y - year as a decimal number without a century (range 00 to 99)
+ * \arg \%Y - year as a decimal number including the century
+ * \arg \%z - numerical time zone representation
+ * \arg \%Z - time zone name or abbreviation
+ * \arg \%% - a literal `\%' character
+ */
+Date.ext.formats = {
+	a: function(d) { return Date.ext.locales[d.locale].a[d.getDay()]; },
+	A: function(d) { return Date.ext.locales[d.locale].A[d.getDay()]; },
+	b: function(d) { return Date.ext.locales[d.locale].b[d.getMonth()]; },
+	B: function(d) { return Date.ext.locales[d.locale].B[d.getMonth()]; },
+	c: 'toLocaleString',
+	C: function(d) { return Date.ext.util.xPad(parseInt(d.getFullYear()/100, 10), 0); },
+	d: ['getDate', '0'],
+	e: ['getDate', ' '],
+	g: function(d) { return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100, 10), 0); },
+	G: function(d) {
+			var y = d.getFullYear();
+			var V = parseInt(Date.ext.formats.V(d), 10);
+			var W = parseInt(Date.ext.formats.W(d), 10);
+
+			if(W > V) {
+				y++;
+			} else if(W===0 && V>=52) {
+				y--;
+			}
+
+			return y;
+		},
+	H: ['getHours', '0'],
+	I: function(d) { var I=d.getHours()%12; return Date.ext.util.xPad(I===0?12:I, 0); },
+	j: function(d) {
+			var ms = d - new Date('' + d.getFullYear() + '/1/1 GMT');
+			ms += d.getTimezoneOffset()*60000;
+			var doy = parseInt(ms/60000/60/24, 10)+1;
+			return Date.ext.util.xPad(doy, 0, 100);
+		},
+	m: function(d) { return Date.ext.util.xPad(d.getMonth()+1, 0); },
+	M: ['getMinutes', '0'],
+	p: function(d) { return Date.ext.locales[d.locale].p[d.getHours() >= 12 ? 1 : 0 ]; },
+	P: function(d) { return Date.ext.locales[d.locale].P[d.getHours() >= 12 ? 1 : 0 ]; },
+	S: ['getSeconds', '0'],
+	u: function(d) { var dow = d.getDay(); return dow===0?7:dow; },
+	U: function(d) {
+			var doy = parseInt(Date.ext.formats.j(d), 10);
+			var rdow = 6-d.getDay();
+			var woy = parseInt((doy+rdow)/7, 10);
+			return Date.ext.util.xPad(woy, 0);
+		},
+	V: function(d) {
+			var woy = parseInt(Date.ext.formats.W(d), 10);
+			var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
+			// First week is 01 and not 00 as in the case of %U and %W,
+			// so we add 1 to the final result except if day 1 of the year
+			// is a Monday (then %W returns 01).
+			// We also need to subtract 1 if the day 1 of the year is 
+			// Friday-Sunday, so the resulting equation becomes:
+			var idow = woy + (dow1_1 > 4 || dow1_1 <= 1 ? 0 : 1);
+			if(idow == 53 && (new Date('' + d.getFullYear() + '/12/31')).getDay() < 4)
+			{
+				idow = 1;
+			}
+			else if(idow === 0)
+			{
+				idow = Date.ext.formats.V(new Date('' + (d.getFullYear()-1) + '/12/31'));
+			}
+
+			return Date.ext.util.xPad(idow, 0);
+		},
+	w: 'getDay',
+	W: function(d) {
+			var doy = parseInt(Date.ext.formats.j(d), 10);
+			var rdow = 7-Date.ext.formats.u(d);
+			var woy = parseInt((doy+rdow)/7, 10);
+			return Date.ext.util.xPad(woy, 0, 10);
+		},
+	y: function(d) { return Date.ext.util.xPad(d.getFullYear()%100, 0); },
+	Y: 'getFullYear',
+	z: function(d) {
+			var o = d.getTimezoneOffset();
+			var H = Date.ext.util.xPad(parseInt(Math.abs(o/60), 10), 0);
+			var M = Date.ext.util.xPad(o%60, 0);
+			return (o>0?'-':'+') + H + M;
+		},
+	Z: function(d) { return d.toString().replace(/^.*\(([^)]+)\)$/, '$1'); },
+	'%': function(d) { return '%'; }
+};
+
+/**
+\brief List of aggregate format specifiers.
+\details
+Aggregate format specifiers map to a combination of basic format specifiers.
+These are implemented in terms of Date.ext.formats.
+
+A format specifier that maps to 'locale' is read from Date.ext.locales[current-locale].
+
+\sa Date.ext.formats
+*/
+Date.ext.aggregates = {
+	c: 'locale',
+	D: '%m/%d/%y',
+	F: '%Y-%m-%d',
+	h: '%b',
+	n: '\n',
+	r: '%I:%M:%S %p',
+	R: '%H:%M',
+	t: '\t',
+	T: '%H:%M:%S',
+	x: 'locale',
+	X: 'locale'
+};
+
+//! \cond FALSE
+// Cache timezone values because they will never change for a given JS instance
+Date.ext.aggregates.z = Date.ext.formats.z(new Date());
+Date.ext.aggregates.Z = Date.ext.formats.Z(new Date());
+//! \endcond
+
+//! List of unsupported format specifiers.
+/**
+ * \details
+ * All format specifiers supported by the PHP implementation are supported by
+ * this javascript implementation.
+ */
+Date.ext.unsupported = { };
+
+
+/**
+ * \brief Formats the date according to the specified format.
+ * \param fmt	The format to format the date in.  This may be a combination of the following:
+ * \copydoc formats
+ *
+ * \return	A string representation of the date formatted based on the passed in parameter
+ * \sa http://www.php.net/strftime for documentation on format specifiers
+*/
+Date.prototype.strftime=function(fmt)
+{
+	// Fix locale if declared locale hasn't been defined
+	// After the first call this condition should never be entered unless someone changes the locale
+	if(!(this.locale in Date.ext.locales))
+	{
+		if(this.locale.replace(/-[a-zA-Z]+$/, '') in Date.ext.locales)
+		{
+			this.locale = this.locale.replace(/-[a-zA-Z]+$/, '');
+		}
+		else
+		{
+			this.locale = 'en-GB';
+		}
+	}
+
+	var d = this;
+	// First replace aggregates
+	while(fmt.match(/%[cDFhnrRtTxXzZ]/))
+	{
+		fmt = fmt.replace(/%([cDFhnrRtTxXzZ])/g, function(m0, m1)
+				{
+					var f = Date.ext.aggregates[m1];
+					return (f == 'locale' ? Date.ext.locales[d.locale][m1] : f);
+				});
+	}
+
+
+	// Now replace formats - we need a closure so that the date object gets passed through
+	var str = fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g, function(m0, m1) 
+			{
+				var f = Date.ext.formats[m1];
+				if(typeof(f) == 'string') {
+					return d[f]();
+				} else if(typeof(f) == 'function') {
+					return f.call(d, d);
+				} else if(typeof(f) == 'object' && typeof(f[0]) == 'string') {
+					return Date.ext.util.xPad(d[f[0]](), f[1]);
+				} else {
+					return m1;
+				}
+			});
+	d=null;
+	return str;
+};
+
+/**
+ * \mainpage strftime for Javascript
+ *
+ * \section toc Table of Contents
+ * - \ref intro_sec
+ * - <a class="el" href="strftime.js">Download full source</a> / <a class="el" href="strftime-min.js">minified</a>
+ * - \subpage usage
+ * - \subpage format_specifiers
+ * - \subpage localisation
+ * - \link strftime.js API Documentation \endlink
+ * - \subpage demo
+ * - \subpage changelog
+ * - \subpage faq
+ * - <a class="el" href="http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html">Feedback</a>
+ * - \subpage copyright_licence
+ *
+ * \section intro_sec Introduction
+ *
+ * C and PHP developers have had access to a built in strftime function for a long time.
+ * This function is an easy way to format dates and times for various display needs.
+ *
+ * This library brings the flexibility of strftime to the javascript Date object
+ *
+ * Use this library if you frequently need to format dates in javascript in a variety of ways.  For example,
+ * if you have PHP code that writes out formatted dates, and want to mimic the functionality using
+ * progressively enhanced javascript, then this library can do exactly what you want.
+ *
+ *
+ *
+ *
+ * \page usage Example usage
+ *
+ * \section usage_sec Usage
+ * This library may be used as follows:
+ * \code
+ *     var d = new Date();
+ *
+ *     var ymd = d.strftime('%Y/%m/%d');
+ *     var iso = d.strftime('%Y-%m-%dT%H:%M:%S%z');
+ *
+ * \endcode
+ *
+ * \subsection examples Examples
+ * 
+ * To get the current time in hours and minutes:
+ * \code
+ * 	var d = new Date();
+ * 	d.strftime("%H:%M");
+ * \endcode
+ *
+ * To get the current time with seconds in AM/PM notation:
+ * \code
+ * 	var d = new Date();
+ * 	d.strftime("%r");
+ * \endcode
+ *
+ * To get the year and day of the year for August 23, 2009:
+ * \code
+ * 	var d = new Date('2009/8/23');
+ * 	d.strftime("%Y-%j");
+ * \endcode
+ *
+ * \section demo_sec Demo
+ *
+ * Try your own examples on the \subpage demo page.  You can use any of the supported
+ * \subpage format_specifiers.
+ *
+ *
+ *
+ *
+ * \page localisation Localisation
+ * You can localise strftime by implementing the short and long forms for days of the
+ * week and months of the year, and the localised aggregates for the preferred date
+ * and time representation for your locale.  You need to add your locale to the
+ * Date.ext.locales object.
+ *
+ * \section localising_fr Localising for french
+ *
+ * For example, this is how we'd add French language strings to the locales object:
+ * \dontinclude index.html
+ * \skip Generic french
+ * \until };
+ * The % format specifiers are all defined in \ref formats.  You can use any of those.
+ *
+ * This locale definition may be included in your own source file, or in the HTML file
+ * including \c strftime.js, however it must be defined \em after including \c strftime.js
+ *
+ * The above definition includes generic french strings and formats that are used in France.
+ * Other french speaking countries may have other representations for dates and times, so we
+ * need to override this for them.  For example, Canadian french uses a Y-m-d date format,
+ * while French french uses d.m.Y.  We fix this by defining Canadian french to be the same
+ * as generic french, and then override the format specifiers for \c x for the \c fr-CA locale:
+ * \until End french
+ *
+ * You can now use any of the French locales at any time by setting \link Date.prototype.locale Date.locale \endlink
+ * to \c "fr", \c "fr-FR", \c "fr-CA", or any other french dialect:
+ * \code
+ *     var d = new Date("2008/04/22");
+ *     d.locale = "fr";
+ *
+ *     d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ *     mardi, 22 avril == 22.04.2008
+ * \endcode
+ * While changing the locale to "fr-CA":
+ * \code
+ *     d.locale = "fr-CA";
+ *
+ *     d.strftime("%A, %d %B == %x");
+ * \endcode
+ * will return:
+ * \code
+ *     mardi, 22 avril == 2008-04-22
+ * \endcode
+ *
+ * You can use any of the format specifiers defined at \ref formats
+ *
+ * The locale for all dates defaults to the value of the \c lang attribute of your HTML document if
+ * it is set, or to \c "en" otherwise.
+ * \note
+ * Your locale definitions \b MUST be added to the locale object before calling
+ * \link Date.prototype.strftime Date.strftime \endlink.
+ *
+ * \sa \ref formats for a list of format specifiers that can be used in your definitions
+ * for c, x and X.
+ *
+ * \section locale_names Locale names
+ *
+ * Locale names are defined in RFC 1766. Typically, a locale would be a two letter ISO639
+ * defined language code and an optional ISO3166 defined country code separated by a -
+ * 
+ * eg: fr-FR, de-DE, hi-IN
+ *
+ * \sa http://www.ietf.org/rfc/rfc1766.txt
+ * \sa http://www.loc.gov/standards/iso639-2/php/code_list.php
+ * \sa http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm
+ * 
+ * \section locale_fallback Locale fallbacks
+ *
+ * If a locale object corresponding to the fully specified locale isn't found, an attempt will be made
+ * to fall back to the two letter language code.  If a locale object corresponding to that isn't found
+ * either, then the locale will fall back to \c "en".  No warning will be issued.
+ *
+ * For example, if we define a locale for de:
+ * \until };
+ * Then set the locale to \c "de-DE":
+ * \code
+ *     d.locale = "de-DE";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * In this case, the \c "de" locale will be used since \c "de-DE" has not been defined:
+ * \code
+ *     Di, 22 Apr
+ * \endcode
+ *
+ * Swiss german will return the same since it will also fall back to \c "de":
+ * \code
+ *     d.locale = "de-CH";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ *     Di, 22 Apr
+ * \endcode
+ *
+ * We need to override the \c a specifier for Swiss german, since it's different from German german:
+ * \until End german
+ * We now get the correct results:
+ * \code
+ *     d.locale = "de-CH";
+ *
+ *     d.strftime("%a, %d %b");
+ * \endcode
+ * \code
+ *     Die, 22 Apr
+ * \endcode
+ *
+ * \section builtin_locales Built in locales
+ *
+ * This library comes with pre-defined locales for en, en-GB, en-US and en-AU.
+ *
+ * 
+ *
+ *
+ * \page format_specifiers Format specifiers
+ * 
+ * \section specifiers Format specifiers
+ * strftime has several format specifiers defined by the Open group at 
+ * http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
+ *
+ * PHP added a few of its own, defined at http://www.php.net/strftime
+ *
+ * This javascript implementation supports all the PHP specifiers
+ *
+ * \subsection supp Supported format specifiers:
+ * \copydoc formats
+ * 
+ * \subsection unsupportedformats Unsupported format specifiers:
+ * \copydoc unsupported
+ *
+ *
+ *
+ *
+ * \page demo strftime demo
+ * <div style="float:right;width:45%;">
+ * \copydoc formats
+ * </div>
+ * \htmlinclude index.html
+ *
+ *
+ *
+ *
+ * \page faq FAQ
+ * 
+ * \section how_tos Usage
+ *
+ * \subsection howtouse Is there a manual on how to use this library?
+ *
+ * Yes, see \ref usage
+ *
+ * \subsection wheretoget Where can I get a minified version of this library?
+ *
+ * The minified version is available <a href="strftime-min.js" title="Minified strftime.js">here</a>.
+ *
+ * \subsection which_specifiers Which format specifiers are supported?
+ *
+ * See \ref format_specifiers
+ *
+ * \section whys Why?
+ *
+ * \subsection why_lib Why this library?
+ *
+ * I've used the strftime function in C, PHP and the Unix shell, and found it very useful
+ * to do date formatting.  When I needed to do date formatting in javascript, I decided
+ * that it made the most sense to just reuse what I'm already familiar with.
+ *
+ * \subsection why_another Why another strftime implementation for Javascript?
+ *
+ * Yes, there are other strftime implementations for Javascript, but I saw problems with
+ * all of them that meant I couldn't use them directly.  Some implementations had bad
+ * designs.  For example, iterating through all possible specifiers and scanning the string
+ * for them.  Others were tied to specific libraries like prototype.
+ *
+ * Trying to extend any of the existing implementations would have required only slightly
+ * less effort than writing this from scratch.  In the end it took me just about 3 hours
+ * to write the code and about 6 hours battling with doxygen to write these docs.
+ *
+ * I also had an idea of how I wanted to implement this, so decided to try it.
+ *
+ * \subsection why_extend_date Why extend the Date class rather than subclass it?
+ *
+ * I tried subclassing Date and failed.  I didn't want to waste time on figuring
+ * out if there was a problem in my code or if it just wasn't possible.  Adding to the
+ * Date.prototype worked well, so I stuck with it.
+ *
+ * I did have some worries because of the way for..in loops got messed up after json.js added
+ * to the Object.prototype, but that isn't an issue here since {} is not a subclass of Date.
+ *
+ * My last doubt was about the Date.ext namespace that I created.  I still don't like this,
+ * but I felt that \c ext at least makes clear that this is external or an extension.
+ *
+ * It's quite possible that some future version of javascript will add an \c ext or a \c locale
+ * or a \c strftime property/method to the Date class, but this library should probably
+ * check for capabilities before doing what it does.
+ *
+ * \section curiosity Curiosity
+ *
+ * \subsection how_big How big is the code?
+ *
+ * \arg 26K bytes with documentation
+ * \arg 4242 bytes minified using <a href="http://developer.yahoo.com/yui/compressor/">YUI Compressor</a>
+ * \arg 1477 bytes minified and gzipped
+ *
+ * \subsection how_long How long did it take to write this?
+ *
+ * 15 minutes for the idea while I was composing this blog post:
+ * http://tech.bluesmoon.info/2008/04/javascript-date-functions.html
+ *
+ * 3 hours in one evening to write v1.0 of the code and 6 hours the same
+ * night to write the docs and this manual.  As you can tell, I'm fairly
+ * sleepy.
+ *
+ * Versions 1.1 and 1.2 were done in a couple of hours each, and version 1.3
+ * in under one hour.
+ *
+ * \section contributing Contributing
+ *
+ * \subsection how_to_rfe How can I request features or make suggestions?
+ *
+ * You can leave a comment on my blog post about this library here:
+ * http://tech.bluesmoon.info/2008/04/strftime-in-javascript.html
+ *
+ * \subsection how_to_contribute Can I/How can I contribute code to this library?
+ *
+ * Yes, that would be very nice, thank you.  You can do various things.  You can make changes
+ * to the library, and make a diff against the current file and mail me that diff at
+ * philip@bluesmoon.info, or you could just host the new file on your own servers and add
+ * your name to the copyright list at the top stating which parts you've added.
+ *
+ * If you do mail me a diff, let me know how you'd like to be listed in the copyright section.
+ *
+ * \subsection copyright_signover Who owns the copyright on contributed code?
+ *
+ * The contributor retains copyright on contributed code.
+ *
+ * In some cases I may use contributed code as a template and write the code myself.  In this
+ * case I'll give the contributor credit for the idea, but will not add their name to the
+ * copyright holders list.
+ *
+ *
+ *
+ *
+ * \page copyright_licence Copyright & Licence
+ *
+ * \section copyright Copyright
+ * \dontinclude strftime.js
+ * \skip Copyright
+ * \until rights
+ *
+ * \section licence Licence
+ * \skip This code
+ * \until SUCH DAMAGE.
+ *
+ *
+ *
+ * \page changelog ChangeLog
+ *
+ * \par 1.3 - 2008/06/17:
+ * - Fixed padding issue with negative timezone offsets in %r
+ *   reported and fixed by Mikko <mi...@iki.fi>
+ * - Added support for %P
+ * - Internationalised %r, %p and %P
+ *
+ * \par 1.2 - 2008/04/27:
+ * - Fixed support for c (previously it just returned toLocaleString())
+ * - Add support for c, x and X
+ * - Add locales for en-GB, en-US and en-AU
+ * - Make en-GB the default locale (previous was en)
+ * - Added more localisation docs
+ *
+ * \par 1.1 - 2008/04/27:
+ * - Fix bug in xPad which wasn't padding more than a single digit
+ * - Fix bug in j which had an off by one error for days after March 10th because of daylight savings
+ * - Add support for g, G, U, V and W
+ *
+ * \par 1.0 - 2008/04/22:
+ * - Initial release with support for a, A, b, B, c, C, d, D, e, H, I, j, m, M, p, r, R, S, t, T, u, w, y, Y, z, Z, and %
+ */

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/launchers/marmotta-installer/pom.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-installer/pom.xml b/launchers/marmotta-installer/pom.xml
index 11b8ec7..5db3648 100644
--- a/launchers/marmotta-installer/pom.xml
+++ b/launchers/marmotta-installer/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <groupId>org.apache.marmotta</groupId>
         <artifactId>marmotta-parent</artifactId>
-        <version>3.1.0-incubating-SNAPSHOT</version>
+        <version>3.1.0-incubating</version>
         <relativePath>../../parent</relativePath>
     </parent>
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/582abb5b/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
----------------------------------------------------------------------
diff --git a/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt b/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
index 4a0bf89..9e10bdc 100644
--- a/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
+++ b/launchers/marmotta-installer/src/main/resources/installer/LICENSE.txt
@@ -2692,6 +2692,37 @@ For the JSONLD-Java component,
     THE POSSIBILITY OF SUCH DAMAGE.
         
 
+For the marmotta-commons component,
+
+    located at commons/marmotta-commons/src/ext/java
+
+   Javolution - Java(tm) Solution for Real-Time and Embedded Systems
+   Copyright (c) 2012, Javolution (http://javolution.org/)
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are met:
+
+      1. Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+
+      2. Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
 
 Apache Marmotta 3rd party data files:
 ====================================