Пример #1
0
 public function getQueryString($asValue = false)
 {
     $subDescription = $this->description;
     // Use the canonical label to ensure that conditions contain
     // language indep. references
     $propertyChainString = $this->property->getCanonicalLabel();
     $propertyname = $propertyChainString;
     while ($propertyname !== '' && $subDescription instanceof SomeProperty) {
         // try to use property chain syntax
         $propertyname = $subDescription->getProperty()->getCanonicalLabel();
         if ($propertyname !== '') {
             $propertyChainString .= '.' . $propertyname;
             $subDescription = $subDescription->getDescription();
         }
     }
     if ($asValue) {
         return '<q>[[' . $propertyChainString . '::' . $subDescription->getQueryString(true) . ']]</q>';
     }
     return '[[' . $propertyChainString . '::' . $subDescription->getQueryString(true) . ']]';
 }
 private function findPropertyIdByLabel($label)
 {
     $property = new DIProperty(PropertyRegistry::getInstance()->findPropertyIdByLabel($label));
     $canonicalLabel = $property->getCanonicalLabel();
     // #1966 and #1968
     // In case something goes wrong, a recursive loop will kill PHP
     // and we know we messed up
     if ($canonicalLabel !== '' && $label !== $canonicalLabel) {
         $this->findPropertyIdByLabel($property->getCanonicalDiWikiPage()->getTitle()->getText());
     }
     return array($label, $property);
 }
Пример #3
0
 public function testCanonicalRepresentation()
 {
     $property = new DIProperty('_MDAT');
     $this->assertEquals('Modification date', $property->getCanonicalLabel());
     $this->assertEquals(new DIWikiPage('Modification_date', SMW_NS_PROPERTY), $property->getCanonicalDiWikiPage());
 }
 private function findBasePropertyToRedirectFor($label)
 {
     $property = new DIProperty(PropertyRegistry::getInstance()->findPropertyIdByLabel($label));
     // Ensure to redirect to `Property:Modification date` and not using
     // a possible user contextualized version such as `Property:Date de modification`
     $canonicalLabel = $property->getCanonicalLabel();
     if ($canonicalLabel !== '' && $label !== $canonicalLabel) {
         $outputPage = $this->getContext()->getOutput();
         $outputPage->redirect($property->getCanonicalDiWikiPage()->getTitle()->getFullURL());
     }
 }