Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SMW\Store Class Reference
Collaboration diagram for SMW\Store:
Collaboration graph
[legend]

Public Member Functions

 getSemanticData (DIWikiPage $subject, $filter=false)
 
 getPropertyValues ($subject, DIProperty $property, $requestoptions=null)
 
 getPropertySubjects (DIProperty $property, $value, $requestoptions=null)
 
 getAllPropertySubjects (DIProperty $property, $requestoptions=null)
 
 getProperties (DIWikiPage $subject, $requestOptions=null)
 
 getInProperties (SMWDataItem $object, $requestoptions=null)
 
 getWikiPageSortKey (DIWikiPage $wikiPage)
 
 getRedirectTarget (SMWDataItem $dataItem)
 
 deleteSubject (Title $subject)
 
 updateData (SemanticData $semanticData)
 
 clearData (DIWikiPage $di)
 
 changeTitle (Title $oldtitle, Title $newtitle, $pageid, $redirid=0)
 
 getQueryResult (SMWQuery $query)
 
 getPropertiesSpecial ($requestoptions=null)
 
 getUnusedPropertiesSpecial ($requestoptions=null)
 
 getWantedPropertiesSpecial ($requestoptions=null)
 
 getStatistics ()
 
 setup ($verbose=true)
 
 drop ($verbose=true)
 
 refreshData (&$index, $count, $namespaces=false, $usejobs=true)
 
 getParserTestTables ()
 
 getOptions ()
 
 clear ()
 
 setUpdateJobsEnabledState ($status)
 
 getUpdateJobsEnabledState ()
 
 setConnectionManager (ConnectionManager $connectionManager)
 
 getConnection ($connectionTypeId)
 
- Public Member Functions inherited from SMW\QueryEngine
 getQueryResult (Query $query)
 

Static Public Member Functions

static setupStore ($verbose=true, $isFromExtensionSchemaUpdate=false)
 

Protected Member Functions

 doDataUpdate (SemanticData $data)
 
 fetchQueryResult (SMWQuery $query)
 

Protected Attributes

 $connectionManager = null
 
 $options = null
 

Detailed Description

The abstract base class for all classes that implement access to some semantic store. Besides the relevant interface, this class provides default implementations for some optional methods, which inform the caller that these methods are not implemented.

Author
Markus Krötzsch

Member Function Documentation

SMW\Store::changeTitle ( Title  $oldtitle,
Title  $newtitle,
  $pageid,
  $redirid = 0 
)
abstract

Update the store to reflect a renaming of some article. Normally this happens when moving pages in the wiki, and in this case there is also a new redirect page generated at the old position. The title objects given are only used to specify the name of the title before and after the move – do not use their IDs for anything! The ID of the moved page is given in $pageid, and the ID of the newly created redirect, if any, is given by $redirid. If no new page was created, $redirid will be 0.

SMW\Store::clear ( )
Since
2.0
SMW\Store::clearData ( DIWikiPage  $di)

Clear all semantic data specified for some page.

Parameters
DIWikiPage$di
SMW\Store::deleteSubject ( Title  $subject)
abstract

Delete all semantic properties that the given subject has. This includes relations, attributes, and special properties. This does not delete the respective text from the wiki, but only clears the stored data.

Parameters
Title$subject
SMW\Store::doDataUpdate ( SemanticData  $data)
abstractprotected

Update the semantic data stored for some individual. The data is given as a SemanticData object, which contains all semantic data for one particular subject.

Parameters
SemanticData$data
SMW\Store::drop (   $verbose = true)
abstract

Drop (delete) all storage structures created by setup(). This will delete all semantic data and possibly leave the wiki uninitialised.

Parameters
boolean$verbose
SMW\Store::fetchQueryResult ( SMWQuery  $query)
protected
Note
Change the signature to abstract for the 3.* branch
Since
2.1
Parameters
SMWQuery$query
Returns
SMWQueryResult
SMW\Store::getAllPropertySubjects ( DIProperty  $property,
  $requestoptions = null 
)
abstract

