Hi,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 13, 2012 at 10:41 AM, Frederic Bergeron <span dir="ltr"><<a href="mailto:FBergeron@rocketmail.com" target="_blank">FBergeron@rocketmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:times new roman,new york,times,serif">Hi,<br><br>I am having a hard time trying to use the special variable $score with a LuceneModel.  Hopefully someone can help me.<br>
</div></div></blockquote><div><br></div><div>It's been a while since I've used a Lucene model, but I thought that it was a special predicate and not a special variable? If I'm wrong, then let me know, and I'll look at the source code to figure it out (I haven't looked in the Lucene code for a long time).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:times new roman,new york,times,serif">Originally, I had a SPARQL request like this: <br>
<br>PREFIX dct: <<a href="http://purl.org/dc/terms/" target="_blank">http://purl.org/dc/terms/</a>><br>PREFIX rdf: <<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#" target="_blank">http://www.w3.org/1999/02/22-rdf-syntax-ns#</a>><br>
PREFIX stuff: <<a href="http://mystuff.com/reference#" target="_blank">http://mystuff.com/reference#</a>><br>PREFIX server: <#><br><br>select DISTINCT ?s<br>where {<br>    ?s rdf:type <stuff:LearningObject> .<br>
    {<br>        graph server:mylucene {<br>            ?s dct:title "myKeyword"<br>        }<br>    }<br>    UNION<br>   
 {<br>        graph server:mylucene {<br>            ?s dct:description "myKeyword"<br>        }<br>    }<br>}<br><br>This works fine AFAIK.<br><br>Now, I would like to do the same request but sort the results according to Lucene's ranking.  To achieve this, the documentation mentions the $score special variable.  Unless I have overlooked it, the documentation doesn't explain how to use it.<br>
<br>I found an example that works here though:<br><br><a href="http://lists.mulgara.org/pipermail/mulgara-general/2010-August/001139.html" target="_blank">http://lists.mulgara.org/pipermail/mulgara-general/2010-August/001139.html</a><br>
<br>According to this exchange on the mailing-list, if I understand well, I must use TQL instead of SPARQL to use $score so I started to convert my previous SPARQL query to TQL like follow:<br></div></div></blockquote><div>
<br></div><div>Ah, I'd forgotten about this (and no one reminded me). Yes, I need to fix this so that it's more accessible from SPARQL (I think you can still get to the Lucene graph by using a FROM clause). However, since I need to get moving and implement SPARQL 1.1 I should get it done in there.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:times new roman,new york,times,serif">select $s $score from <rmi://localhost/comete#main><br>
where $s
 <<a href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" target="_blank">http://www.w3.org/1999/02/22-rdf-syntax-ns#type</a>> <<a href="http://mystuff.com/reference#LearningObject" target="_blank">http://mystuff.com/reference#LearningObject</a>> in <rmi://localhost/comete#main><br>
and $s <<a href="http://mulgara.org/mulgara#search" target="_blank">http://mulgara.org/mulgara#search</a>> $q in <rmi://localhost/comete#mylucene> <br>and $q <<a href="http://purl.org/dc/terms/description" target="_blank">http://purl.org/dc/terms/description</a>> 'myKeyword' in <rmi://localhost/comete#mylucene><br>
and $q <<a href="http://mulgara.org/mulgara#score" target="_blank">http://mulgara.org/mulgara#score</a>> $score in <rmi://localhost/comete#mylucene><br><br>This works fine.<br><br>Now, I would like to add another test on another predicate (like in my original SPARQL query in the first UNION clause).<br>
<br>I tried a few things and got the following error:<br><br>Error executing command. Reason: org.mulgara.query.QueryException: Query failed: Only one predicate supported per search: pred1=<a href="http://purl.org/dc/terms/title" target="_blank">http://purl.org/dc/terms/title</a>, pred2=<a href="http://purl.org/dc/terms/description" target="_blank">http://purl.org/dc/terms/description</a><br>
<br>Is it possible to use $score with a test involving more than one predicate on the
 LuceneModel?  How can I do that using TQL?<span class="HOEnZb"><font color="#888888"><br></font></span></div></div></blockquote><div> </div><div>I thought that it was. Did you try to re-use the $score variable? Can I see the query please? </div>
<div><br></div><div>Regards,</div><div>Paul</div></div></div>