[
https://issues.apache.org/jira/browse/JENA-1093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058327#comment-15058327
]
ASF GitHub Bot commented on JENA-1093:
--------------------------------------
Github user afs commented on a diff in the pull request:
https://github.com/apache/jena/pull/111#discussion_r47664861
--- Diff:
jena-arq/src/main/java/org/apache/jena/sparql/pfunction/PropertyFunctionBase.java
---
@@ -88,24 +88,25 @@ public QueryIterator exec(QueryIterator input,
PropFuncArg argSubject, Node pred
class RepeatApplyIteratorPF extends QueryIterRepeatApply
{
- private final PropFuncArg argSubject ;
- private final Node predicate ;
- private final PropFuncArg argObject ;
+ private ExecutionContext execCxt ;
+ private PropFuncArg argSubject ;
+ private Node predicate ;
+ private PropFuncArg argObject ;
- public RepeatApplyIteratorPF(QueryIterator input, PropFuncArg
argSubject, Node predicate, PropFuncArg argObject, ExecutionContext execCxt)
- {
- super(input, execCxt) ;
- this.argSubject = argSubject ;
- this.predicate = predicate ;
- this.argObject = argObject ;
- }
+ public RepeatApplyIteratorPF(QueryIterator input, PropFuncArg
argSubject, Node predicate, PropFuncArg argObject, ExecutionContext execCxt)
+ {
+ super(input, execCxt) ;
+ this.argSubject = argSubject ;
+ this.predicate = predicate ;
+ this.argObject = argObject ;
+ }
@Override
protected QueryIterator nextStage(Binding binding)
{
- QueryIterator iter = exec(binding, argSubject, predicate,
argObject, getExecContext()) ;
+ QueryIterator iter = exec(binding, argSubject, predicate,
argObject, super.getExecContext()) ;
if ( iter == null )
- iter = IterLib.noResults(getExecContext()) ;
+ iter = IterLib.noResults(execCxt) ;
return iter ;
--- End diff --
This change is potentially significant. The execution context can change
during execution where a new context derived from the current one is produced
so please keep L108/L109.
> jena-text query doesn't return all matching literals
> ----------------------------------------------------
>
> Key: JENA-1093
> URL: https://issues.apache.org/jira/browse/JENA-1093
> Project: Apache Jena
> Issue Type: Bug
> Components: Text
> Affects Versions: Jena 3.0.1
> Reporter: Osma Suominen
> Assignee: Osma Suominen
>
> After the optimizations in JENA-999, the text:query property function, when
> asked for stored literal values, no longer returns all matching literals.
> Instead, each subject is returned with a random TextHit (i.e. score+literal
> pair). This is a problem for me because I want to show to the user the most
> relevant reason why the search matched a particular SKOS concept (there may
> be many matching labels in various languages), or in some cases all the
> reasons.
> Also the returned match may not have the highest score, which could be a
> problem if one is interested in the score (I'm not).
> For example, with storeLiterals enabled and this data:
> {noformat}
> ex:subject rdfs:label "one reason", "another reason" .
> {noformat}
> this query
> {noformat}
> (?s ?score ?literal) text:query "reason" .
> {noformat}
> will return a single binding where ?literal is bound to either "one reason"
> or "another reason".
> Before JENA-999 it returned two bindings, one per literal.
> The culprit is the post-JENA-999 code in the TextQueryPF.exec method,
> particularly around this line that suppresses subsequent hits with the same
> subject URI:
> https://github.com/apache/jena/blob/master/jena-text/src/main/java/org/apache/jena/query/text/TextQueryPF.java#L188
> I already have a failing unit test that shows what I'd like to accomplish. I
> will try to make a PR at some point.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)