Get an array of all subjects that have some value for the given property. The result is an array of DIWikiPage objects.

Returns
DIWikiPage[]
SMW\Store::getConnection (   $connectionTypeId)
Since
2.1
Parameters
string$connectionTypeId
Returns
mixed
SMW\Store::getInProperties ( SMWDataItem  $object,
  $requestoptions = null 
)
abstract
See also
EntityLookup::getInProperties
Parameters
DataItem$object
RequestOptions | null$requestOptions
Returns
DataItem[]|[]
SMW\Store::getOptions ( )
Since
2.5
Returns
Options
SMW\Store::getParserTestTables ( )

Returns the tables that should be added via the https://www.mediawiki.org/wiki/Manual:Hooks/ParserTestTables hook when it's run.

Since
1.8
Returns
array
SMW\Store::getProperties ( DIWikiPage  $subject,
  $requestOptions = null 
)
abstract
See also
EntityLookup::getProperties
Parameters
DIWikiPage$subjectdenoting the subject
SMWRequestOptions | null$requestOptionsoptionally defining further options
Returns
SMWDataItem
SMW\Store::getPropertiesSpecial (   $requestoptions = null)
abstract

Return all properties that have been used on pages in the wiki. The result is an array of arrays, each containing a property data item and a count. The expected order is alphabetical w.r.t. to property names.

If there is an error on creating some property object, then a suitable SMWDIError object might be returned in its place. Even if there are errors, the function should always return the number of results requested (otherwise callers might assume that there are no further results to ask for).

Parameters
SMWRequestOptions$requestoptions
Returns
array of array( DIProperty|SMWDIError, integer )
SMW\Store::getPropertySubjects ( DIProperty  $property,
  $value,
  $requestoptions = null 
)
abstract
SMW\Store::getPropertyValues (   $subject,
DIProperty  $property,
  $requestoptions = null 
)
abstract
See also
EntityLookup::getPropertyValues
Parameters
$subjectmixed SMWDIWikiPage or null
$propertyDIProperty
$requestoptionsSMWRequestOptions
Returns
array of SMWDataItem
SMW\Store::getQueryResult ( SMWQuery  $query)
abstract
Note
Change the signature in 3.* to avoid for subclasses to manage the hooks; keep the current signature to adhere semver for the 2.* branch

Execute the provided query and return the result as an SMWQueryResult if the query was a usual instance retrieval query. In the case that the query asked for a plain string (querymode MODE_COUNT or MODE_DEBUG) a plain wiki and HTML-compatible string is returned.

Parameters
SMWQuery$query
Returns
SMWQueryResult
SMW\Store::getRedirectTarget ( SMWDataItem  $dataItem)

Convenience method to find the redirect target of a DIWikiPage or DIProperty object. Returns a dataitem of the same type that the input redirects to, or the input itself if there is no redirect.

Parameters
$dataItemSMWDataItem to find the redirect for.
Returns
SMWDataItem
SMW\Store::getSemanticData ( DIWikiPage  $subject,
  $filter = false 
)
abstract
See also
EntityLookup::getSemanticData
Parameters
DIWikiPage$subject
string[]|bool$filter
SMW\Store::getStatistics ( )
abstract

Return statistical information as an associative array with the following keys:

  • 'PROPUSES': Number of property instances (value assignments) in the datatbase
  • 'USEDPROPS': Number of properties that are used with at least one value
  • 'DECLPROPS': Number of properties that have been declared (i.e. assigned a type)
  • 'OWNPAGE': Number of properties with their own page
  • 'QUERY': Number of inline queries
  • 'QUERYSIZE': Represents collective query size
  • 'CONCEPTS': Number of declared concepts
  • 'SUBOBJECTS': Number of declared subobjects
Returns
array
SMW\Store::getUnusedPropertiesSpecial (   $requestoptions = null)
abstract

