public function testErrorContainerForInverseProperty() { $instance = new Error(DIWikiPage::newFromText('Foo')); $this->assertEquals(new DIProperty('_ERRC'), $instance->getProperty()); $container = $instance->getContainerFor(new DIProperty('Foo', true), array('Some error')); $expected = array('propertyCount' => 2, 'propertyKeys' => array('_ERRP', '_ERRT')); $this->semanticDataValidator->assertThatPropertiesAreSet($expected, $container->getSemanticData()); }
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()); }