Github user osma commented on a diff in the pull request:
https://github.com/apache/jena/pull/112#discussion_r48288750
--- Diff:
jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java ---
@@ -210,44 +212,36 @@ private QueryIterator variableSubject(Binding
binding, Node s, Node score, Node
return bmap;
} ;
- Iterator<Binding> bIter = Iter.map(r.iterator(), converter);
+ Iterator<Binding> bIter = Iter.map(results.iterator(), converter);
QueryIterator qIter = new QueryIterPlainWrapper(bIter, execCxt);
return qIter ;
}
+ private QueryIterator variableSubject(Binding binding, Node s, Node
score, Node literal, StrMatch match, ExecutionContext execCxt) {
+ List<TextHit> r = query(match.getProperty(),
match.getQueryString(), match.getLimit(), execCxt) ;
+ return resultsToQueryIterator(binding, s, score, literal, r,
execCxt);
+ }
+
private QueryIterator concreteSubject(Binding binding, Node s, Node
score, Node literal, StrMatch match, ExecutionContext execCxt) {
if (!s.isURI()) {
log.warn("Subject not a URI: " + s) ;
return IterLib.noResults(execCxt) ;
}
- Var scoreVar = (score==null) ? null : Var.alloc(score) ;
- Var literalVar = (literal==null) ? null : Var.alloc(literal) ;
String qs = match.getQueryString() ;
List<TextHit> x = query(match.getProperty(),
match.getQueryString(), -1, execCxt) ;
if ( x == null ) // null return value - empty result
return IterLib.noResults(execCxt) ;
+ List<TextHit> r = new LinkedList();
--- End diff --
Thanks, I sort of knew there was a shorter way of doing this but didn't
know the correct idioms (if this were Python, I'd used a list comprehension).
Though I'm not sure I like that style either. At least the for loop is clear
and makes it blatantly obvious that the whole list gets traversed, which is a
potential performance problem in itself...
I plan to replace this part of the code very soon with a cache layer, see
the discussion in JENA-999.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---