jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1023750 - in /websites/staging/jena/trunk/content: ./ documentation/query/javascript-functions.html
Date Fri, 12 Jan 2018 16:56:59 GMT
Author: buildbot
Date: Fri Jan 12 16:56:59 2018
New Revision: 1023750

Log:
Staging update by buildbot for jena

Modified:
    websites/staging/jena/trunk/content/   (props changed)
    websites/staging/jena/trunk/content/documentation/query/javascript-functions.html

Propchange: websites/staging/jena/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Jan 12 16:56:59 2018
@@ -1 +1 @@
-1821007
+1821009

Modified: websites/staging/jena/trunk/content/documentation/query/javascript-functions.html
==============================================================================
--- websites/staging/jena/trunk/content/documentation/query/javascript-functions.html (original)
+++ websites/staging/jena/trunk/content/documentation/query/javascript-functions.html Fri
Jan 12 16:56:59 2018
@@ -158,11 +158,11 @@
 h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover
> .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink
{ visibility: visible }</style>
 <p>ARQ supports (Jena v3.7.0 onwards) writing 
 <a href="https://www.w3.org/TR/sparql11-query/#extensionFunctions">custom SPARQL functions</a>
-in JavaScript. These functions can be used in FILTER and for calulatinfg
-values for BIND and AS in SELECT expressions.</p>
-<p>For convenience, XSD datatypes for strings, numbers and booleans are
-comverted to the native JavaScript datatypes. RDFterm that do not fit
-easily into JavaScript datatypes are handled with a object class <code>NV</code>.</p>
+in JavaScript. These functions can be used in FILTERs and for calculating
+values to assigb wiuth AS in BIND and SELECT expressions.</p>
+<p>XSD datatypes for strings, numbers and booleans are converted to the
+native JavaScript datatypes. RDFterms that do not fit easily into
+JavaScript datatypes are handled with a object class <code>NV</code>.</p>
 <h2 id="loading-javascript-functions">Loading JavaScript functions<a class="headerlink"
href="#loading-javascript-functions" title="Permanent link">&para;</a></h2>
 <p>JavaScript is loaded from an external file using the context setting
 "http://jena.apache.org/ARQ#js-library". This can be written as
@@ -172,12 +172,12 @@ easily into JavaScript datatypes are han
 </pre></div>
 
 
-<p>will execute omn teghdata with the JavaScript functions from file
+<p>will execute on the data with the JavaScript functions from file
 "SomeFile.js" available.</p>
-<p>JavScript functions cammn also be from a string directly from within Java using
constant
+<p>JavScript functions can also be set from a string directly from within Java using
constant
 <code>ARQ.symJavaScriptFunctions</code> ("http://jena.apache.org/ARQ#js-functions").</p>
 <h2 id="using-javascript-functions">Using JavaScript functions<a class="headerlink"
href="#using-javascript-functions" title="Permanent link">&para;</a></h2>
-<p>SPARQL functions implemented in JavaScript are autoatica called when a
+<p>SPARQL functions implemented in JavaScript are automatically called when a
 URI starting "http://jena.apache.org/ARQ/jsFunction#" used.</p>
 <p>This can conveniently be abbreviated by:</p>
 <div class="codehilite"><pre><span class="n">PREFIX</span> <span
class="n">js</span><span class="p">:</span> <span class="o">&lt;</span><span
class="n">http</span><span class="p">:</span><span class="o">//</span><span
class="n">jena</span><span class="p">.</span><span class="n">apache</span><span
class="p">.</span><span class="n">org</span><span class="o">/</span><span
class="n">ARQ</span><span class="o">/</span><span class="n">jsFunction</span>#<span
class="o">&gt;</span>
@@ -185,24 +185,25 @@ URI starting "http://jena.apache.org/ARQ
 
 
 <h3 id="arguments-and-function-results">Arguments and Function Results<a class="headerlink"
href="#arguments-and-function-results" title="Permanent link">&para;</a></h3>
-<p><code>xsd:string</code> (a string with no language tag), any XSD numbers
-(integer, decimal, float, double and all the derived types) are
+<p><code>xsd:string</code> (a string with no language tag), any XSD numbers
(integer,
+decimal, float, double and all the derived types) and <code>xsd:boolean</code>
are
 converted to JavaScript string, number and boolean respectively.</p>
 <p>SPARQL functions must return a value. When a function returns a value,
-it can be one of these JavaScript natbve dadatypes, in which case the
-reverse conversion is applied back to XSD datatypes.</p>
-<p>For numbers, the conversion is back to <code>xsd:integer</code> (if
it has no
-fractional part) or <code>xsd:double</code>.</p>
-<p>The JavaScript fucntion can also create <code>NodeValue</code> (or <code>NV</code>)
objects
-for other datatypes.</p>
-<p>URIs are passed as <code>NV</code> object and evaluate in JavaScript
to a string.</p>
-<p>The class <code>NV</code> is used for all other RDF terms (including
URIs).</p>
+it can be one of these JavaScript natbive datatypes, in which case the
+reverse conversion is applied back to XSD datatypes.  For numbers, the
+conversion is back to <code>xsd:integer</code> (if it has no fractional part)
or
+<code>xsd:double</code>.</p>
+<p>The JavaScript function can also create <code>NodeValue</code> (or <code>NV</code>)
objects
+for other datatypes by calling Java from withint the JAavScript script
+engine of the Java runtime.</p>
+<p>URIs are passed as <code>NV</code> object and are available in JavaScript
as a string.</p>
+<p>The class <code>NV</code> is used for all other RDF terms.</p>
 <p>Returning JavaScript <code>null</code> is the error indicator and a
