blob: 482c04d781b9ff648a3120d6279b093a24b052ad (
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
|
<?php
namespace SMW\Query\Language;
use SMW\DataValueFactory;
use SMW\DIWikiPage;
/**
* Description of a single class as described by a concept page in the wiki.
* Corresponds to classes in (the EL fragment of) OWL DL, and to some extent to
* tree-shaped queries in SPARQL.
*
* @license GNU GPL v2+
* @since 1.6
*
* @author Markus Krötzsch
*/
class ConceptDescription extends Description {
/**
* @var DIWikiPage
*/
private $concept;
/**
* @param DIWikiPage $concept
*/
public function __construct( DIWikiPage $concept ) {
$this->concept = $concept;
}
/**
* @see Description::getFingerprint
* @since 2.5
*
* @return string
*/
public function getFingerprint() {
return 'Co:' . md5( $this->concept->getHash() );
}
/**
* @return DIWikiPage
*/
public function getConcept() {
return $this->concept;
}
public function getQueryString( $asValue = false ) {
$pageValue = DataValueFactory::getInstance()->newDataValueByItem( $this->concept, null );
$result = '[[' . $pageValue->getPrefixedText() . ']]';
if ( $asValue ) {
return ' <q>' . $result . '</q> ';
}
return $result;
}
public function isSingleton() {
return false;
}
public function getQueryFeatures() {
return SMW_CONCEPT_QUERY;
}
///NOTE: getSize and getDepth /could/ query the store to find the real size
/// of the concept. But it is not clear if this is desirable anyway, given that
/// caching structures may be established for retrieving concepts more quickly.
/// Inspecting those would require future requests to the store, and be very
/// store specific.
}
|