blob: 0c9057d2a338e64c6dfa6d6a81280e1de374829d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
<?php
namespace SMW\Tests\Util;
use SMW\Store;
use SMW\DIWikiPage;
use SMW\SemanticData;
use SMWRequestOptions as RequestOptions;
/**
* @ingroup Test
*
* @group SMW
* @group SMWExtension
*
* @license GNU GPL v2+
* @since 2.0
*
* @author mwjames
*/
class InSemanticDataFetcher {
/**
* @var Store
*/
private $store = null;
/**
* @since 2.0
*
* @param Store $store
*/
public function __construct( Store $store ) {
$this->store = $store;
}
/**
* @since 2.0
*
* @return SemanticData
*/
public function getSemanticData( DIWikiPage $subject ) {
$requestOptions = new RequestOptions();
$requestOptions->sort = true;
$semanticData = new SemanticData( $subject );
$incomingProperties = $this->store->getInProperties( $subject, $requestOptions );
foreach ( $incomingProperties as $property ) {
$values = $this->store->getPropertySubjects( $property, null );
foreach ( $values as $value ) {
$semanticData->addPropertyObjectValue( $property, $value );
}
}
return $semanticData;
}
}
|