Пример #1
0
 /**
  * 
  * @param core_kernel_classes_Class $resource
  * @param array $propertyFilters
  * @param array $options
  * @return string
  */
 public function getFilteredQuery(core_kernel_classes_Class $resource, $propertyFilters = array(), $options = array())
 {
     $rdftypes = array();
     // Check recursivity...
     if (isset($options['recursive']) && $options['recursive']) {
         foreach ($this->getSubClasses($resource, $options['recursive']) as $subClass) {
             $rdftypes[] = $subClass->getUri();
         }
     }
     // Check additional classes...
     if (isset($options['additionalClasses'])) {
         foreach ($options['additionalClasses'] as $aC) {
             $rdftypes[] = $aC instanceof core_kernel_classes_Resource ? $aC->getUri() : $aC;
             $rdftypes = array_unique($rdftypes);
         }
     }
     // Add the class type of the given class
     if (!in_array($resource->getUri(), $rdftypes)) {
         $rdftypes[] = $resource->getUri();
     }
     $and = isset($options['chaining']) === false ? true : (strtolower($options['chaining']) === 'and' ? true : false);
     $like = isset($options['like']) === false ? true : $options['like'];
     $lang = isset($options['lang']) === false ? '' : $options['lang'];
     $offset = isset($options['offset']) === false ? 0 : $options['offset'];
     $limit = isset($options['limit']) === false ? 0 : $options['limit'];
     $order = isset($options['order']) === false ? '' : $options['order'];
     $orderdir = isset($options['orderdir']) === false ? 'ASC' : $options['orderdir'];
     $query = core_kernel_persistence_smoothsql_Utils::buildFilterQuery($this->getModel(), $rdftypes, $propertyFilters, $and, $like, $lang, $offset, $limit, $order, $orderdir);
     return $query;
 }