From: <tr...@do...> - 2013-07-11 20:04:51
|
<p>A new comment has been added to the following issue.</p> <table border="0"> <tr> <td width="90px" valign="top"><b>Title:</b></td> <td>Add some "lazyness" to algebra evaluation</td> </tr> <tr> <td><b>Project:</b></td> <td>Core Library (dotNetRDF.dll)</td> </tr> <tr> <td><b>Created By:</b></td> <td>Rob Vesse</td> </tr> <tr> <td><b>Date:</b></td> <td>2013-07-11 09:03 PM</td> </tr> <tr> <td><b>Comment:</b></td> </tr> <tr> <td colspan="2"><p> The query engine already includes lazy evaluation where possible but your query is not eligible. This is primarily because you use DISTINCT which means it needs to materialize the all the results before throwing away the duplicates though there are other aspects of your query that block lazy evaluation (the use of a non-trivial ORDER BY). Generally speaking query evaluation could be lazier but this is not easily done within the current architecture, see <a href="https://bitbucket.org/dotnetrdf/dotnetrdf/wiki/DeveloperGuide/Architecture/Design/Medusa">https://bitbucket.org/dotnetrdf/dotnetrdf/wiki/DeveloperGuide/Architecture/Design/Medusa</a> for some design thinking on future rearchitecting to this effect.</p> <p> </p> <p> Regardless the engine cannot make an arbitrary decision to change the query to apply the BIND where you are suggesting since that would mean disregarding the SPARQL specification.</p> <p> </p> <p> Note that you can force the engine to evaluate the query in the order you want by using a sub-query which forces things to be evaluated earlier:</p> <p> </p> <div> SELECT ?org ?hasBlogPost ?hasEvent ?hasJobOffer ?hasProduct ?hasGoodDeal ?isWebSite {</div> <div> FILTER (NOT EXISTS{ ?org a my:PortalSite }) .</div> <div> BIND ( EXISTS { ?item a my:BlogPost . ?item my:authoredBy ?org} as ?hasBlogPost) .</div> <div> BIND ( EXISTS { ?item a my:Event. ?item my:authoredBy ?org} as ?hasEvent) .</div> <div> BIND ( EXISTS { ?item a my:JobOffer. ?item my:authoredBy ?org} as ?hasJobOffer) .</div> <div> BIND ( EXISTS { ?item a my:ProductOrService . ?item my:authoredBy ?org} as ?hasProduct) .</div> <div> BIND ( EXISTS { ?item a my:GoodDeal . ?item my:authoredBy ?org} as ?hasGoodDeal) .</div> <div> BIND (EXISTS{?org a my:PersonalSite } as ?isWebSite)</div> <div> {</div> <div> SELECT DISTINCT ?org ?lbl</div> <div> WHERE</div> <div> {</div> <div> ?org rdfs:label ?lbl . ?org a my:Organization</div> <div> } ORDER BY DESC(?isWebSite) ASC(?lbl) LIMIT 10</div> <div> }</div> <div> }</div> <p> </p></td> </tr> </table> <p> More information on this issue can be found at <a href="http://www.dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=369" target="_blank">http://www.dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=369</a></p> <p style="text-align:center;font-size:8pt;padding:5px;"> If you no longer wish to receive notifications, please visit <a href="http://www.dotnetrdf.org/tracker/Account/UserProfile.aspx" target="_blank">your profile</a> and change your notifications options. </p> |