Semantic MediaWiki and related extensions
Public Member Functions | Protected Attributes | List of all members
SMW\Query\Language\Description Class Reference
Inheritance diagram for SMW\Query\Language\Description:
Inheritance graph
[legend]

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)
 
 __toString ()
 

Protected Attributes

 $m_printreqs = []
 
 $fingerprint = null
 

Detailed Description

Abstract base class for all descriptions

GNU GPL v2+

Since
1.6
Author
Markus Krötzsch

Member Function Documentation

◆ __toString()

SMW\Query\Language\Description::__toString ( )
Since
3.0
Returns
string

◆ addPrintRequest()

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

Add a single SMW.

Parameters
PrintRequest$printRequest

◆ getDepth()

SMW\Query\Language\Description::getDepth ( )

Compute the depth of the description. Default is 0.

Returns
integer

◆ getFingerprint()

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

◆ getMembership()

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

◆ getPrintRequests()

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[]

◆ getQueryFeatures()

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.

◆ getQueryString()

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

◆ getSize()

SMW\Query\Language\Description::getSize ( )

Compute the size of the description. Default is 1.

Returns
integer

◆ isSingleton()

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

◆ prependPrintRequest()

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

◆ prune()

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!

◆ setMembership()

SMW\Query\Language\Description::setMembership (   $membership)
Since
2.5
Parameters
string$membership

◆ setPrintRequests()

SMW\Query\Language\Description::setPrintRequests ( array  $printRequests)

Set the array of print requests completely.

Parameters
PrintRequest[]$printRequests

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

About | General disclaimer | Privacy policy