예제 #1
0
 public function testErrorContainerForSamePropertyButDifferentMsg()
 {
     $instance = new Error(DIWikiPage::newFromText('Foo'));
     $property = new DIProperty('Foo');
     $container = $instance->getContainerFor($property, array('Some error'));
     $this->assertNotSame($container->getHash(), $instance->getContainerFor($property, array('Different error'))->getHash());
 }
 private function createQueryProfile($query, $format, $duration)
 {
     // In case of an query error add a marker to the subject for
     // discoverability of a failed query
     if ($query->getErrors() !== array()) {
         $error = new Error($this->parserData->getSubject());
         $this->parserData->getSemanticData()->addPropertyObjectValue($error->getProperty(), $error->getContainerFor(new DIProperty('_ASK'), $query->getQueryString() . ' (' . implode(' ', $query->getErrors()) . ')'));
     }
     $queryProfileAnnotatorFactory = $this->applicationFactory->newQueryProfileAnnotatorFactory();
     $jointProfileAnnotator = $queryProfileAnnotatorFactory->newJointProfileAnnotator($query, $format, $duration);
     $jointProfileAnnotator->addAnnotation();
     $this->parserData->getSemanticData()->addPropertyObjectValue($jointProfileAnnotator->getProperty(), $jointProfileAnnotator->getContainer());
 }
 private function addErrorWithMsg($subject, $errorMsg)
 {
     $error = new Error($subject);
     $this->parserData->getSemanticData()->addPropertyObjectValue($error->getProperty(), $error->getContainerFor(new DIProperty('_SOBJ'), $errorMsg));
     $this->parserData->addError($errorMsg);
     return false;
 }
 /**
  * @since 1.9
  *
  * @param SMWDataValue $dataValue
  */
 public function addDataValue(SMWDataValue $dataValue)
 {
     if (!$dataValue->getProperty() instanceof DIProperty || !$dataValue->isValid()) {
         $error = new Error($this->getSubject());
         $this->addPropertyObjectValue($error->getProperty(), $error->getContainerFor($dataValue->getProperty(), $dataValue->getErrors()));
         return $this->addError($dataValue->getErrors());
     }
     $this->addPropertyObjectValue($dataValue->getProperty(), $dataValue->getDataItem());
 }