diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/src/Query/ProfileAnnotators/SourceProfileAnnotator.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/src/Query/ProfileAnnotators/SourceProfileAnnotator.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/src/Query/ProfileAnnotators/SourceProfileAnnotator.php b/www/wiki/extensions/SemanticMediaWiki/src/Query/ProfileAnnotators/SourceProfileAnnotator.php new file mode 100644 index 00000000..31837010 --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/src/Query/ProfileAnnotators/SourceProfileAnnotator.php @@ -0,0 +1,49 @@ +<?php + +namespace SMW\Query\ProfileAnnotators; + +use SMW\DIProperty; +use SMW\Query\ProfileAnnotator; +use SMWDIBlob as DIBlob; + +/** + * @license GNU GPL v2+ + * @since 2.5 + * + * @author mwjames + */ +class SourceProfileAnnotator extends ProfileAnnotatorDecorator { + + /** + * @var string + */ + private $querySource; + + /** + * @since 2.5 + * + * @param ProfileAnnotator $profileAnnotator + * @param string $querySource + */ + public function __construct( ProfileAnnotator $profileAnnotator, $querySource = '' ) { + parent::__construct( $profileAnnotator ); + $this->querySource = $querySource; + } + + /** + * ProfileAnnotatorDecorator::addPropertyValues + */ + protected function addPropertyValues() { + if ( $this->querySource !== '' ) { + $this->addQuerySource( $this->querySource ); + } + } + + private function addQuerySource( $querySource ) { + $this->getSemanticData()->addPropertyObjectValue( + new DIProperty( '_ASKSC' ), + new DIBlob( $querySource ) + ); + } + +} |