summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/EntityLookup.php
blob: c75318132a96c96c0a409c3c4fb93f41e22f3231 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php

namespace SMW;

use SMWDataItem as DataItem;

/**
 * @license GNU GPL v2+
 * @since 2.5
 *
 * @author mwjames
 */
interface EntityLookup {

	/**
	 * Retrieve all data stored about the given subject and return it as a
	 * SemanticData container. There are no options: it just returns all
	 * available data as shown in the page's Factbox.
	 * $filter is an array of strings that are datatype IDs. If given, the
	 * function will avoid any work that is not necessary if only
	 * properties of these types are of interest.
	 *
	 * @note There is no guarantee that the store does not retrieve more
	 * data than requested when a filter is used. Filtering just ensures
	 * that only necessary requests are made, i.e. it improves performance.
	 *
	 * @since 2.5
	 *
	 * @param DIWikiPage $subject
	 * @param RequestOptions|string[]|bool $filter
	 *
	 * @return SemanticData
	 */
	public function getSemanticData( DIWikiPage $subject, $filter = false );

	/**
	 * Get an array of all properties for which the given subject has some
	 * value. The result is an array of DIProperty objects.
	 *
	 * @since 2.5
	 *
	 * @param DIWikiPage $subject
	 * @param RequestOptions|null $requestOptions
	 *
	 * @return DataItem[]|[]
	 */
	public function getProperties( DIWikiPage $subject, RequestOptions $requestOptions = null );

	/**
	 * Get an array of all property values stored for the given subject and
	 * property. The result is an array of DataItem objects.
	 *
	 * If called with $subject == null, all values for the given property
	 * are returned.
	 *
	 * @since 2.5
	 *
	 * @param DIWikiPage|null $subject
	 * @param DIProperty $property
	 * @param RequestOptions|null $requestOptions
	 *
	 * @return DataItem[]|[]|Iterator
	 */
	public function getPropertyValues( DIWikiPage $subject = null, DIProperty $property, RequestOptions $requestOptions = null );

	/**
	 * Get an array of all subjects that have the given value for the given
	 * property. The result is an array of DIWikiPage objects. If null
	 * is given as a value, all subjects having that property are returned.
	 *
	 * @since 2.5
	 *
	 * @param DIWikiPage|null $subject
	 * @param DIProperty $property
	 * @param RequestOptions|null $requestOptions
	 *
	 * @return DIWikiPage[]|[]|Iterator
	 */
	public function getPropertySubjects( DIProperty $property, DataItem $dataItem = null, RequestOptions $requestOptions = null );

	/**
	 * Get an array of all subjects that have some value for the given
	 * property. The result is an array of DIWikiPage objects.
	 *
	 * @since 2.5
	 *
	 * @param DIProperty $property
	 * @param RequestOptions|null $requestOptions
	 *
	 * @return DIWikiPage[]|Iterator
	 */
	public function getAllPropertySubjects( DIProperty $property, RequestOptions $requestOptions = null );

	/**
	 * Get an array of all properties for which there is some subject that
	 * relates to the given value. The result is an array of DIWikiPage
	 * objects.
	 *
	 * @note In some stores, this function might be implemented partially
	 * so that only values of type Page (_wpg) are supported.
	 *
	 * @since 2.5
	 *
	 * @param DataItem $object
	 * @param RequestOptions|null $requestOptions
	 *
	 * @return DataItem[]|[]
	 */
	public function getInProperties( DataItem $object, RequestOptions $requestOptions = null );

	/**
	 * @since 3.0
	 */
	public function invalidateCache();

}