Help:QueryEngine (SQLStore)
QueryEngine
The QueryEngine
handles the transformation of the ask
query language into a SQL
construct and is also
responsible to return query results from the SQL
back-end with the help of the following components:
- The
QuerySegmentListBuilder
transformsask
descriptions into individualQuerySegment
's (akaQuerySegmentList
) - The
DescriptionInterpreter
interface describes classes that are responsible to interpret a specificDescription
object and turn it into an abstractSQL
construct (aQuerySegment
) - The
QuerySegmentListProcessor
flattens and transforms a list ofQuerySegment
's into a non-recursive tree ofSQL
statements (including resolving of property/category hierarchies) - The
ConceptQueryResolver
encapsulates query processing of a concept description in connection with theConceptCache
class
Overview
Examples
```php /** * Equivalent to [[Category:Foo]] */ $classDescription = new ClassDescription( new DIWikiPage( 'Foo', NS_CATEGORY ) );
/** * Equivalent to [[:+]] */ $namespaceDescription = new NamespaceDescription( NS_MAIN );
/** * Equivalent to [[Foo::+]] */ $someProperty = new SomeProperty( new DIProperty( 'Foo' ), new ThingDescription() );
/**
* Equivalent to [[:+]][[Category:Foo]][[Foo::+]]
*/
$description = new Conjunction( [
$namespaceDescription,
$classDescription,
$someProperty
] );
php
$query = new Query( $description );
$query->setLimit( 10 );
$sqlStorefactory = new SQLStoreFactory( new SQLStore() );
$queryEngine = $sqlStorefactory->newMasterQueryEngine(); $queryResult = $queryEngine->getQueryResult( $query ); ```