/**
  * TODO: One instance of the SMW IDs table on s_id always suffices (swm_id is KEY)! Doable in execution ... (PERFORMANCE)
  *
  * @since 2.2
  *
  * @param Description $description
  *
  * @return QuerySegment
  */
 public function interpretDescription(Description $description)
 {
     $query = new QuerySegment();
     $query->joinTable = SMWSql3SmwIds::tableName;
     $query->joinfield = "{$query->alias}.smw_id";
     $query->where = "{$query->alias}.smw_namespace=" . $this->queryBuilder->getStore()->getConnection('mw.db')->addQuotes($description->getNamespace());
     return $query;
 }
 /**
  * TODO: One instance of the SMW IDs table on s_id always suffices (swm_id is KEY)! Doable in execution ... (PERFORMANCE)
  *
  * @since 2.2
  *
  * @param Description $description
  *
  * @return QuerySegment
  */
 public function interpretDescription(Description $description)
 {
     $db = $this->querySegmentListBuilder->getStore()->getConnection('mw.db.queryengine');
     $query = new QuerySegment();
     $query->joinTable = SMWSql3SmwIds::TABLE_NAME;
     $query->joinfield = "{$query->alias}.smw_id";
     $query->where = "{$query->alias}.smw_namespace=" . $db->addQuotes($description->getNamespace());
     return $query;
 }
Пример #3
0
 /**
  * Create an Condition from a NamespaceDescription
  *
  * @param NamespaceDescription $description
  * @param string $joinVariable
  * @param DIProperty|null $orderByProperty
  *
  * @return Condition
  */
 public function buildCondition(Description $description, $joinVariable, $orderByProperty = null)
 {
     $nspropExpElement = $this->exporter->getSpecialNsResource('swivt', 'wikiNamespace');
     $nsExpElement = new ExpLiteral(strval($description->getNamespace()), 'http://www.w3.org/2001/XMLSchema#integer');
     $nsName = TurtleSerializer::getTurtleNameForExpElement($nsExpElement);
     $condition = "{ ?{$joinVariable} " . $nspropExpElement->getQName() . " {$nsName} . }\n";
     $result = new WhereCondition($condition, true, array());
     $this->compoundConditionBuilder->addOrderByDataForProperty($result, $joinVariable, $orderByProperty, DataItem::TYPE_WIKIPAGE);
     return $result;
 }