[GitHub] jena issue #335: Jena 1453 reduce docs

2018-01-10 Thread xristy
Github user xristy commented on the issue:

https://github.com/apache/jena/pull/335
  
Yes it was ready to merge. The documentation updates are queued in the 
anonymous "improve this page" commit that I made a week ago.


---


[jira] [Commented] (JENA-1461) Allow ARQ custom functions to be written in JavaScript

2018-01-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)


[jira] [Commented] (JENA-1461) Allow ARQ custom functions to be written in JavaScript

2018-01-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16320538#comment-16320538
 ] 

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_r160727572
  
--- Diff: 
jena-arq/src/test/java/org/apache/jena/sparql/function/js/TestNV.java ---
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.sparql.sse.SSE;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class TestNV {
+
+@Test public void nv_1() { test("'abc'"); }
+@Test public void nv_2() { test("true"); }
+@Test public void nv_3() { test("123"); }
+@Test public void nv_4() { test("123.5"); }
+
+// No conversion to JS - becomes an NV.
+@Test public void nv_5() { 
test("'2018-01-06T17:56:41.293+00:00'^^xsd:dateTime"); }
+@Test public void nv_6() { test(""); }
--- End diff --

Good catch. Fixed.


> 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)


[GitHub] jena pull request #340: JENA-1461: JavaScript custom functions

2018-01-10 Thread afs
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


---


[GitHub] jena pull request #340: JENA-1461: JavaScript custom functions

2018-01-10 Thread afs
Github user afs commented on a diff in the pull request:

https://github.com/apache/jena/pull/340#discussion_r160727572
  
