Semantic MediaWiki and related extensions
Public Member Functions | Protected Attributes | List of all members
SMW\Query\Language\Description Class Reference

Public Member Functions

 getPrintRequests ()
 
 setPrintRequests (array $printRequests)
 
 addPrintRequest (PrintRequest $printRequest)
 
 prependPrintRequest (PrintRequest $printRequest)
 
 getFingerprint ()
 
 getMembership ()
 
 setMembership ($membership)
 
 getQueryString ($asValue=false)
 
 isSingleton ()
 
 getSize ()
 
 getDepth ()
 
 getQueryFeatures ()
 
 prune (&$maxsize, &$maxDepth, &$log)
 

Protected Attributes

 $m_printreqs = array()
 
 $fingerprint = null
 

Detailed Description

Abstract base class for all descriptions

GNU GPL v2+

Since
1.6
Author
Markus Krötzsch

Member Function Documentation

SMW\Query\Language\Description::addPrintRequest ( PrintRequest  $printRequest)

Add a single SMW.

Parameters
PrintRequest$printRequest
SMW\Query\Language\Description::getDepth ( )

Compute the depth of the description. Default is 0.

Returns
integer
SMW\Query\Language\Description::getFingerprint ( )

Returns a compound signature that identifies the canonized description. It builds a fingerrint so that [[Foo::123]][[Bar::abc]] returns the same signature as for [[Bar::abc]][[Foo::123]].

Note
An extension to a description should not rely on the query string as sole representation for a fingerprint.
Since
2.5
Returns
string
Exceptions
FingerprintNotFoundException
SMW\Query\Language\Description::getMembership ( )

Identifies an arbitrary membership to a wider circle of descriptions that mostly occurs in connection with a Conjunction, Disjunction, or SomeProperty.

Since
2.5
Returns
string
SMW\Query\Language\Description::getPrintRequests ( )

Get the (possibly empty) array of all print requests that exist for the entities that fit this description.

Returns
PrintRequest[]
SMW\Query\Language\Description::getQueryFeatures ( )

Report on query features used in description. Return values are (sums of) query feature constants such as SMW_PROPERTY_QUERY.

SMW\Query\Language\Description::getQueryString (   $asValue = false)
abstract

Return a string expressing this query. Some descriptions have different syntax in property value positions. The parameter $asvalue specifies whether the serialisation should take that into account.

Example: The SMWValueDescription [[Paris]] returns the single result "Paris" but can also be used as value in [[has location::Paris]] which is preferred over the canonical [[has location::<q>[[Paris]]</q>]].

The result should be a plain query string that SMW is able to parse, without any kind of HTML escape sequences.

Parameters
boolean$asValue
Returns
string
SMW\Query\Language\Description::getSize ( )

Compute the size of the description. Default is 1.

Returns
integer
SMW\Query\Language\Description::isSingleton ( )
abstract

Return true if the description is required to encompass at most a single result, independently of the knowledge base.

Returns
boolean
SMW\Query\Language\Description::prependPrintRequest ( PrintRequest  $printRequest)

Add a new print request, but at the beginning of the list of requests (thus it will be printed first).

Parameters
PrintRequest$printRequest
SMW\Query\Language\Description::prune ( $maxsize,
$maxDepth,
$log 
)

Recursively restrict query to a maximal size and depth as given. Returns a possibly changed description that should be used as a replacement. Reduce values of parameters to account for the returned descriptions size. Default implementation for non-nested descriptions of size 1. The parameter $log contains a list of all pruned conditions, updated when some description was reduced.

Note
Objects must not do changes on $this during pruning, since $this can be reused in multiple places of one or many queries. Make new objects to reflect changes!
SMW\Query\Language\Description::setMembership (   $membership)
Since
2.5
Parameters
string$membership
SMW\Query\Language\Description::setPrintRequests ( array  $printRequests)

Set the array of print requests completely.

Parameters
PrintRequest[]$printRequests

Member Data Documentation

SMW\Query\Language\Description::$fingerprint = null
protected
SMW\Query\Language\Description::$m_printreqs = array()
protected

The documentation for this class was generated from the following file: