summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/Query/Language/ThingDescription.php
blob: 3419df194ecaaac90bfbdc3b4c147d5ffbc89cad (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
<?php

namespace SMW\Query\Language;

/**
 * A dummy description that describes any object. Corresponds to
 * owl:thing, the class of all abstract objects. Note that it is
 * not used for datavalues of attributes in order to support type
 * hinting in the API: descriptions of data are always
 * ValueDescription objects.
 *
 * @license GNU GPL v2+
 * @since 1.6
 *
 * @author Markus Krötzsch
 */
class ThingDescription extends Description {

	public function getQueryString( $asValue = false ) {
		return $asValue ? ( isset( $this->isNegation ) ? '!' : '' ) . '+' : '';
	}

	public function isSingleton() {
		return false;
	}

	public function getSize() {
		return 0; // no real condition, no size or depth
	}

	public function prune( &$maxsize, &$maxdepth, &$log ) {
		return $this;
	}

	/**
	 * @see Description::getFingerprint
	 * @since 2.5
	 *
	 * @return string
	 */
	public function getFingerprint() {
		// Avoid a simple 0 which may interfere with an associative array
		// when compounding hash strings from different descriptions
		return 'T:' . md5( 0 ) . ( isset( $this->isNegation ) ? '!' : '' );
	}

}