--- Diff: 
jena-arq/src/test/java/org/apache/jena/sparql/function/js/TestNV.java ---
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.jena.sparql.expr.NodeValue;
+import org.apache.jena.sparql.sse.SSE;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class TestNV {
+
+@Test public void nv_1() { test("'abc'"); }
+@Test public void nv_2() { test("true"); }
+@Test public void nv_3() { test("123"); }
+@Test public void nv_4() { test("123.5"); }
+
+// No conversion to JS - becomes an NV.
+@Test public void nv_5() { 
test("'2018-01-06T17:56:41.293+00:00'^^xsd:dateTime"); }
+@Test public void nv_6() { test(""); }
--- End diff --

Good catch. Fixed.


---


[GitHub] jena issue #335: Jena 1453 reduce docs

2018-01-10 Thread afs
Github user afs commented on the issue:

https://github.com/apache/jena/pull/335
  
Presumably this was ready to merge. I've noted the announcement text as 
well, thanks, and will sort out the documentation (unless someone beats me to 
it).




---


[jira] [Resolved] (JENA-1453) jena-text Lucene docs contain graph field duplicates

2018-01-10 Thread Andy Seaborne (JIRA)

 [ 
https://issues.apache.org/jira/browse/JENA-1453?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne resolved JENA-1453.
-
   Resolution: Fixed
Fix Version/s: Jena 3.7.0

> jena-text Lucene docs contain graph field duplicates
> 
>
> Key: JENA-1453
> URL: https://issues.apache.org/jira/browse/JENA-1453
> Project: Apache Jena
>  Issue Type: Improvement
>  Components: Jena
>Affects Versions: Jena 3.6.0
> Environment: All
>Reporter: Code Ferret
>Assignee: Code Ferret
>Priority: Minor
> Fix For: Jena 3.7.0
>
>
> The current jena-text integration of Lucene has both duplicate and unused 
> fields that increase the required space and reduce the performance of the 
> Lucene integration.
> Consider:
> {code}
> ex:SomeOne
>a   ex:Item ;
>skos:prefLabel "Some One" ;
>skos:prefLabel "Some Neat One"@en ;
> {code}
> Assuming that:
> {code}
> [] a text:EntityMap ;
> text:entityField  "uri" ;
> text:uidField "uid" ;
> text:defaultField "label" ;
> text:langField"lang" ;
> text:graphField   "graph" ;
> text:map (
>  [ text:field "label" ; 
>text:predicate skos:prefLabel ]
> {code}
> and that {{text:multilingualSupport false ;}}, then
> The two Lucene documents that will be indexed appear as follows:
> {code}
> Document<
>   stored,indexed,indexOptions=DOCS 
>   indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,tokenized
>   stored,indexed,omitNorms,indexOptions=DOCS 
>  
>   stored,indexed,tokenized 
>   stored,indexed,omitNorms,indexOptions=DOCS
> 
> >
> Document<
>   stored,indexed,indexOptions=DOCS 
>   indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,tokenized 
>   stored,indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,omitNorms,indexOptions=DOCS
>  
>   stored,indexed,tokenized 
>   stored,indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,omitNorms,indexOptions=DOCS
> 
> >
> {code}
> The {{graph}} field (and associated {{lang}} and {{uid}} fields) appear twice 
> in each document. The initial occurrence results from the {{text:graphField}} 
> configuration and the second is an artifact of 
> {{TextQueryFuncs.entityFromQuad}} adding the graph to the {{Entity}} via 
> {{entity.put(...)}}.
> This second occurrence of the graph field is not effective since there is no 
> search over tokenized graph URIs and there is currently no way to return the 
> graph field so no need to store it.
> It might well be a useful improvement to allow the graph field to be 
> retrieved via {{text:query}} PF but that would most reasonably be done by 
> adding the {{Field.Store.YES}} to the {{FieldType}} for the initial 
> occurrence of the graph field.
> The second occurrence of a {{uid}} field is the result of the unnecessary 
> graph occurrence resulting from the {{Entity}} to {{Document}} conversion in 
> {{TextLuceneIndex}}. This is never used since the purpose of the {{uid}} 
> field is to handle the deleting of documents from the Lucene index when a 
> triple is deleted and does not involve the graph URI.
> The solution is to delete lines 89-90 of {{TextQueryFuncs}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (JENA-1453) jena-text Lucene docs contain graph field duplicates

2018-01-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16320493#comment-16320493
 ] 

ASF GitHub Bot commented on JENA-1453:
--

Github user asfgit closed the pull request at:

https://github.com/apache/jena/pull/335


> jena-text Lucene docs contain graph field duplicates
> 
>
> Key: JENA-1453
> URL: https://issues.apache.org/jira/browse/JENA-1453
> Project: Apache Jena
>  Issue Type: Improvement
>  Components: Jena
>Affects Versions: Jena 3.6.0
> Environment: All
>Reporter: Code Ferret
>Assignee: Code Ferret
>Priority: Minor
>
> The current jena-text integration of Lucene has both duplicate and unused 
> fields that increase the required space and reduce the performance of the 
> Lucene integration.
> Consider:
> {code}
> ex:SomeOne
>a   ex:Item ;
>skos:prefLabel "Some One" ;
>skos:prefLabel "Some Neat One"@en ;
> {code}
> Assuming that:
> {code}
> [] a text:EntityMap ;
> text:entityField  "uri" ;
> text:uidField "uid" ;
> text:defaultField "label" ;
> text:langField"lang" ;
> text:graphField   "graph" ;
> text:map (
>  [ text:field "label" ; 
>text:predicate skos:prefLabel ]
> {code}
> and that {{text:multilingualSupport false ;}}, then
> The two Lucene documents that will be indexed appear as follows:
> {code}
> Document<
>   stored,indexed,indexOptions=DOCS 
>   indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,tokenized
>   stored,indexed,omitNorms,indexOptions=DOCS 
>  
>   stored,indexed,tokenized 
>   stored,indexed,omitNorms,indexOptions=DOCS
> 
> >
> Document<
>   stored,indexed,indexOptions=DOCS 
>   indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,tokenized 
>   stored,indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,omitNorms,indexOptions=DOCS
>  
>   stored,indexed,tokenized 
>   stored,indexed,omitNorms,indexOptions=DOCS 
>   stored,indexed,omitNorms,indexOptions=DOCS
> 
> >
> {code}
> The {{graph}} field (and associated {{lang}} and {{uid}} fields) appear twice 
> in each document. The initial occurrence results from the {{text:graphField}} 
> configuration and the second is an artifact of 
> {{TextQueryFuncs.entityFromQuad}} adding the graph to the {{Entity}} via 
> {{entity.put(...)}}.
> This second occurrence of the graph field is not effective since there is no 
> search over tokenized graph URIs and there is currently no way to return the 
> graph field so no need to store it.
> It might well be a useful improvement to allow the graph field to be 
> retrieved via {{text:query}} PF but that would most reasonably be done by 
> adding the {{Field.Store.YES}} to the {{FieldType}} for the initial 
> occurrence of the graph field.
> The second occurrence of a {{uid}} field is the result of the unnecessary 
> graph occurrence resulting from the {{Entity}} to {{Document}} conversion in 
> {{TextLuceneIndex}}. This is never used since the purpose of the {{uid}} 
> field is to handle the deleting of documents from the Lucene index when a 
> triple is deleted and does not involve the graph URI.
> The solution is to delete lines 89-90 of {{TextQueryFuncs}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] jena pull request #335: Jena 1453 reduce docs

2018-01-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/jena/pull/335


---