On 12/06/11 08:40, Devayon Das wrote: > Hi, > what would be a quick way to programmatically check if a query is valid > or not without actually fetching results? I tried putting malformed > queries into Semantic Search, but I get all results (which probably eats > up a lot of CPU cycles) before I see a small error message.
The results of query parsing can be obtained from the query object (SMWQuery) that you create before sending it to the store for computing results. In Special:Ask, the query is first created by calling SMWQueryProcessor::createQuery(). The query object that this returns gives you access to error messages that happened during parsing (so you can check if there where errors or not) and also to the query description that was extracted (so you could check if it has any conditions other than a top level SMWThingDescription (the latter would describe a query without any conditions to restrict the matches). Note that SMW also has a setting $smwgIgnoreQueryErrors (currently true by default) that controls whether the store should answer to queries that have errors. Markus ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel