blob: a6d6d97c6fa35f811e5878b1ccdf495e0fdeab3c (
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
|
<?php
namespace SMW\SPARQLStore;
use SMW\DIProperty;
use SMW\SemanticData;
/**
* Truncate a SemanticData instance for the replication process
*
* @license GNU GPL v2+
* @since 2.5
*
* @author mwjames
*/
class ReplicationDataTruncator {
/**
* @var array
*/
private $propertyExemptionList = [];
/**
* @since 2.5
*
* @param array $propertyExemptionList
*/
public function setPropertyExemptionList( array $propertyExemptionList ) {
$this->propertyExemptionList = str_replace( ' ', '_', $propertyExemptionList );
}
/**
* @since 2.5
*
* @param SemanticData $semanticDat
*
* @return SemanticData
*/
public function doTruncate( SemanticData $semanticData ) {
if ( $this->propertyExemptionList === [] ) {
return $semanticData;
}
foreach ( $this->propertyExemptionList as $property ) {
$semanticData->removeProperty( DIProperty::newFromUserLabel( $property ) );
}
return $semanticData;
}
}
|