jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [06/14] jena git commit: added tracing exec, etc for development
Date Fri, 01 Dec 2017 19:09:06 GMT
added tracing exec, etc for development

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/452b3838
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/452b3838
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/452b3838

Branch: refs/heads/master
Commit: 452b3838aee02da4983e8df8c6b33c504e7c3f5a
Parents: d98b096
Author: Chris Tomlinson <ct@moonvine.org>
Authored: Tue Nov 28 11:57:16 2017 -0600
Committer: Chris Tomlinson <ct@moonvine.org>
Committed: Tue Nov 28 11:57:16 2017 -0600

----------------------------------------------------------------------
 .../org/apache/jena/query/text/TextQueryPF.java | 27 +++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/452b3838/jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java
----------------------------------------------------------------------
diff --git a/jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java b/jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java
index 20668cd..4a68b28 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java
@@ -23,6 +23,7 @@ import java.util.Iterator ;
 import java.util.List ;
 import java.util.function.Function ;
 
+import org.apache.jena.atlas.io.IndentedLineBuffer;
 import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.atlas.lib.Cache ;
 import org.apache.jena.atlas.lib.CacheFactory ;
@@ -147,6 +148,13 @@ public class TextQueryPF extends PropertyFunctionBase {
     @Override
     public QueryIterator exec(Binding binding, PropFuncArg argSubject, Node predicate, PropFuncArg
argObject,
                               ExecutionContext execCxt) {
+        if (log.isTraceEnabled()) {
+            IndentedLineBuffer subjBuff = new IndentedLineBuffer() ;
+            argSubject.output(subjBuff, null) ;
+            IndentedLineBuffer objBuff = new IndentedLineBuffer() ;
+            argObject.output(objBuff, null) ;
+            log.trace("exec: {} text:query {}", subjBuff, objBuff) ;
+        }
         if (textIndex == null) {
             if (!warningIssued) {
                 Log.warn(getClass(), "No text index - no text search performed") ;
@@ -201,6 +209,8 @@ public class TextQueryPF extends PropertyFunctionBase {
     }
 
     private QueryIterator resultsToQueryIterator(Binding binding, Node s, Node score, Node
literal, Collection<TextHit> results, ExecutionContext execCxt) {
+        if (log.isTraceEnabled())
+            log.trace("resultsToQueryIterator: {}", results) ;
         Var sVar = Var.isVar(s) ? Var.alloc(s) : null ;
         Var scoreVar = (score==null) ? null : Var.alloc(score) ;
         Var literalVar = (literal==null) ? null : Var.alloc(literal) ;
@@ -224,12 +234,16 @@ public class TextQueryPF extends PropertyFunctionBase {
     }
 
     private QueryIterator variableSubject(Binding binding, Node s, Node score, Node literal,
StrMatch match, ExecutionContext execCxt) {
+        if (log.isTraceEnabled())
+            log.trace("variableSubject: {}", match) ;
         ListMultimap<String,TextHit> results = query(match.getProperty(), match.getQueryString(),
match.getLang(), match.getLimit(), execCxt) ;
         Collection<TextHit> r = results.values();
         return resultsToQueryIterator(binding, s, score, literal, r, execCxt);
     }
 
     private QueryIterator concreteSubject(Binding binding, Node s, Node score, Node literal,
StrMatch match, ExecutionContext execCxt) {
+        if (log.isTraceEnabled())
+            log.trace("concreteSubject: {}", match) ;
         ListMultimap<String,TextHit> x = query(match.getProperty(), match.getQueryString(),
match.getLang(), -1, execCxt) ;
         
         if ( x == null ) // null return value - empty result
@@ -267,13 +281,13 @@ public class TextQueryPF extends PropertyFunctionBase {
                 execCxt.getContext().put(cacheSymbol, queryCache);
             }
 
-            if ( log.isDebugEnabled())
-                log.debug("Caching Text query: {} with key: >>{}<< in cache:
{}", queryString, cacheKey, queryCache) ;
+            if (log.isTraceEnabled())
+                log.trace("Caching Text query: {} with key: >>{}<< in cache:
{}", queryString, cacheKey, queryCache) ;
 
             results = queryCache.getOrFill(cacheKey, ()->performQuery(property, queryString,
graphURI, lang, limit));
         } else {
-            if ( log.isDebugEnabled())
-                log.debug("Executing w/o cache Text query: {}", queryString) ;
+            if (log.isTraceEnabled())
+                log.trace("Executing w/o cache Text query: {}", queryString) ;
             results = performQuery(property, queryString, graphURI, lang, limit);
         }
 
@@ -426,5 +440,10 @@ public class TextQueryPF extends PropertyFunctionBase {
         public float getScoreLimit() {
             return scoreLimit ;
         }
+        
+        @Override
+        public String toString() {
+            return "( property: " + property + "; query: " + queryString + "; limit: " +
limit + "; lang: " + lang + " )";
+        }
     }
 }


Mime
View raw message