Hi!<div><br></div><div>As I explain in my presentation I&#39;m working in an alternative system to nepomuksearch protocol and dolphin&#39;s filter panel. My first try was last weekend with basic success but my sparql builder lack of certain logic problems, and code was a mess, so I rewritten yesterday from scratch.</div>

<div><br></div><div>I created a new class nsSparqlBuilder to build queries and I think that I solved all previous logic problems with negations and when you mixtured different ontologies. In current version supported query syntax is the next:</div>

<div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">exact_string = &quot;string&quot; | &#39;string&#39;</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">value = exact_string | number | string</div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">

<br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">term = [ + | - ] value [:ontology]</div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">

query = term [ [ and | or ] term ]...</div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">

but this is not the final syntax, dates, arithmetic operators (currently only &quot;!=&quot; &quot;==&quot; and &quot;=&quot; are supported), for numbers and dates basically, wildcards and parenthesis are not ready yet but probably will be next weekend.</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Here are some working samples extracted for my test cases:</div>

<div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">&quot;kim sa rang ha ji won&quot;</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">&quot;&#39;kim sa rang&#39; -&#39;ha ji won&#39;&quot;</span></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">&quot;música:hastag tomtom:hastag or &#39;son dam bi&#39;:hasTag música:hastag&quot;</span></font></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">&quot;guilty 9:rating&quot;</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">&quot;悪魔と契約し:name&quot;</span></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">&quot;&#39;giruti akuma&#39; or &#39;otoko&#39;</span><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">:description</span><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; ">&quot;</span></div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">&quot;+&#39;abe hiroshi&#39; &#39;natsukawa yui&#39;&quot;</span></font></div>

</div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">There is no dependencies between parser engine and query builder so, don&#39;t worry, change query syntax is easy so there is no problem to implement a syntax similar actual nepomukquery with some enhancements. I at least add &quot;and&quot; to this version but you can write queries without using it :)</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Because a lack of time I only written 15 test cases but some human testers are welcome. You only need python 2.6 and kde python bindings installed.</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">While I coding some questions present to me so I ask you guys for help.</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">1) What would be the search engine behavior when you write a simple query like this &quot;music&quot;?</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; ">Actually I use nsSparqlBuilder.ontologyFilters to determine what filters I must add to the query. Currently nao:description, nao:identifier, nie:url and nao:hasTag are supported but this method is manual so I wonder if there is a better solution out there.</span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; ">I add two methods, nsSparqlBuilder.AddOntologyFilter() and nsSparqlBuilder.RemoveOntologyFilter() (not coded yet :)), to dynamically change the behavior of the query builder but the best solution would be an automatic method. Any suggestions?</span></font></div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">2) There is a method to determine an ontology type?</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Actually I store in nsSparqlBuilder.ontologyFilters the type because this information is required to build filter clause and this is far to be a good solution. Coerced all data as string has collateral problems with arithmetic operators and a time penalty so I look for a better solution.</span></font></div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">3) When I search for a term I must use relations to search for more items? At what level I must stop the search?</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">For example, I search for &quot;korea&quot; (without any ontology) and in my database there is files tagged with &quot;korea&quot; but there is tags or contacts with &quot;nao:isRelated&quot; &quot;korea&quot; also. The case is more complex if you thing that there are many relation kinds &quot;nmm:actor&quot;, &quot;nmm:writer&quot;, &quot;nco:creator&quot;, etc.</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Adding all this stuff will produce slow queries so I don&#39;t sure about the better approach. There is even more work to do if you don&#39;t stop in first level so you could finish with a pretty big and slow query.</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">On the other side, what is the better solution to determine what relations I must use. I know that all are in documentation but I&#39;m asking for a non hardcoded solution.</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">4) What are the basic ontologies that must be implemented?</div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; ">I currently support the next </span><span class="Apple-style-span" style="border-collapse: collapse; ">abbreviates</span><span class="Apple-style-span" style="border-collapse: collapse; ">: description, hasTag, rating or numericRating, prefLabel, title, url or name and tag that are converted to proper ontology. You even write completed ontologies names, so nao:url and url are the same and there is no limitations in this case and you can add any available ontology but, with the problem of point 2, probably this will not work well with non string ontologies and more work is needed and doing test are pending.</span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">But the really big problem is with relation ontologies like nao:hasTag. In this particular case query is &quot;?x nao:hasTag ?y . ?y nao:identifier ?z . FILTER(?z)&quot;, so you need a inner join and you do the real filter in nao:identifier but this is not applicable to all relations. Some light about this stuff are welcome.</span></font></div>

<div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><br></div><div style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">Thank you for your help.</div>
</div>
<div><br>-- <br>Cheers,<div>Ignacio</div><div><br></div>
</div>