[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320206
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheEntry.java
 ---
@@ -0,0 +1,57 @@
+/**
+ * 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.cache;
+
+
+import org.apache.jena.sparql.resultset.SPARQLResult;
+
+public class CacheEntry {
--- End diff --

What is the purpose of the initialization machinery in this class? It 
doesn't check to see that any of the fields are initialized... 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320210
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
+instance = new CacheStore();
+return instance;
+}
+return instance;
+}
+
+/** For testing - reset the places which initialize once */
+public synchronized static void reset() {
+initialized = false ;
+CacheStore.initialized = false ;
+}
+
+public synchronized static void init(){
+if ( initialized )
+return ;
+initialized = true ;
+
+}
+
+/**
+ * Get cache data from cache store.
+ * @param key Cache store key
+ */
+public Object doGet(String key) throws CacheStoreException{
+try{
+Object data = client.get(key);
+if(data == null)
+return null;
+else
+return data;
--- End diff --

Why check for `null` and then return it? Why not just `return 
client.get(key)`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320206
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheEntry.java
 ---
@@ -0,0 +1,57 @@
+/**
+ * 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.cache;
+
+
+import org.apache.jena.sparql.resultset.SPARQLResult;
+
+public class CacheEntry {
--- End diff --

What is the purpose of the initialization machinery in this class? It 
doesn't check to see that any of the fields are initialized... 


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320210
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
+instance = new CacheStore();
+return instance;
+}
+return instance;
+}
+
+/** For testing - reset the places which initialize once */
+public synchronized static void reset() {
+initialized = false ;
+CacheStore.initialized = false ;
+}
+
+public synchronized static void init(){
+if ( initialized )
+return ;
+initialized = true ;
+
+}
+
+/**
+ * Get cache data from cache store.
+ * @param key Cache store key
+ */
+public Object doGet(String key) throws CacheStoreException{
+try{
+Object data = client.get(key);
+if(data == null)
+return null;
+else
+return data;
--- End diff --

Why check for `null` and then return it? Why not just `return 
client.get(key)`?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320279
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheClient.java
 ---
@@ -0,0 +1,30 @@
+/**
+ * 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.cache;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public abstract class CacheClient {
--- End diff --

Why isn't this class generic for type-safety, e.g. `CacheClient` with `V 
get(String key)`? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320279
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheClient.java
 ---
@@ -0,0 +1,30 @@
+/**
+ * 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.cache;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public abstract class CacheClient {
--- End diff --

Why isn't this class generic for type-safety, e.g. `CacheClient` with `V 
get(String key)`? 


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320283
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheClient.java
 ---
@@ -0,0 +1,30 @@
+/**
+ * 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.cache;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public abstract class CacheClient {
--- End diff --

Isn't this better as an interface instead of an `abstract` class? There is 
no state in it, which is the purpose of an `abstract` class.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320283
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheClient.java
 ---
@@ -0,0 +1,30 @@
+/**
+ * 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.cache;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public abstract class CacheClient {
--- End diff --

Isn't this better as an interface instead of an `abstract` class? There is 
no state in it, which is the purpose of an `abstract` class.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320566
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
--- End diff --

Why is this machinery being created independently of 
`org.apache.jena.atlas.lib.Cache`?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320566
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
--- End diff --

Why is this machinery being created independently of 
`org.apache.jena.atlas.lib.Cache`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320602
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
--- End diff --

Just  `if (instance == null)  instance = new CacheStore(); return 
instance;` would work. No need for two `return` statements. Or even, less 
clearly, just `return instance == null ? instance = new CacheStore(): 
instance;`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320602
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
--- End diff --

Just  `if (instance == null)  instance = new CacheStore(); return 
instance;` would work. No need for two `return` statements. Or even, less 
clearly, just `return instance == null ? instance = new CacheStore(): 
instance;`.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320616
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
+instance = new CacheStore();
+return instance;
+}
+return instance;
+}
+
+/** For testing - reset the places which initialize once */
+public synchronized static void reset() {
+initialized = false ;
+CacheStore.initialized = false ;
+}
+
+public synchronized static void init(){
--- End diff --

This method doesn't seem to actually initialize anything...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320616
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
+instance = new CacheStore();
+return instance;
+}
+return instance;
+}
+
+/** For testing - reset the places which initialize once */
+public synchronized static void reset() {
+initialized = false ;
+CacheStore.initialized = false ;
+}
+
+public synchronized static void init(){
--- End diff --

This method doesn't seem to actually initialize anything...


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320640
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
+instance = new CacheStore();
+return instance;
+}
+return instance;
+}
+
+/** For testing - reset the places which initialize once */
--- End diff --

The fact that this is just for testing isn't great. Maybe this doesn't need 
to be a singleton? That has other effects that can be suboptimal-- e.g. it can 
create problems with OSGi compatibility.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320640
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheStore.java
 ---
@@ -0,0 +1,150 @@
+/**
+ * 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.cache;
+
+import org.apache.jena.fuseki.Fuseki;
+import org.apache.jena.fuseki.servlets.ActionLib;
+import org.apache.jena.fuseki.servlets.HttpAction;
+import org.slf4j.Logger;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class CacheStore {
+
+
+/** flag to check if data store was initialized */
+public static boolean initialized = false ;
+
+private static Logger log = Fuseki.cacheLog ;
+
+/** execution timeout for any method */
+private int defaultExecutionTimeout = 500 ;
+
+/** thread pool size for this data store */
+protected int defaultThreadPoolSize = 500 ;
+
+/** client for interacting with  Cache store **/
+private final CacheClient client = new GuavaCacheClient();
+
+private static CacheStore instance;
+
+public static CacheStore getInstance(){
+
+if(instance==null){
+instance = new CacheStore();
+return instance;
+}
+return instance;
+}
+
+/** For testing - reset the places which initialize once */
--- End diff --

The fact that this is just for testing isn't great. Maybe this doesn't need 
to be a singleton? That has other effects that can be suboptimal-- e.g. it can 
create problems with OSGi compatibility.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320655
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheClient.java
 ---
@@ -0,0 +1,30 @@
+/**
+ * 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.cache;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public abstract class CacheClient {
+
+public abstract Object get(String key) throws InterruptedException, 
ExecutionException, TimeoutException ;
--- End diff --

You end up constantly checking for `null` on return values of this method. 
Maybe it might be better to just return `Optional` (or better, `Optional` as 
noted above)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320655
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheClient.java
 ---
@@ -0,0 +1,30 @@
+/**
+ * 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.cache;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+public abstract class CacheClient {
+
+public abstract Object get(String key) throws InterruptedException, 
ExecutionException, TimeoutException ;
--- End diff --

You end up constantly checking for `null` on return values of this method. 
Maybe it might be better to just return `Optional` (or better, `Optional` as 
noted above)?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on the pull request:

https://github.com/apache/jena/pull/95#issuecomment-149012148
  
This may be me being thick, but I don't see how a mutating query 
invalidates any part of the cache? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on the pull request:

https://github.com/apache/jena/pull/95#issuecomment-149012148
  
This may be me being thick, but I don't see how a mutating query 
invalidates any part of the cache? 


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320697
  
--- Diff: jena-arq/src/main/java/org/apache/jena/riot/system/InitRIOT.java 
---
@@ -31,7 +31,7 @@ public void start() {
 
 @Override
 public void stop() {}
-
--- End diff --

Needless whitespace change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320697
  
--- Diff: jena-arq/src/main/java/org/apache/jena/riot/system/InitRIOT.java 
---
@@ -31,7 +31,7 @@ public void start() {
 
 @Override
 public void stop() {}
-
--- End diff --

Needless whitespace change.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320704
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
--- End diff --

Why not use `try-with-resource` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320704
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
--- End diff --

Why not use `try-with-resource` here?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320708
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
+
+String sep = null ;
+List varNames = resultSet.getResultVars() ;
+List vars = new ArrayList<>(varNames.size()) ;
+
+// Convert to Vars and output the header line.
+for( String v : varNames )
+{
+if ( sep != null ){
--- End diff --

How is `sep` not going to be `null` at this line?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320708
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
+
+String sep = null ;
+List varNames = resultSet.getResultVars() ;
+List vars = new ArrayList<>(varNames.size()) ;
+
+// Convert to Vars and output the header line.
+for( String v : varNames )
+{
+if ( sep != null ){
--- End diff --

How is `sep` not going to be `null` at this line?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320718
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
+
+String sep = null ;
+List varNames = resultSet.getResultVars() ;
+List vars = new ArrayList<>(varNames.size()) ;
+
+// Convert to Vars and output the header line.
+for( String v : varNames )
+{
+if ( sep != null ){
+w.write(sep) ;
+cacheBuilder.append(sep);
+}
+else
+sep = "," ;
+w.write(csvSafe(v)) ;
+cacheBuilder.append(csvSafe(v));
+vars.add(Var.alloc(v)) ;
+}
+w.write(NL) ;
+cacheBuilder.append(NL);
+
+// Data output
+for ( ; resultSet.hasNext() ; )
+{
+sep = null ;
+Binding b = resultSet.nextBinding() ;
+
+for( Var v : vars )
+{
+if ( sep != null ){
--- End diff --

Again, how is `sep` not going to be `null` at this line?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320718
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
+
+String sep = null ;
+List varNames = resultSet.getResultVars() ;
+List vars = new ArrayList<>(varNames.size()) ;
+
+// Convert to Vars and output the header line.
+for( String v : varNames )
+{
+if ( sep != null ){
+w.write(sep) ;
+cacheBuilder.append(sep);
+}
+else
+sep = "," ;
+w.write(csvSafe(v)) ;
+cacheBuilder.append(csvSafe(v));
+vars.add(Var.alloc(v)) ;
+}
+w.write(NL) ;
+cacheBuilder.append(NL);
+
+// Data output
+for ( ; resultSet.hasNext() ; )
+{
+sep = null ;
+Binding b = resultSet.nextBinding() ;
+
+for( Var v : vars )
+{
+if ( sep != null ){
--- End diff --

Again, how is `sep` not going to be `null` at this line?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320957
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
+
+String sep = null ;
+List varNames = resultSet.getResultVars() ;
+List vars = new ArrayList<>(varNames.size()) ;
+
+// Convert to Vars and output the header line.
+for( String v : varNames )
+{
+if ( sep != null ){
+w.write(sep) ;
+cacheBuilder.append(sep);
+}
+else
+sep = "," ;
+w.write(csvSafe(v)) ;
+cacheBuilder.append(csvSafe(v));
+vars.add(Var.alloc(v)) ;
+}
+w.write(NL) ;
+cacheBuilder.append(NL);
+
+// Data output
+for ( ; resultSet.hasNext() ; )
--- End diff --

These two loops could be managed a bit more tightly between 
`resultSet::forEachRemaining` and `vars.stream()::map`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320957
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet 
resultSet)
 }
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
+{
+try {
+Writer w = FileUtils.asUTF8(out) ;
+NodeToLabelMap bnodes = new NodeToLabelMap() ;
+w = new BufferedWriter(w) ;
+
+String sep = null ;
+List varNames = resultSet.getResultVars() ;
+List vars = new ArrayList<>(varNames.size()) ;
+
+// Convert to Vars and output the header line.
+for( String v : varNames )
+{
+if ( sep != null ){
+w.write(sep) ;
+cacheBuilder.append(sep);
+}
+else
+sep = "," ;
+w.write(csvSafe(v)) ;
+cacheBuilder.append(csvSafe(v));
+vars.add(Var.alloc(v)) ;
+}
+w.write(NL) ;
+cacheBuilder.append(NL);
+
+// Data output
+for ( ; resultSet.hasNext() ; )
--- End diff --

These two loops could be managed a bit more tightly between 
`resultSet::forEachRemaining` and `vars.stream()::map`.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320974
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -114,7 +170,19 @@ else if ( n.isBlank() )
 str = csvSafe(str) ;
 w.write(str) ;
 }
+private void output(Writer w, Node n, NodeToLabelMap bnodes, 
StringBuilder cacheBuilder) throws IOException
+{
+//String str = FmtUtils.stringForNode(n) ;
--- End diff --

Why not use `FmtUtils::stringForNode` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42320974
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java ---
@@ -114,7 +170,19 @@ else if ( n.isBlank() )
 str = csvSafe(str) ;
 w.write(str) ;
 }
+private void output(Writer w, Node n, NodeToLabelMap bnodes, 
StringBuilder cacheBuilder) throws IOException
+{
+//String str = FmtUtils.stringForNode(n) ;
--- End diff --

Why not use `FmtUtils::stringForNode` here?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42321146
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java ---
@@ -97,6 +97,63 @@ public void format(OutputStream out, ResultSet resultSet)
 w.flush() ;
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
--- End diff --

See comments above on `CSVOutput`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42321146
  
--- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/resultset/TSVOutput.java ---
@@ -97,6 +97,63 @@ public void format(OutputStream out, ResultSet resultSet)
 w.flush() ;
 }
 
+@Override
+public void format(OutputStream out, ResultSet resultSet, 
StringBuilder cacheBuilder)
--- End diff --

See comments above on `CSVOutput`.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-868) Fuseki2: docker: Redirected ports lead to wrong URLs.

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne commented on JENA-868:


The problem is that the port number sometimes comes from the server ($/server 
-. admin port) and sometimes it is calculated (javascript). In the redirected 
case these are different.  There is also a related issue when using the 
protocol default port.

> Fuseki2: docker: Redirected ports lead to wrong URLs.
> -
>
> Key: JENA-868
> URL: https://issues.apache.org/jira/browse/JENA-868
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.0.0
> Environment: Docker
> https://registry.hub.docker.com/u/stain/jena-fuseki/
>Reporter: Stian Soiland-Reyes (old)
>Priority: Minor
>
> If I use docker and jena-fuseki exposing the port on something other than the 
> one it is running at, e.g. with -p 3031:3030 - then in the browser at 
> http://localhost:3031/ when I go to *Manage datasets* -> *Create dataset"* I 
> simply get "error" because it is trying to POST to 
> http://localhost:3030/datasets instead of http://localhost:3031/datasets.
> This could make it tricky to expose the Fuseki server through firewalls, web 
> servers etc, as one has to change the Fuseki port to match the public port.
> All URIs should be relative and not hard-code the port. (and not the host!)
> This is using fuseki-server.jar, I have not checked what happens if I do the 
> same through tomcat/WAR.
> The workaround is to always expose the same port - e.g. add the argument 
> --port=3031
> docker run -p 3031:3031 stain/jena-fuseki ./fuseki-server --port=3031



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Comment Edited] (JENA-868) Fuseki2: docker: Redirected ports lead to wrong URLs.

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne edited comment on JENA-868 at 10/18/15 3:41 PM:
--

The problem is that the port number sometimes comes from the server ($/server 
-> admin port) and sometimes it is calculated in javascript side from the 
window.location. In the redirected case these are different.  There is also a 
related issue when using the protocol default port; the js code assumes 
explicit ports but for http/80 and https/433 browser canonicalise to no (empty) 
port.



was (Author: andy.seaborne):
The problem is that the port number sometimes comes from the server ($/server 
-. admin port) and sometimes it is calculated (javascript). In the redirected 
case these are different.  There is also a related issue when using the 
protocol default port.

> Fuseki2: docker: Redirected ports lead to wrong URLs.
> -
>
> Key: JENA-868
> URL: https://issues.apache.org/jira/browse/JENA-868
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.0.0
> Environment: Docker
> https://registry.hub.docker.com/u/stain/jena-fuseki/
>Reporter: Stian Soiland-Reyes (old)
>Priority: Minor
>
> If I use docker and jena-fuseki exposing the port on something other than the 
> one it is running at, e.g. with -p 3031:3030 - then in the browser at 
> http://localhost:3031/ when I go to *Manage datasets* -> *Create dataset"* I 
> simply get "error" because it is trying to POST to 
> http://localhost:3030/datasets instead of http://localhost:3031/datasets.
> This could make it tricky to expose the Fuseki server through firewalls, web 
> servers etc, as one has to change the Fuseki port to match the public port.
> All URIs should be relative and not hard-code the port. (and not the host!)
> This is using fuseki-server.jar, I have not checked what happens if I do the 
> same through tomcat/WAR.
> The workaround is to always expose the same port - e.g. add the argument 
> --port=3031
> docker run -p 3031:3031 stain/jena-fuseki ./fuseki-server --port=3031



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (JENA-1050) Fiseki2 UI does not cope with default port numbers.

2015-10-18 Thread Andy Seaborne (JIRA)
Andy Seaborne created JENA-1050:
---

 Summary: Fiseki2 UI does not cope with default port numbers.
 Key: JENA-1050
 URL: https://issues.apache.org/jira/browse/JENA-1050
 Project: Apache Jena
  Issue Type: Bug
  Components: Fuseki
Affects Versions: Fuseki 2.3.0
Reporter: Andy Seaborne


If the Fuseki server is running on http and port 80 or https and port 443, then 
UI miscaluates URLs.

The managementURL is matched agains ":" which catches the URi scheme name.

The base URL has unset port i.e. http://host:/path.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-1050) Fiseki2 UI does not cope with default port numbers.

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne commented on JENA-1050:
-

JENA-868 addresses the managementURL issue.

> Fiseki2 UI does not cope with default port numbers.
> ---
>
> Key: JENA-1050
> URL: https://issues.apache.org/jira/browse/JENA-1050
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.3.0
>Reporter: Andy Seaborne
>
> If the Fuseki server is running on http and port 80 or https and port 443, 
> then UI miscaluates URLs.
> The managementURL is matched agains ":" which catches the URi scheme name.
> The base URL has unset port i.e. http://host:/path.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-1050) Fiseki2 UI does not cope with default port numbers.

2015-10-18 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-1050:
---

Commit cbb1d4ee8a244adbb96b3fef207f025f846d84ec in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=cbb1d4e ]

JENA-1050: Correctly handle port numbers.

> Fiseki2 UI does not cope with default port numbers.
> ---
>
> Key: JENA-1050
> URL: https://issues.apache.org/jira/browse/JENA-1050
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.3.0
>Reporter: Andy Seaborne
>
> If the Fuseki server is running on http and port 80 or https and port 443, 
> then UI miscaluates URLs.
> The managementURL is matched agains ":" which catches the URi scheme name.
> The base URL has unset port i.e. http://host:/path.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-868) Fuseki2: docker: Redirected ports lead to wrong URLs.

2015-10-18 Thread ASF subversion and git services (JIRA)

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

ASF subversion and git services commented on JENA-868:
--

Commit 16d79fd5c6f57fedb8bb48cc8b37a2d5773efa9a in jena's branch 
refs/heads/master from [~andy.seaborne]
[ https://git-wip-us.apache.org/repos/asf?p=jena.git;h=16d79fd ]

JENA-868: Don't include admin section anymore.


> Fuseki2: docker: Redirected ports lead to wrong URLs.
> -
>
> Key: JENA-868
> URL: https://issues.apache.org/jira/browse/JENA-868
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.0.0
> Environment: Docker
> https://registry.hub.docker.com/u/stain/jena-fuseki/
>Reporter: Stian Soiland-Reyes (old)
>Priority: Minor
>
> If I use docker and jena-fuseki exposing the port on something other than the 
> one it is running at, e.g. with -p 3031:3030 - then in the browser at 
> http://localhost:3031/ when I go to *Manage datasets* -> *Create dataset"* I 
> simply get "error" because it is trying to POST to 
> http://localhost:3030/datasets instead of http://localhost:3031/datasets.
> This could make it tricky to expose the Fuseki server through firewalls, web 
> servers etc, as one has to change the Fuseki port to match the public port.
> All URIs should be relative and not hard-code the port. (and not the host!)
> This is using fuseki-server.jar, I have not checked what happens if I do the 
> same through tomcat/WAR.
> The workaround is to always expose the same port - e.g. add the argument 
> --port=3031
> docker run -p 3031:3031 stain/jena-fuseki ./fuseki-server --port=3031



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (JENA-1050) Fuseki2 UI does not cope with default port numbers.

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne updated JENA-1050:

Summary: Fuseki2 UI does not cope with default port numbers.  (was: Fiseki2 
UI does not cope with default port numbers.)

> Fuseki2 UI does not cope with default port numbers.
> ---
>
> Key: JENA-1050
> URL: https://issues.apache.org/jira/browse/JENA-1050
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.3.0
>Reporter: Andy Seaborne
>
> If the Fuseki server is running on http and port 80 or https and port 443, 
> then UI miscaluates URLs.
> The managementURL is matched agains ":" which catches the URi scheme name.
> The base URL has unset port i.e. http://host:/path.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-944) Fuseki Editor Broken

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne commented on JENA-944:


Example uses {{104.154.69.83}}, not {{localhost}} so no editing possible 
(default security). Can't reproduce how the OP got to the page in the first 
place.

> Fuseki Editor Broken
> 
>
> Key: JENA-944
> URL: https://issues.apache.org/jira/browse/JENA-944
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Jena 2.13.0, Fuseki 2.0.0
> Environment: Debian Linux Server (Wheezy), confirmed on multiple 
> browsers: Chrome, Firefox, IE
>Reporter: Eric Jahn
>
> When I upload load the triples into Jena from a file, the Fuseki editor is 
> broken.  See screenshot: http://tinyurl.com/nbybcjy  .  This problem doesn't 
> occur when the triples are only loaded into memory.  What's happening is that 
> Fuseki shows the html of the enclosing page, instead of the triples to edit.  
> I can still edit my triples using SPARUL update queries fine, but I'd like 
> the convenience of the editor.  To get this issue, I click the "List current 
> graphs" button, and select the "default graph" button that appears.  btw, 
> here is the full content of the html in the editor window shown in the editor 
> window: 
> {noformat}
> 
> 
>   
> Apache Jena Fuseki - inspect dataset
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
>   
> 
>   
> 
>   
>   
>  data-toggle="collapse" data-target=".navbar-ex1-collapse">
>   Toggle navigation
>   
>   
>   
> 
> 
>   
>   ApacheJenaFuseki
> 
>   
>   
>   
> 
>   
>dataset
>
> manage datasets
>   
>help
> 
> 
>   
> Serverstatus:
>   
>   
>  id="server-status-light" title="current server status">
>   
> 
>   
> 
>   
> 
>   
> 
> 
>   
> 
>   
> 
>   
>   
> 
>   
> 
>query
>upload files
>edit
>info
> 
> 
> 
>   
> Please select a dataset.
> 
>   
> 
>   SPARQL query
>   To try out some SPARQL queries against the selected 
> dataset, enter your
>   query here.
>   
> 
>   Example queries
>   
>   
> 
> 
>   Prefixes
>   
> 
>class="button" title="Add a SPARQL prefix">
> 
>   
> 
>   
> 
> 
> 
>   
> SPARQL 
> endpoint
>  id="sparqlEndpoint" />
>   
> 
>  
>   
> Content 
> Type (Select)
>  class="form-control">
>value="application/sparql-results+json">JSON
>value="application/sparql-results+xml">XML
>   CSV
>value="text/tab-separated-values">TSV
> 
>   
> 
> 
>   
> Content 
> Type (Graph)
>  class="form-control">
>value="text/turtle">Turtle
>value="application/ld+json">JSON-LD
>value="application/n-triples">N-Triples
>value="application/rdf+xml">XML
> 
>   
> 
>  

[jira] [Resolved] (JENA-944) Fuseki Editor Broken

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne resolved JENA-944.

Resolution: Cannot Reproduce
  Assignee: Andy Seaborne

> Fuseki Editor Broken
> 
>
> Key: JENA-944
> URL: https://issues.apache.org/jira/browse/JENA-944
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Jena 2.13.0, Fuseki 2.0.0
> Environment: Debian Linux Server (Wheezy), confirmed on multiple 
> browsers: Chrome, Firefox, IE
>Reporter: Eric Jahn
>Assignee: Andy Seaborne
>
> When I upload load the triples into Jena from a file, the Fuseki editor is 
> broken.  See screenshot: http://tinyurl.com/nbybcjy  .  This problem doesn't 
> occur when the triples are only loaded into memory.  What's happening is that 
> Fuseki shows the html of the enclosing page, instead of the triples to edit.  
> I can still edit my triples using SPARUL update queries fine, but I'd like 
> the convenience of the editor.  To get this issue, I click the "List current 
> graphs" button, and select the "default graph" button that appears.  btw, 
> here is the full content of the html in the editor window shown in the editor 
> window: 
> {noformat}
> 
> 
>   
> Apache Jena Fuseki - inspect dataset
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
>   
> 
>   
> 
>   
>   
>  data-toggle="collapse" data-target=".navbar-ex1-collapse">
>   Toggle navigation
>   
>   
>   
> 
> 
>   
>   ApacheJenaFuseki
> 
>   
>   
>   
> 
>   
>dataset
>
> manage datasets
>   
>help
> 
> 
>   
> Serverstatus:
>   
>   
>  id="server-status-light" title="current server status">
>   
> 
>   
> 
>   
> 
>   
> 
> 
>   
> 
>   
> 
>   
>   
> 
>   
> 
>query
>upload files
>edit
>info
> 
> 
> 
>   
> Please select a dataset.
> 
>   
> 
>   SPARQL query
>   To try out some SPARQL queries against the selected 
> dataset, enter your
>   query here.
>   
> 
>   Example queries
>   
>   
> 
> 
>   Prefixes
>   
> 
>class="button" title="Add a SPARQL prefix">
> 
>   
> 
>   
> 
> 
> 
>   
> SPARQL 
> endpoint
>  id="sparqlEndpoint" />
>   
> 
>  
>   
> Content 
> Type (Select)
>  class="form-control">
>value="application/sparql-results+json">JSON
>value="application/sparql-results+xml">XML
>   CSV
>value="text/tab-separated-values">TSV
> 
>   
> 
> 
>   
> Content 
> Type (Graph)
>  class="form-control">
>value="text/turtle">Turtle
>value="application/ld+json">JSON-LD
>value="application/n-triples">N-Triples
>value="application/rdf+xml">XML
> 
>   
> 
> 
> 
>   
> 
>  

[jira] [Resolved] (JENA-1050) Fuseki2 UI does not cope with default port numbers.

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne resolved JENA-1050.
-
   Resolution: Fixed
 Assignee: Andy Seaborne
Fix Version/s: Fuseki 2.3.1

This is a change to both server java and UI javascript.

> Fuseki2 UI does not cope with default port numbers.
> ---
>
> Key: JENA-1050
> URL: https://issues.apache.org/jira/browse/JENA-1050
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.3.0
>Reporter: Andy Seaborne
>Assignee: Andy Seaborne
> Fix For: Fuseki 2.3.1
>
>
> If the Fuseki server is running on http and port 80 or https and port 443, 
> then UI miscaluates URLs.
> The managementURL is matched agains ":" which catches the URi scheme name.
> The base URL has unset port i.e. http://host:/path.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Re: JSON-LD upgrade - impact on Elephas

2015-10-18 Thread Andy Seaborne

On 13/10/15 14:21, Rob Vesse wrote:

If the counts are different purely because we are failing in a different
(but predictable) way then I see no reason not to change them

Rob


Change made - the tests now ask what the expected answer are and the 
JSON-LD (triples, quads) tests return their own different answers.


https://github.com/apache/jena/commit/3607c1c9a0760db3a7b92f4bd9a6d2be66fe7d50

Andy



On 09/10/2015 16:42, "Andy Seaborne"  wrote:


Rob - Would changing the count results be acceptable?

Andy

On 05/10/15 13:22, Andy Seaborne wrote:

On 05/10/15 09:31, Rob Vesse wrote:

Yes the tests are designed to be pragmatic

If you are processing large amounts of data on Hadoop there are two
cases:

- You want to skip/ignore bad data
- You want to fail fast on bad data

The failing tests are presumably the ones testing the second case.


The failing tests are:

org.apache.jena.hadoop.rdf.io.input.jsonld.JsonLDTripleInputTest

single_input_05
java.lang.AssertionError: expected:<50> but was:<0>

multiple_inputs_02
java.lang.AssertionError: expected:<10150> but was:<10100>

org.apache.jena.hadoop.rdf.io.input.jsonld.JsonLDQuadInputTest

single_input_05
java.lang.AssertionError: expected:<50> but was:<0>

multiple_inputs_02
java.lang.AssertionError: expected:<10150> but was:<10100>

so 2 tests, repeated.

See also JENA-1013 which was previous work done in this area - JSON-LD
Elephas tests were not failing when they were supposed to.


My
general hacky approach to testing that is simply to generate some valid
data followed by some junk data.  If we change to the JSON-LD behaviour
then those tests in Elephas that cover JSON-LD will need to change to
generate a valid JSON object that happens to be invalid wrt. JSON-LD
but
since I don't know JSON-LD (and have zero desire to learn) I don't know
what we'd need to generate to do that


No need to learn anything about JSON-LD.  My knowledge of how Hadoop
processing works in the presence of failures isn't very strong.

The tests already generate bad data by adding the trailing text "junk
data" to a valid document - same for all formats.  JSON-LD does not have
(and never has) the partial set of triples case that other formats have.
But the Elephas tests don't test for that anyway - the only bad data is
with the trailing string "junk data".

So the issue is that the JSON-LD processor we use has a particular
failure mode (which is correct for JSON-LD according to that community)
that makes those two abstract tests need different answers for JSON-LD.
   Would changing the count results be acceptable?

This looks like the long-term solution that leads to the least
maintenance.  We can retain our own code with its different
characteristics but then we have to maintain it and probably get the
occasional question as to why Jena is different in behaviour to other
systems.

  Andy



Rob

On 04/10/2015 10:02, "Andy Seaborne"  wrote:


Claude,

The point is more on the pragmatic side than the ideal design with a
tradeoff between maintaining our own code vs using a maintained
library.

The jsonld-java parsing process isn't streaming in either use case so
it's not a case of some triples read from the input.  The jsonld-java
process is layered, not streamed - all the JSON parsing is done, then
the conversion to RDF happens.

The two processes are:

(Jena calling low level, non-API calls of jsonld-java):
1a/ Parse JSON
2a/ Do all triples
3a/ Check for trailing junk

vs

(jsonld-java API)
1b/ Parse JSON
2b/ Check for trailing junk
3b/ Do all triples

I am wondering if the Elephas tests are tuned to the way Jena works in
these error cases, rather than relying on a feature of it.

 Andy

AbstractWholeFileQuadInputFormatTests

On 04/10/15 09:19, Claude Warren wrote:

not Rob but my 2 cents.

I think that when we read turtle documents if there is an error the
triples
we have already read and left in the graph/model (yes, transactions
can
change this).  Shouldn't all parsers follow the same pattern?

Currently that pattern seems to be:  read until eof or error and
process
what was read.

Unless I am wrong about the above, I think that the JSON parser
should
return the json object that was parsed before the junk.


Claude

On Sat, Oct 3, 2015 at 7:21 PM, Andy Seaborne 
wrote:


Upgrading the dependency for jsonld-java to 0.7.0 picks up a bug fix
(jsonld-java issue 144) that Jena has a workaround for.

The issue is that the Jackson JSON parser does not flag trailing
junk.
It
reads the JSON object and stops there.  Worse, it creates a buffered
reader
so the caller can't handle the stream afterwards.

---
{
 "@id" : "http://example/s";,
 "http://example/p"; : "str"
}
xxx
---

Jena (JsonLdReader) contains code taken from jsonld-java and
modified
to
run the Jackson JSON parser, produce triples and then check for
trailing
junk.  The detect end of junk was contributed back to the project.
PR
145.

jsonld-java treats it mor

[jira] [Commented] (JENA-868) Fuseki2: docker: Redirected ports lead to wrong URLs.

2015-10-18 Thread Andy Seaborne (JIRA)

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

Andy Seaborne commented on JENA-868:


Please test.

> Fuseki2: docker: Redirected ports lead to wrong URLs.
> -
>
> Key: JENA-868
> URL: https://issues.apache.org/jira/browse/JENA-868
> Project: Apache Jena
>  Issue Type: Bug
>  Components: Fuseki
>Affects Versions: Fuseki 2.0.0
> Environment: Docker
> https://registry.hub.docker.com/u/stain/jena-fuseki/
>Reporter: Stian Soiland-Reyes (old)
>Priority: Minor
>
> If I use docker and jena-fuseki exposing the port on something other than the 
> one it is running at, e.g. with -p 3031:3030 - then in the browser at 
> http://localhost:3031/ when I go to *Manage datasets* -> *Create dataset"* I 
> simply get "error" because it is trying to POST to 
> http://localhost:3030/datasets instead of http://localhost:3031/datasets.
> This could make it tricky to expose the Fuseki server through firewalls, web 
> servers etc, as one has to change the Fuseki port to match the public port.
> All URIs should be relative and not hard-code the port. (and not the host!)
> This is using fuseki-server.jar, I have not checked what happens if I do the 
> same through tomcat/WAR.
> The workaround is to always expose the same port - e.g. add the argument 
> --port=3031
> docker run -p 3031:3031 stain/jena-fuseki ./fuseki-server --port=3031



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325590
  
--- Diff: jena-arq/src/main/java/org/apache/jena/sparql/system/InitARQ.java 
---
@@ -23,7 +23,7 @@
 
 /** ARQ initialization. Used by {@code JenaSystem} */
 public class InitARQ implements JenaSubsystemLifecycle {
-
+
--- End diff --

Needless whitespace change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325590
  
--- Diff: jena-arq/src/main/java/org/apache/jena/sparql/system/InitARQ.java 
---
@@ -23,7 +23,7 @@
 
 /** ARQ initialization. Used by {@code JenaSystem} */
 public class InitARQ implements JenaSubsystemLifecycle {
-
+
--- End diff --

Needless whitespace change.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325746
  
--- Diff: 
jena-core/src/main/java/org/apache/jena/system/JenaSubsystemLifecycle.java ---
@@ -18,15 +18,15 @@
 
 package org.apache.jena.system;
 
--- End diff --

These are all needless whitespace changes.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325746
  
--- Diff: 
jena-core/src/main/java/org/apache/jena/system/JenaSubsystemLifecycle.java ---
@@ -18,15 +18,15 @@
 
 package org.apache.jena.system;
 
--- End diff --

These are all needless whitespace changes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325752
  
--- Diff: jena-fuseki2/jena-fuseki-core/pom.xml ---
@@ -108,6 +108,12 @@
 
 
 
+  com.google.guava
--- End diff --

Guava types should be coming from Jena's shaded Guava artifact, not 
directly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325752
  
--- Diff: jena-fuseki2/jena-fuseki-core/pom.xml ---
@@ -108,6 +108,12 @@
 
 
 
+  com.google.guava
--- End diff --

Guava types should be coming from Jena's shaded Guava artifact, not 
directly.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325779
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheAction.java
 ---
@@ -0,0 +1,45 @@
+/**
+ * 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.cache;
+
+public class CacheAction {
+
+public CacheAction.Type type;
--- End diff --

Possibly better to make this `final`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325781
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheAction.java
 ---
@@ -0,0 +1,45 @@
+/**
+ * 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.cache;
+
+public class CacheAction {
+
+public CacheAction.Type type;
+
+private String key;
--- End diff --

Possibly better to make this `final`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325781
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheAction.java
 ---
@@ -0,0 +1,45 @@
+/**
+ * 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.cache;
+
+public class CacheAction {
+
+public CacheAction.Type type;
+
+private String key;
--- End diff --

Possibly better to make this `final`.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42325779
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/CacheAction.java
 ---
@@ -0,0 +1,45 @@
+/**
+ * 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.cache;
+
+public class CacheAction {
+
+public CacheAction.Type type;
--- End diff --

Possibly better to make this `final`.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42329075
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/GuavaCacheClient.java
 ---
@@ -0,0 +1,73 @@
+/**
+ * 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.cache;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class GuavaCacheClient extends CacheClient{
--- End diff --

There already exists a Guava-backed client in the form of `CacheGuava`. If 
you used the standard Jena `Cache` type instead of a new caching contract you 
could just use that.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on a diff in the pull request:

https://github.com/apache/jena/pull/95#discussion_r42329075
  
--- Diff: 
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cache/GuavaCacheClient.java
 ---
@@ -0,0 +1,73 @@
+/**
+ * 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.cache;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class GuavaCacheClient extends CacheClient{
--- End diff --

There already exists a Guava-backed client in the form of `CacheGuava`. If 
you used the standard Jena `Cache` type instead of a new caching contract you 
could just use that.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread ajs6f
Github user ajs6f commented on the pull request:

https://github.com/apache/jena/pull/95#issuecomment-149066287
  
I'm a little confused by the fact that for a feature that seems to require 
purchase only in an HTTP API (in Fuseki itself) this code seems to tangle all 
the way down into very low-level serialization code and basic types. It seems 
to me to be possible to do this reusing the extant caching machinery and doing 
new work only in Fuseki. Perhaps you can explain a little about why you chose 
to develop new caching machinery and why you integrated it in ARQ's 
serialization machinery. Perhaps I am misunderstanding the intent here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user ajs6f commented on the pull request:

https://github.com/apache/jena/pull/95#issuecomment-149066287
  
I'm a little confused by the fact that for a feature that seems to require 
purchase only in an HTTP API (in Fuseki itself) this code seems to tangle all 
the way down into very low-level serialization code and basic types. It seems 
to me to be possible to do this reusing the extant caching machinery and doing 
new work only in Fuseki. Perhaps you can explain a little about why you chose 
to develop new caching machinery and why you integrated it in ARQ's 
serialization machinery. Perhaps I am misunderstanding the intent here?


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] jena pull request: JENA-626 SPARQL Query Caching

2015-10-18 Thread osma
Github user osma commented on the pull request:

https://github.com/apache/jena/pull/95#issuecomment-149117326
  
Does this code notice when the underlying data is modified? E.g. if I do a 
PUT between GET requests, is the cache invalidated? Not just after 5 minutes 
but immediately.

For me this would the only good reason for having caching built in to Jena. 
Otherwise an external HTTP cache such as Varnish would work just as well if not 
better. See [this 
example](https://github.com/NatLibFi/Skosmos/wiki/FusekiTuning#http-caching) 
for how we use Varnish in front of Fuseki. It's very fast, the only problem is 
that it's unaware of changes in the data and therefore must be manually 
invalidated when the data is updated.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (JENA-626) SPARQL Query Caching

2015-10-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on JENA-626:
-

Github user osma commented on the pull request:

https://github.com/apache/jena/pull/95#issuecomment-149117326
  
Does this code notice when the underlying data is modified? E.g. if I do a 
PUT between GET requests, is the cache invalidated? Not just after 5 minutes 
but immediately.

For me this would the only good reason for having caching built in to Jena. 
Otherwise an external HTTP cache such as Varnish would work just as well if not 
better. See [this 
example](https://github.com/NatLibFi/Skosmos/wiki/FusekiTuning#http-caching) 
for how we use Varnish in front of Fuseki. It's very fast, the only problem is 
that it's unaware of changes in the data and therefore must be manually 
invalidated when the data is updated.


> SPARQL Query Caching
> 
>
> Key: JENA-626
> URL: https://issues.apache.org/jira/browse/JENA-626
> Project: Apache Jena
>  Issue Type: Improvement
>Reporter: Andy Seaborne
>  Labels: java, linked_data, rdf, sparql
>
> Add a caching layer to Fuseki to cache the results of SPARQL Query requests.  
> This cache should allow for in-memory and disk-based caching, configuration 
> and cache management, and coordination with data modification.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)