SPARQL
 expression error (<code>ExprEvalException</code>) is raised, like any other
-expression error in SPARQL. That in turn will cause the whole
-expression the function was involved in to evaluate to an error (unelss
-a special form like <code>COALESCE</code> is used). In a <code>FILTER</code>
that typcially
-makes the filter evaluate as "false".</p>
+expression error in SPARQL. That, in turn, will cause the whole
+expression the function is part of to evaluate to an error (unless
+a special form like <code>COALESCE</code> is used). In a <code>FILTER</code>
that typically
+makes the filter evaluate to "false".</p>
 <h2 id="example">Example<a class="headerlink" href="#example" title="Permanent link">&para;</a></h2>
 <p>Suppose "functions.js" contains code to camel case words in a string.
 For example, "some words to process " becomes "someWordsToProcess".</p>
@@ -234,27 +235,27 @@ For example, "some words to process " be
 
 <span class="n">SELECT</span> ?<span class="n">input</span> <span
class="p">(</span><span class="n">js</span><span class="p">:</span><span
class="n">toCamelCase</span><span class="p">(</span>?<span class="n">input</span><span
class="p">)</span> <span class="n">AS</span> ?<span class="n">X</span><span
class="p">)</span>
 <span class="p">{</span>
-    <span class="n">VALUES</span> ?<span class="n">input</span> <span
class="p">{</span> &quot;<span class="n">some</span> <span class="n">words</span>
<span class="n">to</span> <span class="n">process</span>&quot;
<span class="p">}</span>
+    <span class="n">VALUES</span> ?<span class="n">input</span> <span
class="p">{</span> &quot;<span class="n">some</span> <span class="n">woRDs</span>
<span class="n">to</span> <span class="n">PROCESS</span>&quot;
<span class="p">}</span>
 <span class="p">}</span>
 </pre></div>
 
 
 <p>which can be executed with:</p>
-<div class="codehilite"><pre><span class="n">sparql</span> <span
class="o">--</span><span class="n">set</span> <span class="n">arq</span><span
class="p">:</span><span class="n">js</span><span class="o">-</span><span
class="n">library</span><span class="p">=</span><span class="n">SomeFile</span><span
class="p">.</span><span class="n">js</span> <span class="o">--</span><span
class="n">query</span> <span class="n">Q</span><span class="p">.</span><span
class="n">rq</span>
+<div class="codehilite"><pre><span class="n">sparql</span> <span
class="o">--</span><span class="n">set</span> <span class="n">arq</span><span
class="p">:</span><span class="n">js</span><span class="o">-</span><span
class="n">library</span><span class="p">=</span><span class="n">functions</span><span
class="p">.</span><span class="n">js</span> <span class="o">--</span><span
class="n">query</span> <span class="n">Q</span><span class="p">.</span><span
class="n">rq</span>
 </pre></div>
 
 
-<p>to result in</p>
+<p>and it results in:</p>
 <div class="codehilite"><pre><span class="o">--------------------------------------------------</span>
 <span class="o">|</span> <span class="n">input</span>           
       <span class="o">|</span> <span class="n">X</span>         
          <span class="o">|</span>
 <span class="o">==================================================</span>
-<span class="o">|</span> &quot;<span class="n">some</span> <span
class="n">words</span> <span class="n">to</span> <span class="n">process</span>&quot;
<span class="o">|</span> &quot;<span class="n">someWordsToProcess</span>&quot;
<span class="o">|</span>
+<span class="o">|</span> &quot;<span class="n">some</span> <span
class="n">woRDs</span> <span class="n">to</span> <span class="n">PROCESS</span>&quot;
<span class="o">|</span> &quot;<span class="n">someWordsToProcess</span>&quot;
<span class="o">|</span>
 <span class="o">--------------------------------------------------</span>
 </pre></div>
 
 
 <h2 id="use-with-fuseki">Use with Fuseki<a class="headerlink" href="#use-with-fuseki"
title="Permanent link">&para;</a></h2>
-<p>The content seeting can be provided on the command line starting the
+<p>The context setting can be provided on the command line starting the
 server, for example:</p>
 <div class="codehilite"><pre><span class="n">fuseki</span> <span
class="o">--</span><span class="n">set</span> <span class="n">arq</span><span
class="p">:</span><span class="n">js</span><span class="o">-</span><span
class="n">library</span><span class="p">=</span><span class="n">functions</span><span
class="p">.</span><span class="n">js</span> <span class="o">--</span><span
class="n">mem</span> <span class="o">/</span><span class="n">ds</span>
 </pre></div>



Mime
View raw message