Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\DataModel\Statement\Statement Class Reference

Class representing a Wikibase statement. More...

+ Inheritance diagram for Wikibase\DataModel\Statement\Statement:
+ Collaboration diagram for Wikibase\DataModel\Statement\Statement:

Public Member Functions

 __construct (Snak $mainSnak, SnakList $qualifiers=null, ReferenceList $references=null, string $guid=null)
 
 getGuid ()
 
 setGuid (?string $guid)
 Sets the GUID of this statement.
 
 getMainSnak ()
 Returns the main value snak of this statement.
 
 setMainSnak (Snak $mainSnak)
 Sets the main value snak of this statement.
 
 getQualifiers ()
 Returns the property value snaks making up the qualifiers for this statement.
 
 setQualifiers (SnakList $propertySnaks)
 Sets the property value snaks making up the qualifiers for this statement.
 
 getReferences ()
 Returns the references attached to this statement.
 
 setReferences (ReferenceList $references)
 Sets the references attached to this statement.
 
 addNewReference (Snak ... $snaks)
 
 setRank (int $rank)
 Sets the rank of the statement.
 
 getRank ()
 
 getHash ()
 
 getPropertyId ()
 Returns the id of the property of the main snak.
 
 getAllSnaks ()
 Returns a list of all Snaks on this statement.
 
 equals ( $target)
 
 __clone ()
 

Public Attributes

const RANK_PREFERRED = 2
 Rank enum.
 
const RANK_NORMAL = 1
 
const RANK_DEPRECATED = 0
 

Private Attributes

 $guid = null
 
 $mainSnak
 
 $qualifiers
 
 $references
 
 $rank = self::RANK_NORMAL
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Wikibase\DataModel\Statement\Statement::__construct ( Snak $mainSnak,
SnakList $qualifiers = null,
ReferenceList $references = null,
string $guid = null )
Since
2.0
Parameters
Snak$mainSnak
SnakList | null$qualifiers
ReferenceList | null$references
string | null$guid

Member Function Documentation

◆ __clone()

Wikibase\DataModel\Statement\Statement::__clone ( )

◆ addNewReference()

Wikibase\DataModel\Statement\Statement::addNewReference ( Snak ... $snaks)
Since
2.0
Parameters
Snak...$snaks

◆ equals()

Wikibase\DataModel\Statement\Statement::equals ( $target)
Since
0.7.4
Parameters
mixed$target
Returns
bool

◆ getAllSnaks()

Wikibase\DataModel\Statement\Statement::getAllSnaks ( )

Returns a list of all Snaks on this statement.

This includes the main snak and all snaks from qualifiers and references.

This is a convenience method for use in code that needs to operate on all snaks, e.g. to find all referenced Entities.

Returns
Snak[]

◆ getGuid()

Wikibase\DataModel\Statement\Statement::getGuid ( )
Since
0.2
Returns
string|null

◆ getHash()

Wikibase\DataModel\Statement\Statement::getHash ( )
Since
0.1
Returns
string

◆ getMainSnak()

Wikibase\DataModel\Statement\Statement::getMainSnak ( )

Returns the main value snak of this statement.

Since
0.1
Returns
Snak

◆ getPropertyId()

Wikibase\DataModel\Statement\Statement::getPropertyId ( )

Returns the id of the property of the main snak.

Short for ->getMainSnak()->getPropertyId()

See also
PropertyIdProvider::getPropertyId
Since
0.2
Returns
PropertyId

Implements Wikibase\DataModel\PropertyIdProvider.

◆ getQualifiers()

Wikibase\DataModel\Statement\Statement::getQualifiers ( )

Returns the property value snaks making up the qualifiers for this statement.

Since
0.1
Returns
SnakList

◆ getRank()

Wikibase\DataModel\Statement\Statement::getRank ( )
Since
0.1
Returns
int

◆ getReferences()

Wikibase\DataModel\Statement\Statement::getReferences ( )

Returns the references attached to this statement.

Since
0.1
Returns
ReferenceList

◆ setGuid()

Wikibase\DataModel\Statement\Statement::setGuid ( ?string $guid)

Sets the GUID of this statement.

Since
0.2
Parameters
string | null$guid

◆ setMainSnak()

Wikibase\DataModel\Statement\Statement::setMainSnak ( Snak $mainSnak)

Sets the main value snak of this statement.

Since
0.1
Parameters
Snak$mainSnak

◆ setQualifiers()

Wikibase\DataModel\Statement\Statement::setQualifiers ( SnakList $propertySnaks)

Sets the property value snaks making up the qualifiers for this statement.

Since
0.1
Parameters
SnakList$propertySnaks

◆ setRank()

Wikibase\DataModel\Statement\Statement::setRank ( int $rank)

Sets the rank of the statement.

The rank is an element of the Statement::RANK_ enum.

Since
0.1
Parameters
int$rank
Exceptions
InvalidArgumentException

◆ setReferences()

Wikibase\DataModel\Statement\Statement::setReferences ( ReferenceList $references)

Sets the references attached to this statement.

Since
0.1
Parameters
ReferenceList$references

Member Data Documentation

◆ $guid

Wikibase\DataModel\Statement\Statement::$guid = null
private

◆ $mainSnak

Wikibase\DataModel\Statement\Statement::$mainSnak
private

◆ $qualifiers

Wikibase\DataModel\Statement\Statement::$qualifiers
private

◆ $rank

Wikibase\DataModel\Statement\Statement::$rank = self::RANK_NORMAL
private

◆ $references

Wikibase\DataModel\Statement\Statement::$references
private

◆ RANK_DEPRECATED

const Wikibase\DataModel\Statement\Statement::RANK_DEPRECATED = 0

◆ RANK_NORMAL

const Wikibase\DataModel\Statement\Statement::RANK_NORMAL = 1

◆ RANK_PREFERRED

const Wikibase\DataModel\Statement\Statement::RANK_PREFERRED = 2

Rank enum.

Higher values are more preferred.

Since
2.0

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