You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by an...@apache.org on 2013/10/01 01:48:26 UTC
[34/51] [partial] Revert "Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/incubator-marmotta"
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4aa87dbe/extras/webjars/codemirror/src/main/resources/ldpath.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/ldpath.html b/extras/webjars/codemirror/src/main/resources/ldpath.html
deleted file mode 100644
index 4a0ea12..0000000
--- a/extras/webjars/codemirror/src/main/resources/ldpath.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!--
-
- 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>
- Read about the <a href="http://marmotta.incubator.apache.org/ldpath/language.html" title="LDPath">LDPath Syntax</a>
- in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
- </div>
- <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/4aa87dbe/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
deleted file mode 100644
index a5eb1a4..0000000
--- a/extras/webjars/codemirror/src/main/resources/ldpath.js
+++ /dev/null
@@ -1,471 +0,0 @@
-/*
- * 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 = {
- COMMENT: "comment",
- 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) {
- // /* ... */
- if (stream.match('/*')) {
- state.push('comment');
- return token.COMMENT;
- }
-
- // @...
- 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-a", 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) {
- // parse comments
- if (state.current() == "comment") {
- stream.skipTo('*') || stream.skipToEnd();
- if (stream.match('*/')) {
- state.pop();
- } else stream.eat('*');
- return token.COMMENT;
- } else if (stream.match('/*')) {
- state.tmp.commentStart = stream.column();
- state.push("comment");
- return this.token(stream, state);
- }
- // ignore spaces
- if (stream.eatSpace()) return null;
- // ; starts parsing from scratch
- 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 'comment':
- return state.tmp.commentStart +(textAfter.search(/^\s*\*\//)==0?1:3);
- break;
- 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/4aa87dbe/extras/webjars/codemirror/src/main/resources/matchbrackets.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/matchbrackets.js b/extras/webjars/codemirror/src/main/resources/matchbrackets.js
deleted file mode 100644
index 131fe83..0000000
--- a/extras/webjars/codemirror/src/main/resources/matchbrackets.js
+++ /dev/null
@@ -1,86 +0,0 @@
-(function() {
- var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
- (document.documentMode == null || document.documentMode < 8);
-
- var Pos = CodeMirror.Pos;
-
- var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
- function findMatchingBracket(cm, where, strict) {
- var state = cm.state.matchBrackets;
- var maxScanLen = (state && state.maxScanLineLength) || 10000;
-
- var cur = where || cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
- var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
- if (!match) return null;
- var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
- if (strict && forward != (pos == cur.ch)) return null;
- var style = cm.getTokenTypeAt(Pos(cur.line, pos + 1));
-
- var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
- function scan(line, lineNo, start) {
- if (!line.text) return;
- var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
- if (line.text.length > maxScanLen) return null;
- if (start != null) pos = start + d;
- for (; pos != end; pos += d) {
- var ch = line.text.charAt(pos);
- if (re.test(ch) && cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style) {
- var match = matching[ch];
- if (match.charAt(1) == ">" == forward) stack.push(ch);
- else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
- else if (!stack.length) return {pos: pos, match: true};
- }
- }
- }
- for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) {
- if (i == cur.line) found = scan(line, i, pos);
- else found = scan(cm.getLineHandle(i), i);
- if (found) break;
- }
- return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos),
- match: found && found.match, forward: forward};
- }
-
- function matchBrackets(cm, autoclear) {
- // Disable brace matching in long lines, since it'll cause hugely slow updates
- var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
- var found = findMatchingBracket(cm);
- if (!found || cm.getLine(found.from.line).length > maxHighlightLen ||
- found.to && cm.getLine(found.to.line).length > maxHighlightLen)
- return;
-
- var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
- var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style});
- var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style});
- // Kludge to work around the IE bug from issue #1193, where text
- // input stops going to the textare whever this fires.
- if (ie_lt8 && cm.state.focused) cm.display.input.focus();
- var clear = function() {
- cm.operation(function() { one.clear(); two && two.clear(); });
- };
- if (autoclear) setTimeout(clear, 800);
- else return clear;
- }
-
- var currentlyHighlighted = null;
- function doMatchBrackets(cm) {
- cm.operation(function() {
- if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
- if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
- });
- }
-
- CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
- if (old && old != CodeMirror.Init)
- cm.off("cursorActivity", doMatchBrackets);
- if (val) {
- cm.state.matchBrackets = typeof val == "object" ? val : {};
- cm.on("cursorActivity", doMatchBrackets);
- }
- });
-
- CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
- CodeMirror.defineExtension("findMatchingBracket", function(pos, strict){
- return findMatchingBracket(this, pos, strict);
- });
-})();
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4aa87dbe/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
deleted file mode 100644
index 2deea4e..0000000
--- a/extras/webjars/codemirror/src/main/resources/simple-hint.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* CodeMirror version 2.24
- *
- * License: MIT-License <http://codemirror.net/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/4aa87dbe/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
deleted file mode 100644
index ad0f5eb..0000000
--- a/extras/webjars/codemirror/src/main/resources/simple-hint.js
+++ /dev/null
@@ -1,80 +0,0 @@
-// CodeMirror version 2.24
-//
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-//
-// License: MIT-License <http://codemirror.net/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/4aa87dbe/extras/webjars/codemirror/src/main/resources/skwrl.html
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/skwrl.html b/extras/webjars/codemirror/src/main/resources/skwrl.html
deleted file mode 100644
index 6ed695b..0000000
--- a/extras/webjars/codemirror/src/main/resources/skwrl.html
+++ /dev/null
@@ -1,254 +0,0 @@
-<!--
-
- 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: SKWRL 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="skwrl.js"></script>
-
-<link rel="stylesheet" href="skwrl.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: SKWRL demo</h1>
- <div>
- Read about the <a href="http://marmotta.incubator.apache.org/kiwi/reasoner.html" title="Simple KiWi Reasoning Language">SKWRL Langugae</a>
- in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>.
- </div>
- <div>
- <button onclick="javascript:createEditor()">Editor</button>
- <button onclick="javascript:removeEditor()">Plain</button>
- </div>
- <form>
-<textarea id="code" name="code">
-/* rules taken from http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#RDFRules */
-@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
-@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
-@prefix xsd: <http://www.w3.org/2001/XMLSchema#>
-@prefix foaf: <http://xmlns.com/foaf/0.1/>
-
-rdf1: ($u $a $y) -> ($a rdf:type rdf:Property)
-rdfs2: ($a rdfs:domain $x), ($u $a $y) -> ($u rdf:type $x)
-rdfs3: ($a rdfs:range $x), ($u $a $v) -> ($v rdf:type $x)
-rdfs4a: ($u $a $x) -> ($u rdf:type rdfs:Resource)
-rdfs5: ($u rdfs:subPropertyOf $v), ($v rdfs:subPropertyOf $x) -> ($u rdfs:subPropertyOf $x)
-rdfs6: ($u rdf:type rdf:Property) -> ($u rdfs:subPropertyOf $u)
-rdfs7: ($a rdfs:subPropertyOf $b), ($u $a $y) -> ($u $b $y)
-rdfs8: ($u rdf:type rdfs:Class) -> ($u rdfs:subClassOf rdfs:Resource)
-rdfs9: ($u rdfs:subClassOf $x), ($v rdf:type $u) -> ($v rdf:type $x)
-rdfs10: ($u rdf:type rdfs:Class) -> ($u rdfs:subClassOf $u)
-rdfs11: ($u rdfs:subClassOf $v), ($v rdfs:subClassOf $x) -> ($u rdfs:subClassOf $x)
-rdfs12: ($u rdf:type rdfs:ContainerMembershipProperty) -> ($u rdfs:subPropertyOf rdfs:member)
-rdfs13: ($u rdf:type rdfs:Datatype) -> ($u rdfs:subClassOf rdfs:Literal)
-
-</textarea>
- </form>
- <script>
- var editor = null;
- function createEditor() {
- if (editor === null) {
- editor = CodeMirror.fromTextArea(document.getElementById("code"), {
- lineNumbers : true,
- matchBrackets : true,
- extraKeys: {"Ctrl-Space": "skwrlAutocomplete"},
- mode : "skwrl"
- });
- }
- }
- function removeEditor() {
- if (editor) {
- editor.toTextArea();
- editor = null;
- }
- }
- createEditor();
- </script>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4aa87dbe/extras/webjars/codemirror/src/main/resources/skwrl.js
----------------------------------------------------------------------
diff --git a/extras/webjars/codemirror/src/main/resources/skwrl.js b/extras/webjars/codemirror/src/main/resources/skwrl.js
deleted file mode 100644
index 7de04c3..0000000
--- a/extras/webjars/codemirror/src/main/resources/skwrl.js
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * 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("skwrl", function(config, parserConfig) {
- var token = {
- COMMENT: "comment",
- KWD: "keyword",
- IDENT: "atom",
- OP: "operator",
- BRACKET: "bracket",
- URL: "link",
- VAR: "variable-3",
- PREFIX: "qualifier",
- DEF: "variable",
- 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) {
- if (kw[1] == "prefix") {
- state.push(kw[1]);
- return token.KWD;
- } else return token.ERROR;
- }
-
- // <URL>
- if (stream.eat('<')) {
- state.push('url');
- return token.BRACKET;
- }
-
- if (stream.eat('(')) {
- state.tmp['rule'] = 0;
- state.push('rule');
- return token.BRACKET;
- }
- if (stream.eat(')')) {
- if (state.current() != 'rule') return token.ERROR;
- 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 if (state.current() == 'default') {
- return token.DEF;
- } else {
- px = stream.current();
- stream.eat(':');
- if (state.getNamespace(px))
- return token.PREFIX;
- else return token.WARNING;
- }
- }
-
- if (stream.match("->", true)) {
- return token.DEF;
- }
- // OPERATORS
- if (stream.eat(/[:,]/)) {
- return token.OP;
- }
-
-
- // IDENT
- if (state.current() == "prefix") {
-
- } else {
- if (stream.match(/^[\w.-]+/, true)) {
- return token.IDENT;
- }
- }
-
- return tokenError(stream, state);
- }
-
- function tokenRule(stream, state) {
- if (stream.eat(')')) {
- state.pop();
- if (state.tmp['rule'] != 3) return token.ERROR;
- return token.BRACKET;
- } else if (state.tmp['rule'] >= 3) {
- state.tmp['rule'] = 4;
- stream.skipTo(')') || stream.next();
- return token.ERROR;
- } else
- // <URL>
- if (stream.eat('<')) {
- state.push('url');
- return token.BRACKET;
- } else if (stream.eat('>')) {
- state.tmp['rule']++;
- return token.BRACKET;
- } else
- // $s
- if (stream.match(/^\$\w+/)) {
- state.tmp['rule']++;
- return token.VAR;
- } else
- // ns:local
- if (stream.match(/^\w+:\w*/, false)) {
- stream.skipTo(':');
- var px = stream.current();
- stream.eat(':');
- if (!stream.match(/^\w+/, false)) {
- return token.ERROR;
- } else if (state.getNamespace(px))
- return token.PREFIX;
- else return token.WARNING;
- } else if (stream.match(/^\w+/)) {
- state.tmp['rule']++;
- return token.IDENT;
- } else if (stream.eat(')')) {
- state.pop();
- if (state.tmp['rule'] != 3) return token.ERROR;
- return token.BRACKET;
- } else {
- stream.next();
- return token.ERROR;
- }
-
- return tokenError(stream, state);
- }
-
- function tokenPrefix(stream, state) {
- if (stream.match(/^\w+/, true)) {
- state.tmp["prefix"] = stream.current();
- return token.PREFIX;
- } else if (stream.eat(':')) {
- return token.OP;
- } else
- // <URL>
- if (stream.eat('<')) {
- state.push('url');
- return token.BRACKET;
- } else if (stream.eat('>')) {
- if (state.tmp['prefix'] && state.tmp['ns']) {
- state.addPrefix(state.tmp['prefix'], state.tmp['ns']);
- state.reset();
- // End of prefix state:
- state.pop();
- return token.BRACKET;
- } else return token.ERROR;
- }
-
- return tokenError(stream, state);
- }
-
- function tokenURL(stream, state) {
- if (stream.skipTo('>')) {
- state.pop();
- var url = stream.current();
- if (url.search(/\s/) >= 0) {
- return token.ERROR;
- }
- if (state.stack.indexOf("prefix") >= 0) {
- state.tmp["ns"] = url;
- }
- return token.URL;
- }
- return tokenError(stream, state);
- }
-
- var parsers = {
- 'default': tokenDefault,
- rule: tokenRule,
- prefix: tokenPrefix,
- url: tokenURL,
- error: tokenError
- };
-
-
-
- return {
- startState: getInitialState,
- compareStates: function(state1, state2) {
- return state1.stack == state2.stack && state1.namespaces == state2.namespaces;
- },
- token: function(stream, state) {
- // parse comments
- if (state.current() == "comment") {
- stream.skipTo('*') || stream.skipToEnd();
- if (stream.match('*/')) {
- state.pop();
- } else stream.eat('*');
- return token.COMMENT;
- } else if (stream.match('/*')) {
- state.tmp.commentStart = stream.column();
- state.push("comment");
- return this.token(stream, state);
- }
- // ignore spaces
- if (stream.eatSpace()) return null;
- // ; starts parsing from scratch
- /*
- 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 'comment':
- return state.tmp.commentStart +(textAfter.search(/^\s*\*\//)==0?1:3);
- 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", {
- 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) {
- 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) {
- return false; // No completion here in skwrl
- 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) {
- return false; // no completion here in skwrl
- 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.skwrlAutocomplete = 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/4aa87dbe/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
deleted file mode 100644
index 8ffa73b..0000000
--- a/extras/webjars/codemirror/src/main/resources/sparql.js
+++ /dev/null
@@ -1,210 +0,0 @@
-// CodeMirror version 2.24
-//
-// All functions that need access to the editor's state live inside
-// the CodeMirror function. Below that, at the bottom of the file,
-// some utilities are defined.
-//
-// License: MIT-License <http://codemirror.net/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/4aa87dbe/extras/webjars/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/pom.xml b/extras/webjars/pom.xml
deleted file mode 100644
index 98034fc..0000000
--- a/extras/webjars/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?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.2.0-incubating-SNAPSHOT</version>
- <relativePath>../../parent/</relativePath>
- </parent>
-
- <groupId>org.apache.marmotta.webjars</groupId>
- <artifactId>webjars</artifactId>
- <packaging>pom</packaging>
-
- <build>
- <plugins>
- <plugin>
- <!-- this is a reactor, no checking -->
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <modules>
- <module>snorql</module>
- <module>codemirror</module>
- <module>sgvizler</module>
- <module>strftime</module>
- </modules>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4aa87dbe/extras/webjars/sgvizler/pom.xml
----------------------------------------------------------------------
diff --git a/extras/webjars/sgvizler/pom.xml b/extras/webjars/sgvizler/pom.xml
deleted file mode 100644
index 30ad9f1..0000000
--- a/extras/webjars/sgvizler/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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.2.0-incubating-SNAPSHOT</version>
- <relativePath>../../../parent/</relativePath>
- </parent>
-
- <properties>
- <webjar.version>0.5.1</webjar.version>
- </properties>
-
- <groupId>org.apache.marmotta.webjars</groupId>
- <artifactId>sgvizler</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}/sgvizler.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>