[
https://issues.apache.org/jira/browse/JENA-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16320540#comment-16320540
]
ASF GitHub Bot commented on JENA-1461:
--------------------------------------
Github user afs commented on a diff in the pull request:
https://github.com/apache/jena/pull/340#discussion_r160727864
--- Diff: jena-arq/src/main/java/org/apache/jena/sparql/function/js/NV.java
---
@@ -0,0 +1,217 @@
+/*
+ * 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.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URI;
+
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.apache.jena.sparql.expr.ExprEvalException;
+import org.apache.jena.sparql.expr.NodeValue;
+
+/**
+ * General representation of an {@link NodeValue} for JavaScript.
Conversion is to native
+ * types where possible, otherwise {@code NV}. {@code NV.toString} of a
URI returns the
+ * uri as a string so {@code NV} works naturally in Java/Nashorn.
+ *
+ * @see #fromNodeValue
+ * @see #toNodeValue
+ */
+
+public class NV implements RDFJS {
+ // Six data types that are primitives in JavaScript:
+ // Boolean
+ // Null
+ // Undefined
+ // Number
+ // String
+ // Symbol (new in ECMAScript 6; not in Nashorn/Java8).
+ // and Object
+
+ private NodeValue nv;
+ /**
+ * Enable restoring integer from doubles.
+ */
+ private final static boolean narrowDoubles = true;
+ /**
+ * Map an ARQ {@link NodeValue} to java/Nashorn representation of a
JavaScript object.
+ * Native JaavScript types supported are null, string, number and
boolean.
--- End diff --
Done
> 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)