[
https://issues.apache.org/jira/browse/JENA-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16316087#comment-16316087
]
ASF GitHub Bot commented on JENA-1461:
--------------------------------------
Github user kinow commented on a diff in the pull request:
https://github.com/apache/jena/pull/340#discussion_r160112200
--- Diff:
jena-arq/src/main/java/org/apache/jena/sparql/function/js/FunctionJavaScript.java
---
@@ -0,0 +1,93 @@
+/*
+ * 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.sparql.function.js;
+import java.util.List;
+
+import javax.script.ScriptException;
+
+import org.apache.jena.sparql.expr.ExprEvalException;
+import org.apache.jena.sparql.expr.ExprList;
+import org.apache.jena.sparql.expr.ExprUndefFunction;
+import org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.sparql.function.FunctionBase;
+
+/**
+ * Javascript implemented SPARQL custom functions for ARQ. The JavaScript
function is
+ * called with arguments which are mapped so that XSD strings, numbers and
booleans become the
+ * equivalent native JavaScript object, and anything else becomes a {@link
NV}, a
+ * JavaScript object providing access to the RDF features such as datatype.
+ * {@link NV#toString} returns a string so a function working with URIs
can treat URIs as
+ * strings which is natural in JavaScript and aligned to
+ * <a href="https://github.com/rdfjs/representation-task-force/"
+ * >rdfjs/representation-task-force</a>.
+ * <p>
+ * Functions are executed in {@link EnvJavaScript}. There is a global
+ * {@link EnvJavaScript} and it can also be set specifically for a query
execution.
+ * See {@link EnvJavaScript} for details of configuration.
+ * <p>
+ * Note: there is an
+ * attempt to reconstruct the datatype of the result of the function into
+ * {@code xsd:integer} and {@code xsd:double}.
+ * <p>
+ * Functions that return null or undefined will resutl in a {@link
ExprEvalException}.
--- End diff --
s/resutl/result
> Allow ARQ custom functions to be written in JavaScript
> ------------------------------------------------------
>
> Key: JENA-1461
> URL: https://issues.apache.org/jira/browse/JENA-1461
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ
> Affects Versions: Jena 3.6.0
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
>
> Provide execution of JavaScript for SPARQL extension functions.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)