http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java new file mode 100644 index 0000000..2b9aec2 --- /dev/null +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/QueryValidator.java @@ -0,0 +1,154 @@ +/* + * 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. + */ + +package org.apache.jena.fuseki.validation ; + +import org.apache.jena.atlas.io.IndentedLineBuffer ; +import org.apache.jena.atlas.json.JsonBuilder ; +import org.apache.jena.atlas.json.JsonObject ; +import org.apache.jena.fuseki.servlets.ServletOps ; + +import com.hp.hpl.jena.query.Query ; +import com.hp.hpl.jena.query.QueryFactory ; +import com.hp.hpl.jena.query.QueryParseException ; +import com.hp.hpl.jena.query.Syntax ; +import com.hp.hpl.jena.sparql.algebra.Algebra ; +import com.hp.hpl.jena.sparql.algebra.Op ; +import com.hp.hpl.jena.sparql.serializer.SerializationContext ; + +public class QueryValidator extends ValidatorBaseJson { + public QueryValidator() {} + + @Override + protected String validatorName() { + return "SPARQL Query" ; + } + + static final String paramQuery = "query" ; + static final String paramSyntax = "languageSyntax" ; + + static final String jInput = "input" ; + + static final String jFormatted = "formatted" ; + static final String jAlgebra = "algebra" ; + static final String jAlgebraQuads = "algebra-quads" ; + static final String jAlgebraOpt = "algebra-opt" ; + static final String jAlgebraOptQuads = "algebra-opt-quads" ; + + @Override + protected JsonObject execute(ValidationAction action) { + JsonBuilder obj = new JsonBuilder() ; + obj.startObject() ; + + final String queryString = getArg(action, paramQuery) ; + + String querySyntax = getArgOrNull(action, paramSyntax) ; + if ( querySyntax == null || querySyntax.equals("") ) + querySyntax = "SPARQL" ; + + Syntax language = Syntax.lookup(querySyntax) ; + if ( language == null ) { + ServletOps.errorBadRequest("Unknown syntax: " + querySyntax) ; + return null ; + } + + boolean outputSPARQL = true ; + boolean outputAlgebra = true ; + boolean outputQuads = true ; + boolean outputOptimized = true ; + boolean outputOptimizedQuads = true ; + + obj.key(jInput).value(queryString) ; + + // Attempt to parse it. + Query query = null ; + try { + query = QueryFactory.create(queryString, "http://example/base/", language) ; + } catch (QueryParseException ex) { + obj.key(jErrors) ; + obj.startArray() ; // Errors array + obj.startObject() ; + obj.key(jParseError).value(ex.getMessage()) ; + obj.key(jParseErrorLine).value(ex.getLine()) ; + obj.key(jParseErrorCol).value(ex.getColumn()) ; + obj.finishObject() ; + obj.finishArray() ; + + obj.finishObject() ; // Outer object + return obj.build().getAsObject() ; + } + + if ( query != null ) { + + if ( outputSPARQL ) + formatted(obj, query) ; + + if ( outputAlgebra ) + algebra(obj, query) ; + + if ( outputQuads ) + algebraQuads(obj, query) ; + + if ( outputOptimized ) + algebraOpt(obj, query) ; + + if ( outputOptimizedQuads ) + algebraOptQuads(obj, query) ; + } + + obj.finishObject() ; + return obj.build().getAsObject() ; + } + + private void formatted(JsonBuilder obj, Query query) { + IndentedLineBuffer out = new IndentedLineBuffer() ; + query.serialize(out) ; + obj.key(jFormatted).value(out.asString()) ; + } + + private void algebra(JsonBuilder obj, Query query) { + Op op = Algebra.compile(query) ; + obj.key(jAlgebra).value(string(query, op)) ; + } + + private void algebraQuads(JsonBuilder obj, Query query) { + Op op = Algebra.compile(query) ; + op = Algebra.toQuadForm(op) ; + obj.key(jAlgebraQuads).value(string(query, op)) ; + } + + private void algebraOpt(JsonBuilder obj, Query query) { + Op op = Algebra.compile(query) ; + op = Algebra.optimize(op) ; + obj.key(jAlgebraOpt).value(string(query, op)) ; + } + + private void algebraOptQuads(JsonBuilder obj, Query query) { + Op op = Algebra.compile(query) ; + op = Algebra.toQuadForm(op) ; + op = Algebra.optimize(op) ; + obj.key(jAlgebraOptQuads).value(string(query, op)) ; + } + + private String string(Query query, Op op) { + final SerializationContext sCxt = new SerializationContext(query) ; + IndentedLineBuffer out = new IndentedLineBuffer() ; + op.output(out, sCxt) ; + return out.asString() ; + } +}
http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java new file mode 100644 index 0000000..4e93438 --- /dev/null +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/UpdateValidator.java @@ -0,0 +1,91 @@ +/** + * 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. + */ + +package org.apache.jena.fuseki.validation; + +import org.apache.jena.atlas.io.IndentedLineBuffer ; +import org.apache.jena.atlas.json.JsonBuilder ; +import org.apache.jena.atlas.json.JsonObject ; +import org.apache.jena.fuseki.servlets.ServletOps ; + +import com.hp.hpl.jena.query.QueryParseException ; +import com.hp.hpl.jena.query.Syntax ; +import com.hp.hpl.jena.update.UpdateFactory ; +import com.hp.hpl.jena.update.UpdateRequest ; + +public class UpdateValidator extends ValidatorBaseJson { + public UpdateValidator() {} + + static final String paramUpdate = "update" ; + static final String paramSyntax = "languageSyntax" ; + + static final String jInput = "input" ; + static final String jFormatted = "formatted" ; + + @Override + protected JsonObject execute(ValidationAction action) { + JsonBuilder obj = new JsonBuilder() ; + obj.startObject() ; + + final String updateString = getArg(action, paramUpdate) ; + String updateSyntax = getArgOrNull(action, paramSyntax) ; + if ( updateSyntax == null || updateSyntax.equals("") ) + updateSyntax = "SPARQL" ; + + Syntax language = Syntax.lookup(updateSyntax) ; + if ( language == null ) { + ServletOps.errorBadRequest("Unknown syntax: " + updateSyntax) ; + return null ; + } + + obj.key(jInput).value(updateString) ; + UpdateRequest request = null ; + try { + request = UpdateFactory.create(updateString, "http://example/base/", language) ; + } catch (QueryParseException ex) { + obj.key(jErrors) ; + obj.startArray() ; // Errors array + obj.startObject() ; + obj.key(jParseError).value(ex.getMessage()) ; + obj.key(jParseErrorLine).value(ex.getLine()) ; + obj.key(jParseErrorCol).value(ex.getColumn()) ; + obj.finishObject() ; + obj.finishArray() ; + + obj.finishObject() ; // Outer object + return obj.build().getAsObject() ; + } + + formatted(obj, request) ; + + obj.finishObject() ; + return obj.build().getAsObject() ; + } + + private void formatted(JsonBuilder obj, UpdateRequest updateRequest) { + IndentedLineBuffer out = new IndentedLineBuffer() ; + updateRequest.output(out) ; + obj.key(jFormatted).value(out.asString()) ; + } + + @Override + protected String validatorName() { + return "SPARQL Update" ; + } +} + http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationAction.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationAction.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationAction.java new file mode 100644 index 0000000..648d6c1 --- /dev/null +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationAction.java @@ -0,0 +1,95 @@ +/* + * 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. + */ + +package org.apache.jena.fuseki.validation; + +import java.util.HashMap ; +import java.util.Map ; + +import javax.servlet.http.HttpServletRequest ; +import javax.servlet.http.HttpServletResponse ; + +import org.apache.jena.atlas.logging.Log ; +import org.slf4j.Logger ; + +public class ValidationAction +{ + public final boolean verbose ; + public final long id ; + public final Logger log ; + private boolean startTimeIsSet = false ; + private boolean finishTimeIsSet = false ; + + private long startTime = -2 ; + private long finishTime = -2 ; + + // Outcome. + int statusCode = -1 ; + String message = null ; + int contentLength = -1 ; + String contentType = null ; + + Map <String, String> headers = new HashMap<>() ; + public HttpServletRequest request; + public HttpServletResponse response ; + + public ValidationAction(long id, Logger log, HttpServletRequest request, HttpServletResponse response, boolean verbose) { + this.id = id ; + this.log = log ; + this.request = request ; + this.response = response ; + this.verbose = false ; + } + + /** Reduce to a size that can be kept around for sometime */ + public void minimize() { + this.request = null ; + this.response = null ; + } + + public void setStartTime() { + if ( startTimeIsSet ) + Log.warn(this, "Start time reset") ; + startTimeIsSet = true ; + this.startTime = System.nanoTime() ; + } + + public void setFinishTime() { + if ( finishTimeIsSet ) + Log.warn(this, "Finish time reset") ; + finishTimeIsSet = true ; + this.finishTime = System.nanoTime() ; + } + + public HttpServletRequest getRequest() { return request ; } + + public HttpServletResponse getResponse() { return response ; } + + /** Return the recorded time taken in milliseconds. + * {@linkplain #setStartTime} and {@linkplain #setFinishTime} + * must have been called. + */ + public long getTime() + { + if ( ! startTimeIsSet ) + Log.warn(this, "Start time not set") ; + if ( ! finishTimeIsSet ) + Log.warn(this, "Finish time not set") ; + return (finishTime-startTime)/(1000*1000) ; + } +} http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationError.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationError.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationError.java new file mode 100644 index 0000000..6b173a7 --- /dev/null +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidationError.java @@ -0,0 +1,24 @@ +/** + * 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. + */ + +package org.apache.jena.fuseki.validation; + +public class ValidationError { + +} + http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidatorBaseJson.java ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidatorBaseJson.java b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidatorBaseJson.java new file mode 100644 index 0000000..98cf258 --- /dev/null +++ b/jena-fuseki2/src/main/java/org/apache/jena/fuseki/validation/ValidatorBaseJson.java @@ -0,0 +1,201 @@ +/* + * 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. + */ + +package org.apache.jena.fuseki.validation; + +import static java.lang.String.format ; + +import java.io.OutputStream ; +import java.util.Enumeration ; + +import javax.servlet.http.HttpServletRequest ; +import javax.servlet.http.HttpServletResponse ; + +import org.apache.jena.atlas.json.JSON ; +import org.apache.jena.atlas.json.JsonObject ; +import org.apache.jena.fuseki.Fuseki ; +import org.apache.jena.riot.web.HttpNames ; +import org.apache.jena.fuseki.servlets.ActionErrorException ; +import org.apache.jena.fuseki.servlets.ActionLib ; +import org.apache.jena.fuseki.servlets.ServletBase ; +import org.apache.jena.fuseki.servlets.ServletOps ; +import static org.apache.jena.riot.WebContent.* ; +import org.apache.jena.web.HttpSC ; +import org.slf4j.Logger ; + +import com.hp.hpl.jena.query.ARQ ; +import com.hp.hpl.jena.sparql.util.Context ; + +/** ValidationBase for JSON out */ +public abstract class ValidatorBaseJson extends ServletBase +{ + private static Logger vLog = Fuseki.validationLog ; + public static final String jErrors = "errors" ; + public static final String jWarnings = "warning" ; + + public static final String jParseError = "parse-error" ; + public static final String jParseErrorLine = "parse-error-line" ; + public static final String jParseErrorCol = "parse-error-column" ; + + public static final String respService = "X-Service" ; + + @Override + public void doGet(HttpServletRequest httpRequest, HttpServletResponse httpResponse) + { execute(httpRequest, httpResponse) ; } + + @Override + public void doPost(HttpServletRequest httpRequest, HttpServletResponse httpResponse) + { execute(httpRequest, httpResponse) ; } + + protected void execute(HttpServletRequest request, HttpServletResponse response) { + long id = allocRequestId(request, response) ; + ValidationAction action = new ValidationAction(id, vLog, request, response, false) ; + printRequest(action) ; + action.setStartTime() ; + + response = action.response ; + initResponse(request, response) ; + Context cxt = ARQ.getContext() ; + + try { + JsonObject obj = execute(action) ; + action.statusCode = HttpSC.OK_200 ; + action.message = "OK" ; + response.setCharacterEncoding(charsetUTF8); + response.setContentType(contentTypeJSON); + //response.setContentType(WebContent.contentTypeTextPlain); + action.response.setStatus(HttpSC.OK_200) ; + OutputStream out = response.getOutputStream() ; + JSON.write(out, obj); + } catch (ActionErrorException ex) { + if ( ex.exception != null ) + ex.exception.printStackTrace(System.err) ; + if ( ex.message != null ) + ServletOps.responseSendError(response, ex.rc, ex.message) ; + else + ServletOps.responseSendError(response, ex.rc) ; + } catch (Throwable th) { + ServletOps.responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500, "Internal Error") ; + } + action.setFinishTime() ; + printResponse(action) ; + } + + private void initResponse(HttpServletRequest request, HttpServletResponse response) + { + setCommonHeaders(response) ; + String method = request.getMethod() ; + // All GET and HEAD operations are sensitive to conneg so ... + if ( HttpNames.METHOD_GET.equalsIgnoreCase(method) || HttpNames.METHOD_HEAD.equalsIgnoreCase(method) ) + setVaryHeader(response) ; + } + + private void printRequest(ValidationAction action) + { + String url = ActionLib.wholeRequestURL(action.request) ; + String method = action.request.getMethod() ; + + action.log.info(format("[%d] %s %s", action.id, method, url)) ; + if ( action.verbose ) { + Enumeration<String> en = action.request.getHeaderNames() ; + for (; en.hasMoreElements();) { + String h = en.nextElement() ; + Enumeration<String> vals = action.request.getHeaders(h) ; + if (!vals.hasMoreElements()) + action.log.info(format("[%d] ", action.id, h)) ; + else { + for (; vals.hasMoreElements();) + action.log.info(format("[%d] %-20s %s", action.id, h, vals.nextElement())) ; + } + } + } + } + + private void printResponse(ValidationAction action) + { + long time = action.getTime() ; + + HttpServletResponse response = action.response ; + if ( action.verbose ) + { +// if ( action.contentType != null ) +// log.info(format("[%d] %-20s %s", action.id, HttpNames.hContentType, action.contentType)) ; +// if ( action.contentLength != -1 ) +// log.info(format("[%d] %-20s %d", action.id, HttpNames.hContentLengh, action.contentLength)) ; +// for ( Map.Entry<String, String> e: action.headers.entrySet() ) +// log.info(format("[%d] %-20s %s", action.id, e.getKey(), e.getValue())) ; + } + + String timeStr = fmtMillis(time) ; + + if ( action.message == null ) + action.log.info(String.format("[%d] %d %s (%s) ", action.id, action.statusCode, HttpSC.getMessage(action.statusCode), timeStr)) ; + else + action.log.info(String.format("[%d] %d %s (%s) ", action.id, action.statusCode, action.message, timeStr)) ; + } + + private static String fmtMillis(long time) + { + // Millis only? seconds only? + if ( time < 1000 ) + return String.format("%,d ms", time) ; + return String.format("%,.3f s", time/1000.0) ; + } + + protected abstract JsonObject execute(ValidationAction action) ; + + protected abstract String validatorName() ; + + protected void setHeaders(HttpServletResponse httpResponse) + { + httpResponse.setCharacterEncoding(charsetUTF8) ; + httpResponse.setContentType(contentTypeJSON) ; + httpResponse.setHeader(respService, "Jena Fuseki Validator / "+validatorName()+": http://jena.apache.org/") ; + } + + protected static String getArg(ValidationAction action, String paramName) { + String arg = getArgOrNull(action, paramName) ; + if ( arg == null ) { + ServletOps.error(HttpSC.BAD_REQUEST_400, "No parameter given: " + paramName) ; + return null ; + } + return arg ; + } + + protected static String getArgOrNull(ValidationAction action, String paramName) { + String[] args = getArgs(action, paramName) ; + + if ( args == null || args.length == 0 ) + return null ; + + if ( args.length > 1 ) { + ServletOps.error(HttpSC.BAD_REQUEST_400, "Too many ("+args.length+") parameter values: "+paramName) ; + return null ; + } + + return args[0] ; + } + + protected static String[] getArgs(ValidationAction action, String paramName) { + String[] args = action.request.getParameterValues(paramName) ; + if ( args == null || args.length == 0 ) + return null ; + return args ; + } +} + http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/META-INF/DEPENDENCIES ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/META-INF/DEPENDENCIES b/jena-fuseki2/src/main/resources/META-INF/DEPENDENCIES new file mode 100644 index 0000000..910b788 --- /dev/null +++ b/jena-fuseki2/src/main/resources/META-INF/DEPENDENCIES @@ -0,0 +1,24 @@ +This file lists the dependences for Apache Jena Fuseki. + Version numbers are given in the POM file for a particular distribution. + +Apache Projects: Apache Software License + Apache Jena, including the Jena IRI library + Apache Xerces-J + Apache log4j + Apache HttpComponents (HTTP Client) + Apache Commons Codec + Apache Common FileUpload + +ICU4J : http://icu-project.org/ + IBM X License (to version ICU4J 3.4.4) + +SLF4J : http://www.slf4j.org/ + Copyright (c) 2004-2008 QOS.ch + MIT License + +JUnit : http://junit.org/ + Common Public License - v 1.0 + +Jetty: http://www.eclipse.org/jetty/ + Apache License 2.0 + (also avilable under Eclipse Public License 1.0) http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/META-INF/LICENSE ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/META-INF/LICENSE b/jena-fuseki2/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000..23519cd --- /dev/null +++ b/jena-fuseki2/src/main/resources/META-INF/LICENSE @@ -0,0 +1,253 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +- - - - - - - - - - - - - - - - - - - - - - - + +============================================================== + Jetty Web Container + Copyright 1995-2012 Mort Bay Consulting Pty Ltd. +============================================================== + +The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd +unless otherwise noted. + +Jetty is dual licensed under both + + * The Apache 2.0 License + http://www.apache.org/licenses/LICENSE-2.0.html + + and + + * The Eclipse Public 1.0 License + http://www.eclipse.org/legal/epl-v10.html + +Jetty may be distributed under either license. + +- - - - - - - - - - - - - - - - - - - - - - - + +This product bundles "Bootstrap", which is available under an +MIT license. See: https://github.com/twbs/bootstrap/blob/master/LICENSE + +This product bundles "codemirror", which is available under an +MIT license. See http://codemirror.net/LICENSE + +This product bundles "jquery", which is available under an +MIT license. See https://jquery.org/license/ + +This product bundles "DataTables", which is available under a +"BSD 3-clause" license. See http://datatables.net/license_bsd + +This product bundles "jquery.form", which is available under an +MIT license. See http://malsup.github.io/mit-license.txt + +This product bundles "jquery.xdomainrequest", which is available under an +MIT license. See https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest/blob/master/LICENSE.txt + +This product bundles "backbone.js", which is available under an +MIT license. See https://github.com/jashkenas/backbone/blob/master/LICENSE + +This product bundles "backbone.marionette", which is available under an +MIT license. See http://mutedsolutions.mit-license.org/ + "backbone.marionette" includes "Backbone.BabySitter" and + "Backbone.Wreqr" also available under the same MIT license. + +This product bundles "html5shiv", which is available under an +MIT license. See https://code.google.com/p/html5shiv/ + +This product bundles "RequireJS", which is available under an +MIT license. +https://github.com/jrburke/requirejs/blob/master/LICENSE + "RequireJS" is also available with a "30clause BSD license" + +This product bundles "Respond", which is available under an +MIT license. See https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT + +This product bundles "sprintf.js", which is available under a +"3 clause BSD" license. + https://github.com/alexei/sprintf.js/blob/master/LICENSE + +This product bundles "underscore", which is available under an +MIT license. See https://github.com/jashkenas/underscore/blob/master/LICENSE + +This product bundles "FontAwesome" + "Font Awesome by Dave Gandy - http://fontawesome.io" +The font is available under an SIL Open Font License 1.1 +and the CSS files under an MIT License. +See http://fontawesome.io/license/ + +This product bundles "jQuery File Upload Plugin" +which is available under an MIT License. +See https://github.com/blueimp/jQuery-File-Upload. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/META-INF/NOTICE b/jena-fuseki2/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000..6c51c3c --- /dev/null +++ b/jena-fuseki2/src/main/resources/META-INF/NOTICE @@ -0,0 +1,16 @@ +Apache Jena - module Fuseki +Copyright 2011-2014 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Portions of this software were originally based on the following: + - Copyright 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP + - Copyright 2010, 2011 Epimorphics Ltd. + - Copyright 2010, 2011 Talis Systems Ltd. +These have been licensed to the Apache Software Foundation under a software grant. + +- - - - - - - - - - - - - - - - - - - - - - - + +Portions of this software include software from Mort Bay Consulting Pty. Ltd. + - Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd. http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/log4j.properties b/jena-fuseki2/src/main/resources/log4j.properties new file mode 100644 index 0000000..cf2ef71 --- /dev/null +++ b/jena-fuseki2/src/main/resources/log4j.properties @@ -0,0 +1,29 @@ +# Plain output to stdout +log4j.appender.jena.plainstdout=org.apache.log4j.ConsoleAppender +log4j.appender.jena.plainstdout.target=System.out +log4j.appender.jena.plainstdout.layout=org.apache.log4j.PatternLayout +log4j.appender.jena.plainstdout.layout.ConversionPattern=%d{HH:mm:ss} %-10c{1} %-5p %m%n +# Plain output to stderr +log4j.appender.jena.plainstderr=org.apache.log4j.ConsoleAppender +log4j.appender.jena.plainstderr.target=System.err +log4j.appender.jena.plainstderr.layout=org.apache.log4j.PatternLayout +log4j.appender.jena.plainstderr.layout.ConversionPattern=%d{HH:mm:ss} %-10c{1} %-5p %m%n +# Everything +log4j.rootLogger=INFO, jena.plainstdout +log4j.logger.com.hp.hpl.jena=WARN +log4j.logger.org.apache.jena=WARN +log4j.logger.org.apache.jena.fuseki=INFO +# Others +log4j.logger.org.eclipse.jetty=WARN +log4j.logger.org.apache.shiro=WARN +# Fuseki System logs. +log4j.logger.org.apache.jena.fuseki.Server=INFO +log4j.logger.org.apache.jena.fuseki.Fuseki=INFO +log4j.logger.org.apache.jena.fuseki.Admin=INFO +log4j.logger.org.apache.jena.fuseki.Validate=INFO +log4j.logger.org.apache.jena.fuseki.Config=INFO +# TDB +log4j.logger.org.apache.jena.tdb.loader=INFO +## Parser output +log4j.additivity.org.apache.jena.riot=false +log4j.logger.org.apache.jena.riot=INFO, jena.plainstdout http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml new file mode 100644 index 0000000..34082eb --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/fuseki-properties.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<!-- Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0" --> +<properties version="1.0"> + <comment>Fuseki System Properties</comment> + <entry key="org.apache.jena.fuseki.version">${project.version}</entry> + <entry key="org.apache.jena.fuseki.build.datetime">${build.time.xsd}</entry> +</properties> http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/config.ttl ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/config.ttl b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/config.ttl new file mode 100644 index 0000000..dd0eb89 --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/config.ttl @@ -0,0 +1,28 @@ +## Fuseki Server configuation file. + +@prefix : <#> . +@prefix fuseki: <http://jena.apache.org/fuseki#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . + +[] rdf:type fuseki:Server ; + # Example:: + # Server-wide query timeout. + # + # Timeout - server-wide default: milliseconds. + # Format 1: "1000" -- 1 second timeout + # Format 2: "10000,60000" -- 10s timeout to first result, + # then 60s timeout for the rest of query. + # + # See javadoc for ARQ.queryTimeout for details. + # This can also be set on a per dataset basis in the dataset assembler. + # + # ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "30000" ] ; + + # Add any custom classes you want to load. + # Must have a "public static void init()" method. + # ja:loadClass "your.code.Class" ; + + # End triples. + . http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/shiro.ini ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/shiro.ini b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/shiro.ini new file mode 100644 index 0000000..c5561f9 --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/shiro.ini @@ -0,0 +1,34 @@ +[main] +# Development +ssl.enabled = false + +plainMatcher=org.apache.shiro.authc.credential.SimpleCredentialsMatcher +#iniRealm=org.apache.shiro.realm.text.IniRealm +iniRealm.credentialsMatcher = $plainMatcher + +localhost=org.apache.jena.fuseki.authz.LocalhostFilter + +[users] +# Implicitly adds "iniRealm = org.apache.shiro.realm.text.IniRealm" +admin=pw + +[roles] + +[urls] +## Control functions open to anyone +/$/status = anon +/$/ping = anon + +## and the rest are restricted +/$/** = localhost + + +## If you want simple, basic authentication user/password on the operations, +## change the line about to: +## /$/** = authcBasic,user[admin] + +## or to allow any access. +##/$/** = anon + +# Everything else +/**=anon http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-mem ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-mem b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-mem new file mode 100644 index 0000000..06dcf1e --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-mem @@ -0,0 +1,27 @@ +# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 + +@prefix : <#> . +@prefix fuseki: <http://jena.apache.org/fuseki#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . + +## --------------------------------------------------------------- +## Updatable in-memory dataset. + +<#service1> rdf:type fuseki:Service ; + # URI of the dataset -- http://host:port/ds + fuseki:name "{NAME}" ; + fuseki:serviceQuery "sparql" ; + fuseki:serviceQuery "query" ; + fuseki:serviceUpdate "update" ; + fuseki:serviceUpload "upload" ; + fuseki:serviceReadWriteGraphStore "data" ; + fuseki:serviceReadGraphStore "get" ; + fuseki:dataset <#dataset> ; + . + +## In-memory, initially empty. +<#dataset> rdf:type ja:RDFDataset . http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-service ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-service b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-service new file mode 100644 index 0000000..a019496 --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-service @@ -0,0 +1,23 @@ +# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 + +@prefix : <#> . +@prefix fuseki: <http://jena.apache.org/fuseki#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . + +## --------------------------------------------------------------- +## Read-only in-memory dataset - used as a default, dummy datasets + +<#service1> rdf:type fuseki:Service ; + fuseki:name "" ; + fuseki:serviceQuery "sparql" ; + fuseki:serviceQuery "query" ; + fuseki:serviceReadGraphStore "get" ; + fuseki:dataset <#dataset> ; + . + +## In-memory, empty. +<#dataset> rdf:type ja:RDFDataset . http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb new file mode 100644 index 0000000..40f3d22 --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb @@ -0,0 +1,36 @@ +# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 + +@prefix : <#> . +@prefix fuseki: <http://jena.apache.org/fuseki#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . + +# TDB +[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . +tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . +tdb:GraphTDB rdfs:subClassOf ja:Model . + +## --------------------------------------------------------------- +## Updatable TDB dataset with all services enabled. + +<#service_tdb_all> rdf:type fuseki:Service ; + rdfs:label "TDB {NAME}" ; + fuseki:name "{NAME}" ; + fuseki:serviceQuery "query" ; + fuseki:serviceQuery "sparql" ; + fuseki:serviceUpdate "update" ; + fuseki:serviceUpload "upload" ; + fuseki:serviceReadWriteGraphStore "data" ; + # A separate read-only graph store endpoint: + fuseki:serviceReadGraphStore "get" ; + fuseki:dataset <#tdb_dataset_readwrite> ; + + . + +<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; + tdb:location "{FUSEKI_BASE}/databases/{NAME}" ; + ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "3000" ] ; + ##tdb:unionDefaultGraph true ; + . http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-dir ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-dir b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-dir new file mode 100644 index 0000000..9706eee --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-dir @@ -0,0 +1,35 @@ +# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 + +@prefix : <#> . +@prefix fuseki: <http://jena.apache.org/fuseki#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . + +# TDB +[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . +tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . +tdb:GraphTDB rdfs:subClassOf ja:Model . + +## --------------------------------------------------------------- +## Updatable TDB dataset with all services enabled. + +<#service_tdb_all> rdf:type fuseki:Service ; + rdfs:label "TDB {NAME}" ; + fuseki:name "{NAME}" ; + fuseki:serviceQuery "query" ; + fuseki:serviceQuery "sparql" ; + fuseki:serviceUpdate "update" ; + fuseki:serviceUpload "upload" ; + fuseki:serviceReadWriteGraphStore "data" ; + # A separate read-only graph store endpoint: + fuseki:serviceReadGraphStore "get" ; + fuseki:dataset <#tdb_dataset_readwrite> ; + + . + +<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; + tdb:location "{DIR}" ; + ##tdb:unionDefaultGraph true ; + . http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-mem ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-mem b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-mem new file mode 100644 index 0000000..8e3e0cc --- /dev/null +++ b/jena-fuseki2/src/main/resources/org/apache/jena/fuseki/server/templates/config-tdb-mem @@ -0,0 +1,36 @@ +# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 + +@prefix : <#> . +@prefix fuseki: <http://jena.apache.org/fuseki#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . +@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . + +# TDB +[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . +tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . +tdb:GraphTDB rdfs:subClassOf ja:Model . + +## --------------------------------------------------------------- +## Updatable TDB dataset with all services enabled. + +<#service_tdb_all> rdf:type fuseki:Service ; + rdfs:label "TDB {NAME}" ; + fuseki:name "{NAME}" ; + fuseki:serviceQuery "query" ; + fuseki:serviceQuery "sparql" ; + fuseki:serviceUpdate "update" ; + fuseki:serviceUpload "upload" ; + fuseki:serviceReadWriteGraphStore "data" ; + # A separate read-only graph store endpoint: + fuseki:serviceReadGraphStore "get" ; + fuseki:dataset <#tdb_dataset_readwrite> ; + + . + +<#tdb_dataset_readwrite> rdf:type tdb:DatasetTDB ; + tdb:location "--mem--" ; + ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1000" ] ; + # tdb:unionDefaultGraph true ; + . http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/webapp/WEB-INF/web.xml b/jena-fuseki2/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..f3db445 --- /dev/null +++ b/jena-fuseki2/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,248 @@ +<?xml version="1.0"?> + +<web-app xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + version="3.0"> + + <display-name>Apache Jena Fuseki Server</display-name> + + <!-- Apache Shiro setup --> + <!-- First filter --> + <listener> + <!--<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>--> + <!-- Support multiple locations, looks in Fuseki-relevant places --> + <listener-class>org.apache.jena.fuseki.server.ShiroEnvironmentLoader</listener-class> + </listener> + + <filter> + <filter-name>ShiroFilter</filter-name> + <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>ShiroFilter</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + <dispatcher>INCLUDE</dispatcher> + <dispatcher>ERROR</dispatcher> + </filter-mapping> + + <context-param> + <param-name>shiroConfigLocations</param-name> + <!-- Try a path name in: FUSEKI_BASE, FUSEKI_HOME, war resource + If a "file:" then look there and there only. + --> + <param-value>shiro.ini</param-value> + </context-param> + + <!-- Apache Jena Fuseki setup --> + + <listener> + <listener-class>org.apache.jena.fuseki.server.FusekiServletContextListener</listener-class> + </listener> + + <filter> + <filter-name>Fuseki</filter-name> + <filter-class>org.apache.jena.fuseki.servlets.FusekiFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>Fuseki</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + <dispatcher>INCLUDE</dispatcher> + <dispatcher>ERROR</dispatcher> + </filter-mapping> + + <!-- Validators --> + <servlet> + <servlet-name>QueryValidator</servlet-name> + <servlet-class>org.apache.jena.fuseki.validation.QueryValidator</servlet-class> + </servlet> + + <servlet> + <servlet-name>UpdateValidator</servlet-name> + <servlet-class>org.apache.jena.fuseki.validation.UpdateValidator</servlet-class> + </servlet> + + <servlet> + <servlet-name>DataValidator</servlet-name> + <servlet-class>org.apache.jena.fuseki.validation.DataValidator</servlet-class> + </servlet> + + <servlet> + <servlet-name>IRIValidator</servlet-name> + <servlet-class>org.apache.jena.fuseki.validation.IRIValidator</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>QueryValidator</servlet-name> + <url-pattern>/validate/query</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>UpdateValidator</servlet-name> + <url-pattern>/validate/update</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>IRIValidator</servlet-name> + <url-pattern>/validate/iri</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>DataValidator</servlet-name> + <url-pattern>/validate/data</url-pattern> + </servlet-mapping> + + <!-- Admin controls--> + + <servlet> + <servlet-name>DumpServlet</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.DumpServlet</servlet-class> + </servlet> + + <servlet> + <servlet-name>ServerStatusServlet</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionServerStatus</servlet-class> + </servlet> + + <servlet> + <servlet-name>PingServlet</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionPing</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>DumpServlet</servlet-name> + <url-pattern>/$/dump</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ServerStatusServlet</servlet-name> + <url-pattern>/$/server</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>PingServlet</servlet-name> + <url-pattern>/$/ping</url-pattern> + </servlet-mapping> + + <servlet> + <servlet-name>ActionDatasets</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionDatasets</servlet-class> + </servlet> + + <servlet> + <servlet-name>ActionStats</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionStats</servlet-class> + </servlet> + + <servlet> + <servlet-name>ActionLogs</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionLogs</servlet-class> + </servlet> + + <servlet> + <servlet-name>ActionBackup</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionBackup</servlet-class> + </servlet> + + <servlet> + <servlet-name>ActionTasks</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionTasks</servlet-class> + </servlet> + + <!-- A management action that only creates a background task that sleeps. + Useful for writing tests for managegemt tools that exercise the + background task functionality. + --> + <servlet> + <servlet-name>ActionSleep</servlet-name> + <servlet-class>org.apache.jena.fuseki.mgt.ActionSleep</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>ActionDatasets</servlet-name> + <url-pattern>/$/datasets/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ActionStats</servlet-name> + <url-pattern>/$/stats/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ActionLogs</servlet-name> + <url-pattern>/$/logs</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ActionBackup</servlet-name> + <url-pattern>/$/backup/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ActionBackup</servlet-name> + <url-pattern>/$/backups/*</url-pattern> <!-- Alt spelling --> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ActionTasks</servlet-name> + <url-pattern>/$/tasks/*</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>ActionSleep</servlet-name> + <url-pattern>/$/sleep/*</url-pattern> + </servlet-mapping> + + <welcome-file-list> + <welcome-file>index.html</welcome-file> + </welcome-file-list> + + <mime-mapping> + <extension>rdf</extension> + <mime-type>application/rdf+xml;charset=utf-8</mime-type> + </mime-mapping> + <mime-mapping> + <extension>ttl</extension> + <mime-type>text/turtle;charset=utf-8</mime-type> + </mime-mapping> + <mime-mapping> + <extension>nt</extension> + <mime-type>text/plain;charset=utf-8</mime-type> + </mime-mapping> + <mime-mapping> + <extension>nq</extension> + <mime-type>text/nquads;charset=utf-8</mime-type> + </mime-mapping> + <mime-mapping> + <extension>trig</extension> + <mime-type>application/trig;charset=utf-8</mime-type> + </mime-mapping> + + <!-- If using security via Shiro - -> + + <listener> + <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class> + </listener> + + <filter> + <filter-name>ShiroFilter</filter-name> + <filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>ShiroFilter</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + <dispatcher>FORWARD</dispatcher> + <dispatcher>INCLUDE</dispatcher> + <dispatcher>ERROR</dispatcher> + </filter-mapping> + --> + +</web-app> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/webapp/admin-logs.html ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/webapp/admin-logs.html b/jena-fuseki2/src/main/webapp/admin-logs.html new file mode 100644 index 0000000..1db765e --- /dev/null +++ b/jena-fuseki2/src/main/webapp/admin-logs.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html> + <head> + <title>Apache Jena Fuseki</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link href="../css/bootstrap.min.css" rel="stylesheet" media="screen"> + <link href="../css/font-awesome.min.css" rel="stylesheet" media="screen"> + <link href="../css/codemirror.css" rel="stylesheet" media="screen"> + <link href="../css/qonsole.css" rel="stylesheet" media="screen"> + <link href="../css/jquery.dataTables.css" rel="stylesheet" media="screen"> + <link href="../css/fui.css" rel="stylesheet" media="screen"> + + <!--[if lt IE 9]> + <script src="../js/lib/html5shiv.js"></script> + <script src="../js/lib/respond.min.js"></script> + <![endif]--> + </head> + <body> + <nav class="navbar navbar-default" role="navigation"> + <div class="container"> + <div class="row"> + <!-- Brand and toggle get grouped for better mobile display --> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html"> + <img src="images/jena-logo-notext-small.png" alt="Apache Jena logo" title="Apache Jena" /> + <div>Apache<br />Jena<br /><strong>Fuseki</strong></div> + </a> + </div> + + <!-- Collect the nav links, forms, and other content for toggling --> + <div class="collapse navbar-collapse navbar-ex1-collapse"> + <ul class="nav navbar-nav"> + <li class=""><a href="index.html"><i class="fa fa-home"></i></a></li> + <li class=""><a href="query.html"><i class="fa fa-question-circle"></i> query</a></li> + <li class=""><a href="validate.html"><i class="fa fa-check-circle"></i> validate</a></li> + <li class="admin"><a href="admin-data-management.html"><i class="fa fa-cogs"></i> administer</a></li> + <li class="admin"><a href="admin-stats.html"><i class="fa fa-dashboard"></i> stats</a></li> + <li class="admin active"><a href="admin-logs.html"><i class="fa fa-book"></i> logs</a></li> + <li class=""><a href="documentation.html"><i class="fa fa-info-circle"></i> help</a></li> + </ul> + <ul class="nav navbar-nav navbar-right"> + <li class="status-indicator"> + <div>Server<br />status:</div> + </li> + <li class="status-indicator"> + <a class="" href="admin/server-log.html" id="server-status-light" title="current server status"> + <span class="server-up"></span> + </a> + </li> + </ul> + </div><!-- /.navbar-collapse --> + </div><!-- /row --> + </div><!-- /container --> + </nav> + + <div class="container"> + <div class="row"> + <h1>Server logs</h1> + <p class="text-danger">Forthcoming feature. Show some or all of the recent log file, assuming it is in the usual place.</p> + </div> + </div> + + <script src="../js/lib/jquery-1.10.2.min.js"></script> + <script src="../js/lib/bootstrap.min.js"></script> + </body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/36855e1b/jena-fuseki2/src/main/webapp/css/bootstrap-select.min.css ---------------------------------------------------------------------- diff --git a/jena-fuseki2/src/main/webapp/css/bootstrap-select.min.css b/jena-fuseki2/src/main/webapp/css/bootstrap-select.min.css new file mode 100644 index 0000000..edb090c --- /dev/null +++ b/jena-fuseki2/src/main/webapp/css/bootstrap-select.min.css @@ -0,0 +1,7 @@ +/*! + * bootstrap-select v1.5.4 + * http://silviomoreto.github.io/bootstrap-select/ + * + * Copyright 2013 bootstrap-select + * Licensed under the MIT license + */.bootstrap-select.btn-group:not(.input-group-btn),.bootstrap-select.btn-group[class*="span"]{float:none;display:inline-block;margin-bottom:10px;margin-left:0}.form-search .bootstrap-select.btn-group,.form-inline .bootstrap-select.btn-group,.form-horizontal .bootstrap-select.btn-group{margin-bottom:0}.bootstrap-select.form-control{margin-bottom:0;padding:0;border:0}.bootstrap-select.btn-group.pull-right,.bootstrap-select.btn-group[class*="span"].pull-right,.row-fluid .bootstrap-select.btn-group[class*="span"].pull-right{float:right}.input-append .bootstrap-select.btn-group{margin-left:-1px}.input-prepend .bootstrap-select.btn-group{margin-right:-1px}.bootstrap-select:not([class*="span"]):not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn){width:220px}.bootstrap-select{width:220px\0}.bootstrap-select.form-control:not([class*="span"]){width:100%}.bootstrap-select>.btn{width:100%;padding-right:25px}.error .bootstrap-select .btn{border:1px solid #b94a48}.bootstrap- select.show-menu-arrow.open>.btn{z-index:2051}.bootstrap-select .btn:focus{outline:thin dotted #333 !important;outline:5px auto -webkit-focus-ring-color !important;outline-offset:-2px}.bootstrap-select.btn-group .btn .filter-option{display:inline-block;overflow:hidden;width:100%;float:left;text-align:left}.bootstrap-select.btn-group .btn .caret{position:absolute;top:50%;right:12px;margin-top:-2px;vertical-align:middle}.bootstrap-select.btn-group>.disabled,.bootstrap-select.btn-group .dropdown-menu li.disabled>a{cursor:not-allowed}.bootstrap-select.btn-group>.disabled:focus{outline:none !important}.bootstrap-select.btn-group[class*="span"] .btn{width:100%}.bootstrap-select.btn-group .dropdown-menu{min-width:100%;z-index:2000;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select.btn-group .dropdown-menu.inner{position:static;border:0;padding:0;margin:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-b ox-shadow:none;box-shadow:none}.bootstrap-select.btn-group .dropdown-menu dt{display:block;padding:3px 20px;cursor:default}.bootstrap-select.btn-group .div-contain{overflow:hidden}.bootstrap-select.btn-group .dropdown-menu li{position:relative}.bootstrap-select.btn-group .dropdown-menu li>a.opt{position:relative;padding-left:35px}.bootstrap-select.btn-group .dropdown-menu li>a{cursor:pointer}.bootstrap-select.btn-group .dropdown-menu li>dt small{font-weight:normal}.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a i.check-mark{position:absolute;display:inline-block;right:15px;margin-top:2.5px}.bootstrap-select.btn-group .dropdown-menu li a i.check-mark{display:none}.bootstrap-select.btn-group.show-tick .dropdown-menu li a span.text{margin-right:34px}.bootstrap-select.btn-group .dropdown-menu li small{padding-left:.5em}.bootstrap-select.btn-group .dropdown-menu li:not(.disabled)>a:hover small,.bootstrap-select.btn-group .dropdown-menu li:not(.disabled)>a:focus small,. bootstrap-select.btn-group .dropdown-menu li.active:not(.disabled)>a small{color:#64b1d8;color:rgba(255,255,255,0.4)}.bootstrap-select.btn-group .dropdown-menu li>dt small{font-weight:normal}.bootstrap-select.show-menu-arrow .dropdown-toggle:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #CCC;border-bottom-color:rgba(0,0,0,0.2);position:absolute;bottom:-4px;left:9px;display:none}.bootstrap-select.show-menu-arrow .dropdown-toggle:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid white;position:absolute;bottom:-4px;left:10px;display:none}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:before{bottom:auto;top:-3px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle:after{bottom:auto;top:-3px;border-top:6px solid #fff;border-bottom:0}. bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:before{right:12px;left:auto}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle:after{right:13px;left:auto}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle:before,.bootstrap-select.show-menu-arrow.open>.dropdown-toggle:after{display:block}.bootstrap-select.btn-group .no-results{padding:3px;background:#f5f5f5;margin:0 5px}.bootstrap-select.btn-group .dropdown-menu .notify{position:absolute;bottom:5px;width:96%;margin:0 2%;min-height:26px;padding:3px 5px;background:#f5f5f5;border:1px solid #e3e3e3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);pointer-events:none;opacity:.9;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.mobile-device{position:absolute;top:0;left:0;display:block !important;width:100%;height:100% !important;opacity:0}.bootstrap-select.fit-width{width:auto !important}.bootstrap-select.btn-group.fit-width .btn .filter-option{position:static}.bootstrap-select.btn-gro up.fit-width .btn .caret{position:static;top:auto;margin-top:-1px}.control-group.error .bootstrap-select .dropdown-toggle{border-color:#b94a48}.bootstrap-select-searchbox,.bootstrap-select .bs-actionsbox{padding:4px 8px}.bootstrap-select .bs-actionsbox{float:left;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select-searchbox+.bs-actionsbox{padding:0 8px 4px}.bootstrap-select-searchbox input{margin-bottom:0}.bootstrap-select .bs-actionsbox .btn-group button{width:50%} \ No newline at end of file
