You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/07/09 11:51:14 UTC

[33/41] - moved SNORQL to WebJar - moved CodeMirror to WebJar - moved Sgvizler to WebJar - cleaned up uses of non-webjar jquery and jquery-ui - configured YUI compressor for the above packages in build

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/index.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/index.html b/extras/webjars/codemirror/src/main/resources/index.html
new file mode 100644
index 0000000..3fef19a
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/index.html
@@ -0,0 +1,242 @@
+<!--
+
+    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.
+
+-->
+<!doctype html>
+<html>
+<head>
+<title>CodeMirror: LDPath Demo</title>
+<link rel="stylesheet" href="codemirror.css">
+<link rel="stylesheet" href="simple-hint.css">
+
+    <script type="text/javascript" src="../../../webjars/jquery/1.8.2/jquery.min.js"></script>
+
+<script src="codemirror.js"></script>
+<script src="simple-hint.js"></script>
+<script src="ldpath.js"></script>
+
+<link rel="stylesheet" href="ldpath.css">
+
+<style type="text/css">
+.CodeMirror {
+    border: 1px solid #eee;
+}
+
+td {
+    padding-right: 20px;
+}
+body {
+  font-family: Droid Sans, Arial, sans-serif;
+  line-height: 1.5;
+  max-width: 64.3em;
+  margin: 3em auto;
+  padding: 0 1em;
+}
+
+h1 {
+  letter-spacing: -3px;
+  font-size: 3.23em;
+  font-weight: bold;
+  margin: 0;
+}
+
+h2 {
+  font-size: 1.23em;
+  font-weight: bold;
+  margin: .5em 0;
+  letter-spacing: -1px;
+}
+
+h3 {
+  font-size: 1em;
+  font-weight: bold;
+  margin: .4em 0;
+}
+
+pre {
+  background-color: #eee;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
+  padding: 1em;
+}
+
+pre.code {
+  margin: 0 1em;
+}
+
+.grey {
+  font-size: 2.2em;
+  padding: .5em 1em;
+  line-height: 1.2em;
+  margin-top: .5em;
+  position: relative;
+}
+
+img.logo {
+  position: absolute;
+  right: -25px;
+  bottom: 4px;
+}
+
+a:link, a:visited, .quasilink {
+  color: #df0019;
+  cursor: pointer;
+  text-decoration: none;
+}
+
+a:hover, .quasilink:hover {
+  color: #800004;
+}
+
+h1 a:link, h1 a:visited, h1 a:hover {
+  color: black;
+}
+
+ul {
+  margin: 0;
+  padding-left: 1.2em;
+}
+
+a.download {
+  color: white;
+  background-color: #df0019;
+  width: 100%;
+  display: block;
+  text-align: center;
+  font-size: 1.23em;
+  font-weight: bold;
+  text-decoration: none;
+  -moz-border-radius: 6px;
+  -webkit-border-radius: 6px;
+  border-radius: 6px;
+  padding: .5em 0;
+  margin-bottom: 1em;
+}
+
+a.download:hover {
+  background-color: #bb0010;
+}
+
+.rel {
+  margin-bottom: 0;
+}
+
+.rel-note {
+  color: #777;
+  font-size: .9em;
+  margin-top: .1em;
+}
+
+.logo-braces {
+  color: #df0019;
+  position: relative;
+  top: -4px;
+}
+
+.blk {
+  float: left;
+}
+
+.left {
+  width: 37em;
+  padding-right: 6.53em;
+  padding-bottom: 1em;
+}
+
+.left1 {
+  width: 15.24em;
+  padding-right: 6.45em;
+}
+
+.left2 {
+  width: 15.24em;
+}
+
+.right {
+  width: 20.68em;
+}
+
+.leftbig {
+  width: 42.44em;
+  padding-right: 6.53em;
+}
+
+.rightsmall {
+  width: 15.24em;
+}
+
+.clear:after {
+  visibility: hidden;
+  display: block;
+  font-size: 0;
+  content: " ";
+  clear: both;
+  height: 0;
+}
+.clear { display: inline-block; }
+/* start commented backslash hack \*/
+* html .clear { height: 1%; }
+.clear { display: block; }
+/* close commented backslash hack */
+</style>
+</head>
+<body>
+  <h1>CodeMirror: LDPath demo</h1>
+  <div>
+    <button onclick="javascript:createEditor()">Editor</button>
+    <button onclick="javascript:removeEditor()">Plain</button>
+  </div>
+  <form>
+    <textarea id="code" name="code">
+@prefix iptc : <http://iptc.org/std/nar/2006-10-01/> ;
+@prefix foaf ;
+@prefix rss: ;
+@prefix sioc: ;
+@filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ;
+  date = dc:date :: xsd:date(multiValued="false") ;
+  desc = dc:description[@de] :: lmf:text_en ;
+  feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ;
+  lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ;
+  summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ;
+  title = (rss:title | (html:title | dc:title)) :: lmf:text_en ;
+  user = dc:creator :: xsd:string(multiValue="false") ;
+</textarea>
+  </form>
+  <script>
+            var editor = null;
+            function createEditor() {
+                if (editor === null) {
+                    editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                        lineNumbers : true,
+                        matchBrackets : true,
+						extraKeys: {"Ctrl-Space": "ldpathAutocomplete"},
+                        mode : "ldpath"
+                    });
+                }
+            }
+            function removeEditor() {
+                if (editor) {
+                    editor.toTextArea();
+                    editor = null;
+                }
+            }
+            createEditor();
+        </script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/ldpath.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/ldpath.js b/extras/webjars/codemirror/src/main/resources/ldpath.js
new file mode 100644
index 0000000..016142f
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/ldpath.js
@@ -0,0 +1,445 @@
+/*
+ * 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.
+ */
+if (CodeMirror && CodeMirror.defineMode) {
+CodeMirror.defineMode("ldpath", function(config, parserConfig) {
+    var token = {
+        OP: "operator",
+        KWD: "keyword",
+        PREFIX: "qualifier",
+        IDENT: "atom",
+        DEF: "builtin",
+        TEST: "meta",
+        URL: "link",
+        STR: "string",
+        INT: "number",
+        BRACKET: "bracket",
+        WARNING: "string-2",
+        ERROR: "error"
+    },
+        predefinedNamespaces = parserConfig.namespaces || {},
+        baseURL = parserConfig.baseURL || null;
+    
+    function log(stream, status, result) {
+        return;
+        if (console && console.log) {
+            console.log(stream.current() + " := " + result + " (-> " + status.current() + ")");
+        }
+    }
+    
+    function getInitialState() {
+        return {
+            tmp: {},
+            namespaces: {},
+            predefinedNamespaces: predefinedNamespaces,
+            lmfBaseURL: baseURL,
+            stack: ['default'],
+            /* STACKING */
+            push: function(next) {
+                this.stack.unshift(next);
+            },
+            pop: function() {
+                if (this.stack.length <= 1) {
+                    return this.current();
+                } else {
+                    return this.stack.shift();
+                }
+            },
+            current: function() {
+                return this.stack[0];
+            },
+            reset: function() {
+                this.stack = ['default'];
+                this.tmp = {};
+            },
+            height: function() {
+                return this.stack.length;
+            },
+            /* PARSING */
+            parser: function(stream, state) {
+                var parser = parsers[this.current()] || parsers['default'];
+                return parser(stream, state);
+            },
+            /* NAMESPACES */
+            addPrefix: function(prefix, namespace) {
+                if (prefix && namespace)
+                    this.namespaces[prefix] = namespace;
+            },
+            getNamespace: function(prefix) {
+                return this.namespaces[prefix] || this.predefinedNamespaces[prefix];
+            }
+        };
+    }
+
+    function tokenError(stream, state) {
+        if (state.current() !== 'error') state.push('error');
+        stream.skipToEnd();
+        return token.ERROR;
+    }
+    
+    function tokenDefault(stream, state) {
+        // @...
+        var kw = stream.match(/^@(\w+)/, true);
+        if (kw) {
+            state.push(kw[1]);
+            return token.KWD;
+        }
+
+        // <URL>
+        if (stream.eat('<')) {
+            state.push('url');
+            return token.BRACKET;
+        }
+        if (stream.eat('[')) {
+            state.push('test');
+            return token.BRACKET;
+        }
+        if (stream.eat('(')) {
+            if (state.current() == "transformer") {
+                state.push('config');
+            }
+            return token.BRACKET;
+        }
+        if (stream.eat(')')) {
+            if (state.current() == "config") {
+                state.pop();
+            }
+            return token.BRACKET;
+        }
+        if (stream.eat(/[\]>\{\}]/)) {
+            return token.BRACKET;
+        }
+
+        // prefix:label
+        if (stream.match(/^\w+:\w*/, false)) {
+            stream.skipTo(":")
+            if (state.current() == 'prefix') {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            } else {
+                px = stream.current();
+                stream.eat(':');
+                if (state.getNamespace(px))
+                return token.PREFIX;
+                else return token.WARNING;
+            }
+        }
+
+        if (stream.match("=", true)) {
+            if (state.current() == "default") {
+                state.push("path");
+            }
+            return token.DEF;
+        }
+        if (stream.match("::", true)) {
+            state.push("transformer");
+            return token.DEF;
+        }
+        // OPERATORS
+        if (stream.eat(/[:,&\|\/^\+\*.]/)) {
+            return token.OP;
+        }
+
+        if (stream.eat('"')) {
+            if (stream.skipTo('"') && stream.eat('"'))
+                return token.STR;
+            return tokenError(stream, state);
+        }
+        
+        // NUMBERS
+        if (stream.match(/^\d+/, true)) {
+            return token.INT;
+        }
+
+        // IDENT
+        if (state.current() == "prefix") {
+            if (stream.match(/^\w+/, true)) {
+                state.tmp["prefix"] = stream.current();
+                return token.PREFIX;
+            }
+        } else {
+            if (stream.match(/^[\w.-]+/, true)) {
+                return token.IDENT;
+            }
+        }
+
+        return tokenError(stream, state);
+    }
+
+    function tokenURL(stream, state) {
+        if (stream.eat('>')) {
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.skipTo('>')) {
+            //state.pop();
+            var url = stream.current();
+            if (url.search(/^https?:\/\//) < 0 || url.search(/\s/) >= 0) {
+                return token.ERROR;
+            }
+            if (state.stack.indexOf("prefix") >= 0) {
+                state.tmp["ns"] = url;
+            }
+            return token.URL;
+        }
+        return tokenError(stream, state);
+    }
+
+    function tokenTest(stream, state) {
+        if (stream.eat(']')) {
+            state.pop();
+            return token.BRACKET;
+        }
+        if (stream.match(/@\w+/, true) || stream.match("^^", true)) {
+            return token.TEST;
+        }
+        if (stream.match("is ", false)) {
+            stream.match("is", true);
+            return token.TEST;
+        }
+        if (stream.eat(/[&\|]/)) {
+            return token.TEST;
+        }
+        return tokenDefault(stream, state);
+    }
+
+    var parsers = {
+        'default': tokenDefault,
+        filter: tokenTest,
+        url: tokenURL,
+        test: tokenTest,
+        error: tokenError
+    }
+
+
+    return {
+        startState: getInitialState,
+        compareStates: function(state1, state2) {
+            return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
+        },
+        token: function(stream, state) {
+            // ignore spaces
+            if (stream.eatSpace()) return null;
+            if (stream.eat(';')) {
+                if (state.current() == "prefix") {
+                    state.addPrefix(state.tmp['prefix'], state.tmp['ns']); 
+                }
+                log(stream, state, "RESET");
+                state.reset(); 
+                return token.OP;
+            }
+            var result = state.parser(stream, state);
+            log(stream, state, result);
+            return result;
+        },
+        electricChars: "@=[];",
+        indent: function(state, textAfter) {
+            switch (state.current()) {
+            case 'test':
+            case 'filter':
+                return 2 * config.indentUnit;
+                break;
+            case 'default':
+                // no indent for @prefix etc...
+                if (textAfter.search(/^\s*@/) == 0) {
+                    return 0;
+                }
+                return config.indentUnit;
+                break;
+            }
+            return 0;
+        }
+    }
+});
+
+// Autocompletion
+if (CodeMirror.simpleHint && jQuery) {
+    function completePrefix(editor, cur, token) {
+        var line = editor.getLine(cur.line);
+        var match = line.match(/(^|;)\s*@prefix\s+(\w+)\s*(:\s*<?)?(;|$)/);
+        if (match && match[2] && match[2] !== "") {
+            var prefix = match[2], result;
+            try {
+                jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+                    async: false,
+                    data: {prefix: prefix},
+                    success: function(data) {
+                        result = data[prefix];
+                    },
+                    dataType: "json"
+                });
+            } catch (e) {}
+            if (result !== undefined) {
+                var pfx = line.substr(0,cur.ch);
+                var st = pfx.search(/\s*(:\s*<?)?$/);
+                return {
+                    list: [ ": <"+result+">;" ],
+                    from: {line: cur.line, ch: st},
+                    to: cur
+                };
+            }
+        }
+        return false;
+    }
+    function completeURI(editor, cur, token) {
+        var bC = token.string.substr(0, cur.ch - token.start),
+        aC = token.string.substr(cur.ch - token.start),
+        replUntil = token.state.current()=='url'?token.end+1:cur.ch + Math.max(aC.search(/[\s]/), 0);
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['uri'] = bC;
+            
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    suggestions[i] = "<" + suggestions[i] + "> ";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: token.start - 1},
+              to: {line: cur.line, ch: replUntil}
+            };
+        }
+        return false;
+    }
+    function completeCUIE(editor, cur, token) {
+        var from = token.start, 
+            to = token.end, 
+            req = token.string.substr(0, cur.ch - token.start);
+        var prevToken = editor.getTokenAt({line: cur.line, ch: token.start});
+        if (token.className == 'atom' && prevToken.className == 'qualifier') {
+            from = prevToken.start;
+            req = prevToken.string + req;
+        }
+        
+        var suggestions;
+        try {
+            var qs = {};
+            if (token.state.stack.indexOf("transformer") >= 0) qs['mode'] = "transformer";
+            for (var n in token.state.namespaces) {
+                qs['ns_'+n] = token.state.getNamespace(n);
+            }
+            qs['prefix'] = req;
+
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/complete", {
+               async: false,
+               data: qs,
+               success: function(data) {
+                   suggestions = data;  
+               },
+               dataType: "json"
+            });
+        } catch (e) {}
+        if (suggestions !== undefined) {
+            for (var i = 0; i < suggestions.length; i++) {
+                if (suggestions[i].match(/^\w+:\w+(\(\))?$/)) {
+                    // curie!
+                    suggestions[i] = suggestions[i] + " ";
+                } else {
+                    // prefix only
+                    suggestions[i] = suggestions[i] + ":";
+                }
+            }
+            return {
+              list: suggestions,
+              from: {line: cur.line, ch: from},
+              to: {line: cur.line, ch: to}
+            };
+        }
+        
+        return false;
+    }
+    function insertPrefixDef(editor, cur, token) {
+        var prefix = token.string.replace(/:?$/, ""), result;
+        try {
+            jQuery.ajax(token.state.lmfBaseURL + "ldpath/util/prefix", {
+//            jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                async: false,
+                data: {prefix: prefix},
+                success: function(data) {
+                    result = data[prefix];
+                },
+                dataType: "json"
+            });
+        } catch (e) {}
+        if (result !== undefined) {
+            // check if this url is already prefixed
+            var px;
+            for (var i in token.state.namespaces) {
+                if (token.state.namespaces[i] == result) {
+                    px = i;
+                    break;
+                }
+            } 
+            if (px) {
+                return {
+                    list: [ px + ":" ],
+                    from: { line: cur.line, ch: token.start },
+                    to: { line: cur.line, ch: token.end }
+                };
+            } else {
+            return {
+                list: [ "@prefix " + prefix + ": <" + result + "> ;\n" ],
+                from: {line: 0, ch: 0},
+                to: {line: 0, ch: 0}
+            };
+            } 
+        }
+    }
+    CodeMirror.commands.ldpathAutocomplete = function(cm) {
+        CodeMirror.simpleHint(cm, function(editor) {
+            var cur = editor.getCursor();
+            var line = editor.getLine(cur.line);
+            var token = editor.getTokenAt(cur);
+        
+            if (token.state.stack.indexOf('prefix') >= 0) {
+                return completePrefix(editor, cur, token);
+            } else if (token.state.current() == 'url' || (token.state.current() == 'error' && token.state.stack[1] == 'url')) {
+                return completeURI(editor, cur, token);
+            } else if (token.className == "qualifier" || (token.className == "atom" && token.state.stack.indexOf("path") >= 0)) {
+                return completeCUIE(editor, cur, token);
+            } else if (token.className == "string-2") {
+                return insertPrefixDef(editor, cur, token);
+            } else {
+                if (console && console.log) {
+                    console.log("State: " + token.state.stack);
+                }
+            }
+        });
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/simple-hint.css
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/simple-hint.css b/extras/webjars/codemirror/src/main/resources/simple-hint.css
new file mode 100644
index 0000000..c7a040c
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/simple-hint.css
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+#center .CodeMirror-completions, .CodeMirror-completions {
+  position: absolute;
+  z-index: 10;
+  overflow: hidden;
+  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+}
+#center .CodeMirror-completions select, .CodeMirror-completions select {
+  background: #fafafa;
+  outline: none;
+  border: none;
+  padding: 0;
+  margin: 0;
+  font-family: monospace;
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/simple-hint.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/simple-hint.js b/extras/webjars/codemirror/src/main/resources/simple-hint.js
new file mode 100644
index 0000000..27f8ead
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/simple-hint.js
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+(function() {
+  CodeMirror.simpleHint = function(editor, getHints) {
+    // We want a single cursor position.
+    if (editor.somethingSelected()) return;
+    var result = getHints(editor);
+    if (!result || !result.list.length) return;
+    var completions = result.list;
+    function insert(str) {
+      editor.replaceRange(str, result.from, result.to);
+    }
+    // When there is only one completion, use it directly.
+    if (completions.length == 1) {insert(completions[0]); return true;}
+
+    // Build the select widget
+    var complete = document.createElement("div");
+    complete.className = "CodeMirror-completions";
+    var sel = complete.appendChild(document.createElement("select"));
+    // Opera doesn't move the selection when pressing up/down in a
+    // multi-select, but it does properly support the size property on
+    // single-selects, so no multi-select is necessary.
+    if (!window.opera) sel.multiple = true;
+    for (var i = 0; i < completions.length; ++i) {
+      var opt = sel.appendChild(document.createElement("option"));
+      opt.appendChild(document.createTextNode(completions[i]));
+    }
+    sel.firstChild.selected = true;
+    sel.size = Math.min(10, completions.length);
+    var pos = editor.cursorCoords();
+    complete.style.left = pos.x + "px";
+    complete.style.top = pos.yBot + "px";
+    document.body.appendChild(complete);
+    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
+    var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
+    if(winW - pos.x < sel.clientWidth)
+      complete.style.left = (pos.x - sel.clientWidth) + "px";
+    // Hack to hide the scrollbar.
+    if (completions.length <= 10)
+      complete.style.width = (sel.clientWidth - 1) + "px";
+
+    var done = false;
+    function close() {
+      if (done) return;
+      done = true;
+      complete.parentNode.removeChild(complete);
+    }
+    function pick() {
+      insert(completions[sel.selectedIndex]);
+      close();
+      setTimeout(function(){editor.focus();}, 50);
+    }
+    CodeMirror.connect(sel, "blur", close);
+    CodeMirror.connect(sel, "keydown", function(event) {
+      var code = event.keyCode;
+      // Enter
+      if (code == 13) {CodeMirror.e_stop(event); pick();}
+      // Escape
+      else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();}
+      else if (code != 38 && code != 40) {
+        close(); editor.focus();
+        // Pass the event to the CodeMirror instance so that it can handle things like backspace properly.
+        editor.triggerOnKeyDown(event);
+        setTimeout(function(){CodeMirror.simpleHint(editor, getHints);}, 50);
+      }
+    });
+    CodeMirror.connect(sel, "dblclick", pick);
+
+    sel.focus();
+    // Opera sometimes ignores focusing a freshly created node
+    if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100);
+    return true;
+  };
+})();

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/codemirror/src/main/resources/sparql.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/sparql.js b/extras/webjars/codemirror/src/main/resources/sparql.js
new file mode 100644
index 0000000..ff3ad70
--- /dev/null
+++ b/extras/webjars/codemirror/src/main/resources/sparql.js
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+CodeMirror.defineMode("sparql", function(config) {
+  var indentUnit = config.indentUnit;
+  var curPunc;
+
+  function wordRegexp(words) {
+    return new RegExp("^(?:" + words.join("|") + ")$", "i");
+  }
+  var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
+                        "isblank", "isliteral", "union", "a"]);
+  var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
+                             "ask", "from", "named", "where", "group", "order", "limit", "offset", "filter", 
+                             "optional", "graph", "by", "asc", "desc", "insert", "data", "delete"]);
+  var operatorChars = /[*+\-<>=&|]/;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    curPunc = null;
+    if (ch == "$" || ch == "?") {
+      stream.match(/^[\w\d]*/);
+      return "variable-2";
+    }
+    else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
+      stream.match(/^[^\s\u00a0>]*>?/);
+      return "atom";
+    }
+    else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenLiteral(ch);
+      return state.tokenize(stream, state);
+    }
+    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    else if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    else if (operatorChars.test(ch)) {
+      stream.eatWhile(operatorChars);
+      return null;
+    }
+    else if (ch == ":") {
+      stream.eatWhile(/[\w\d\._\-]/);
+      return "atom";
+    }
+    else {
+      stream.eatWhile(/[_\w\d]/);
+      if (stream.eat(":")) {
+        stream.eatWhile(/[\w\d_\-]/);
+        return "atom";
+      }
+      var word = stream.current(), type;
+      if (ops.test(word))
+        return null;
+      else if (keywords.test(word))
+        return "keyword";
+      else
+        return "variable";
+    }
+  }
+
+  function tokenLiteral(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      return "string";
+    };
+  }
+
+  function pushContext(state, type, col) {
+    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
+  }
+  function popContext(state) {
+    state.indent = state.context.indent;
+    state.context = state.context.prev;
+  }
+
+  return {
+    startState: function(base) {
+      return {tokenize: tokenBase,
+              context: null,
+              indent: 0,
+              col: 0};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (state.context && state.context.align == null) state.context.align = false;
+        state.indent = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+
+      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
+        state.context.align = true;
+      }
+
+      if (curPunc == "(") pushContext(state, ")", stream.column());
+      else if (curPunc == "[") pushContext(state, "]", stream.column());
+      else if (curPunc == "{") pushContext(state, "}", stream.column());
+      else if (/[\]\}\)]/.test(curPunc)) {
+        while (state.context && state.context.type == "pattern") popContext(state);
+        if (state.context && curPunc == state.context.type) popContext(state);
+      }
+      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
+      else if (/atom|string|variable/.test(style) && state.context) {
+        if (/[\}\]]/.test(state.context.type))
+          pushContext(state, "pattern", stream.column());
+        else if (state.context.type == "pattern" && !state.context.align) {
+          state.context.align = true;
+          state.context.col = stream.column();
+        }
+      }
+      
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var firstChar = textAfter && textAfter.charAt(0);
+      var context = state.context;
+      if (/[\]\}]/.test(firstChar))
+        while (context && context.type == "pattern") context = context.prev;
+
+      var closing = context && firstChar == context.type;
+      if (!context)
+        return 0;
+      else if (context.type == "pattern")
+        return context.col;
+      else if (context.align)
+        return context.col + (closing ? 0 : 1);
+      else
+        return context.indent + (closing ? 0 : indentUnit);
+    }
+  };
+});
+
+if (CodeMirror.simpleHint && jQuery) {
+    function completePrefix(editor, cur, token, prevToken) {
+        var line = editor.getLine(cur.line);
+        var match = line.match(/(^|;)\s*PREFIX\s+(\w+)\s*(:\s*<?)?(;|$)/);
+        if (match && match[2] && match[2] !== "") {
+            var prefix = match[2], result;
+            try {
+                jQuery.ajax("http://prefix.cc/" + prefix + ".file.json", {
+                    async: false,
+                    success: function(data) {
+                        result = data[prefix];
+                    },
+                    dataType: "json"
+                });
+            } catch (e) {}
+            if (result !== undefined) {
+                var pfx = line.substr(0,cur.ch);
+                var st = pfx.search(/\s*(:\s*<?)?$/);
+                return {
+                    list: [ ": <"+result+">" ],
+                    from: {line: cur.line, ch: st},
+                    to: cur
+                };
+            }
+        }
+        return false;
+    }
+    CodeMirror.commands.sparqlAutocomplete = function(cm) {
+        CodeMirror.simpleHint(cm, function(editor) {
+            var cur = editor.getCursor();
+            var line = editor.getLine(cur.line);
+
+            // search for the last prefix
+            for(i = cur.ch; i >= 0; i--) {
+                var token = editor.getTokenAt({line: cur.line, ch: i});
+                if(token.className == "keyword" && token.string == "PREFIX") {
+                    break;
+                }
+            }
+            console.dir(token);
+
+            // search for the next atom
+            for(i = token.end + 1; i <= cur.ch; i++) {
+                var atomToken = editor.getTokenAt({line: cur.line, ch: i});
+                if(atomToken.className == "atom") {
+                    break;
+                }
+            }
+            console.dir(atomToken);
+
+
+            if (atomToken.className == "atom") {
+                return completePrefix(editor, cur, atomToken, token);
+            }
+        });
+    }
+}
+
+
+CodeMirror.defineMIME("application/x-sparql-query", "sparql");

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/pom.xml b/extras/webjars/pom.xml
new file mode 100644
index 0000000..a37c28b
--- /dev/null
+++ b/extras/webjars/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>webjars</artifactId>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>snorql</module>
+        <module>codemirror</module>
+        <module>sgvizler</module>
+    </modules>
+    
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/pom.xml b/extras/webjars/sgvizler/pom.xml
new file mode 100644
index 0000000..73ef370
--- /dev/null
+++ b/extras/webjars/sgvizler/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.marmotta.webjars</groupId>
+    <artifactId>sgvizler</artifactId>
+    <version>0.5.1</version>
+    <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}/${project.version}/sgvizler.js</output>
+                </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}/${project.version}</targetPath>
+            </resource>
+        </resources>
+     </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/LICENSE
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/LICENSE b/extras/webjars/sgvizler/src/main/resources/LICENSE
new file mode 100644
index 0000000..0e50dba
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/LICENSE
@@ -0,0 +1,16 @@
+Copyright (c) 2011 Martin G. Skjæveland
+
+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 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.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5fd590b4/extras/webjars/sgvizler/src/main/resources/REVISION
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/src/main/resources/REVISION b/extras/webjars/sgvizler/src/main/resources/REVISION
new file mode 100644
index 0000000..4dc1283
--- /dev/null
+++ b/extras/webjars/sgvizler/src/main/resources/REVISION
@@ -0,0 +1 @@
+172:173