Return all properties that have been declared in the wiki but that are not used on any page. Stores might restrict here to those properties that have been given a type if they have no efficient means of accessing the set of all pages in the property namespace.

If there is an error on creating some property object, then a suitable SMWDIError object might be returned in its place. Even if there are errors, the function should always return the number of results requested (otherwise callers might assume that there are no further results to ask for).

Parameters
SMWRequestOptions$requestoptions
Returns
array of DIProperty|SMWDIError
SMW\Store::getUpdateJobsEnabledState ( )
Since
2.1
Returns
boolean
SMW\Store::getWantedPropertiesSpecial (   $requestoptions = null)
abstract

Return all properties that are used on some page but that do not have any page describing them. Stores that have no efficient way of accessing the set of all existing pages can extend this list to all properties that are used but do not have a type assigned to them.

Parameters
SMWRequestOptions$requestoptions
Returns
array of array( DIProperty, int )
SMW\Store::getWikiPageSortKey ( DIWikiPage  $wikiPage)

Convenience method to find the sortkey of an SMWDIWikiPage. The result is based on the contents of this store, and may differ from the MediaWiki database entry about a Title objects sortkey. If no sortkey is stored, the default sortkey (title string) is returned.

Parameters
$wikiPageDIWikiPage to find the sortkey for
Returns
string sortkey
SMW\Store::refreshData ( $index,
  $count,
  $namespaces = false,
  $usejobs = true 
)
abstract

Refresh some objects in the store, addressed by numerical ids. The meaning of the ids is private to the store, and does not need to reflect the use of IDs elsewhere (e.g. page ids). The store is to refresh $count objects starting from the given $index. Typically, updates are achieved by generating update jobs. After the operation, $index is set to the next index that should be used for continuing refreshing, or to -1 for signaling that no objects of higher index require refresh. The method returns a decimal number between 0 and 1 to indicate the overall progress of the refreshing (e.g. 0.7 if 70% of all objects were refreshed).

The optional parameter $namespaces may contain an array of namespace constants. If given, only objects from those namespaces will be refreshed. The default value FALSE disables this feature.

The optional parameter $usejobs indicates whether updates should be processed later using MediaWiki jobs, instead of doing all updates immediately. The default is TRUE.

Parameters
$indexinteger
$countinteger
$namespacesmixed array or false
$usejobsboolean
Returns
float between 0 and 1 to indicate the overall progress of the refreshing
SMW\Store::setConnectionManager ( ConnectionManager  $connectionManager)
Since
2.1
Parameters
ConnectionManager$connectionManager
Returns
Store
SMW\Store::setup (   $verbose = true)
abstract

Setup all storage structures properly for using the store. This function performs tasks like creation of database tables. It is called upon installation as well as on upgrade: hence it must be able to upgrade existing storage structures if needed. It should return "true" if successful and return a meaningful string error message otherwise.

The parameter $verbose determines whether the procedure is allowed to report on its progress. This is doen by just using print and possibly ob_flush/flush. This is also relevant for preventing timeouts during long operations. All output must be valid in an HTML context, but should preferrably be plain text, possibly with some linebreaks and weak markup.

Parameters
boolean$verbose
Returns
boolean Success indicator
SMW\Store::setUpdateJobsEnabledState (   $status)
Since
2.1
Parameters
boolean$status
static SMW\Store::setupStore (   $verbose = true,
  $isFromExtensionSchemaUpdate = false 
)
static

Setup the store.

Since
1.8
Parameters
bool$verbose
bool$isFromExtensionSchemaUpdate
Returns
boolean Success indicator
SMW\Store::updateData ( SemanticData  $semanticData)

Update the semantic data stored for some individual. The data is given as a SemanticData object, which contains all semantic data for one particular subject.

Parameters
SemanticData$semanticData
Since
1.6
1.6

Member Data Documentation

SMW\Store::$connectionManager = null
protected
SMW\Store::$options = null
protected

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