Hi!<div><br><div><div>As Sebastian suggested I tried the search API without my dirty hack and I finally learn how to use it. This is my first successful code:</div></div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
term = Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("música", 'UTF-8')))<br>query = Nepomuk.Query.Query(term)<br>[code #1]<br>query.addRequestProperty(Nepomuk.Query.Query.RequestProperty(Nepomuk.Types.Property(NEO('nie#url', True))))<br>
query.addRequestProperty(Nepomuk.Query.Query.RequestProperty(Nepomuk.Types.Property(NEO('nao#prefLabel', True))))<br>sparqlQuery = query.toSparqlQuery()<br>model = Nepomuk.ResourceManager.instance().mainModel()<br>
data = model.executeQuery(sparqlQuery, Soprano.Query.QueryLanguageSparql)<div>... < code to display result set > ...</div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">[code #1]</div></blockquote>
<div><br></div><div>The query is slow but works and columns url and prefLabel are available. Great!</div><div><div>896 results found in 7.69615888596 seconds</div></div><div><br></div><div>I have a common query I used often when I'm developing "ha ji won kim sa rang" because result set has one row (this is equivalent to write "'ha' and 'ji' and 'won' and 'kim' and 'sa' and 'rang') and this is the result set with a query generated by my builder nsSparqlBuilder.</div>
<div><br></div><div>file:///media/HD1.5TB-01/video/corea/doramas/Secret Garden, [FileDataObject]<meta http-equiv="content-type" content="text/html; charset=utf-8"></div><div><div>1 results found in 1.21383500099 seconds.</div>
</div><div><br></div><div>So I wrote the next code to test the API expecting same results:</div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>andTerm = Nepomuk.Query.AndTerm()</div>
<div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ha", 'UTF-8'))))</div></div></div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ji", 'UTF-8'))))</div>
</div></div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("won", 'UTF-8'))))</div></div></div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("kim", 'UTF-8'))))</div>
</div></div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("sa", 'UTF-8'))))</div></div></div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("rang", 'UTF-8'))))</div>
</div></div><div><div><div>query = Nepomuk.Query.Query(andTerm)</div></div></div><div>[code #1]<meta http-equiv="content-type" content="text/html; charset=utf-8"></div><div><div><div><br></div></div></div></blockquote><div>
<div>and this is the result set I obtained:</div><div><br></div><div><div><div>(iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ200: The memory pool size 400005656 reached the limit 400000000 bytes, try to increase the MaxMemPoolSize ini setting)"</div>
<div>0 results found in 85.3466908932 seconds</div></div></div><div><br></div><div>Them I deleted two terms, the second and the five and there is no error but result set is the next one:</div><div><div><div>0 results found in 600.101149082 seconds</div>
</div></div><div><br></div><div>Finally I discover that generated API queries works with two terms and fails with more. For example, the next test is very slow but works:</div></div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">
<div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ha", 'UTF-8'))))</div></div></div></div><div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ji", 'UTF-8'))))</div>
</div></div></div></blockquote><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><div></div></div></div><div><br></div><div><div><div>nepomuk:/res/c894d8fa-cb6a-4ab3-ab26-37a6abbe206e, , ha ji won</div>
<div>nepomuk:/res/c0642c10-6501-448c-a8ed-4992f45c232e, file:///media/HD1.5TB-01/video/corea/doramas/Secret Garden, </div><div>2 results found in 25.7656869888 seconds</div></div></div><div><br></div><div>but the next one not:</div>
<div><div><br></div><blockquote class="webkit-indent-blockquote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 40px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
<div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ha", 'UTF-8'))))</div></div></div></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ji", 'UTF-8'))))</div>
<div><div><div><div>andTerm.addSubTerm(Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("won", 'UTF-8'))))</div></div></div></div></blockquote><div><div><div></div></div></div></div><div><br></div>
<div>and result is:</div><div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div><div>
local socket error: QLocalSocket::SocketTimeoutError </div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div>
<div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div>
<div>0 results found in 1201.46248913 seconds</div><div>"" Soprano: "Command timed out."</div><div>"" Soprano: "Command timed out."</div></div><div><br></div><div><div>In documentation there is no limit to the number of terms you can add and even there is a constructor where you can add 6 terms. I tried it but results are the same, the first term works but the second one not. </div>
<div><br></div><div><div> term = Nepomuk.Query.AndTerm( \</div><div> Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ha", 'UTF-8'))), \</div><div> Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ji", 'UTF-8'))), \</div>
<div> Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("won", 'UTF-8'))) \</div><div> )</div><div><br></div><div> term = Nepomuk.Query.AndTerm( \</div><div> Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("ha", 'UTF-8'))), \</div>
<div> Nepomuk.Query.LiteralTerm(Soprano.LiteralValue(unicode("won", 'UTF-8'))) \</div><div> )</div></div><div><br></div><div>On the other side using API if external hard drive is not mounted result sets are empty. This behavior can be disabled?</div>
<div><br></div><div>I only tried AndTerm but tomorrow I will try OrTerm if I have free time.</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br>-- <br>Cheers,<div>Ignacio</div><div><br></div>
<br>
</div></div></div>