Semantic MediaWiki and related extensions
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SMWExportController Class Reference

Public Member Functions

 __construct (Serializer $serializer, Queue $queue, ExpDataFactory $expDataFactory)
 
 enableBacklinks ( $enable)
 
 printPages ( $pages, $recursion=1, $revisiondate=false)
 
 printAllToFile ( $outfile, $ns_restriction, $delay, $delayeach)
 
 printAllToOutput ( $ns_restriction, $delay, $delayeach)
 
 printPageList ( $offset=0, $limit=30)
 
 printWikiInfo ()
 

Static Public Member Functions

static fitsNsRestriction ( $res, $ns)
 

Protected Member Functions

 prepareSerialization ( $outfilename='')
 
 serializePage (SMWDIWikiPage $diWikiPage, $recursiondepth=1)
 
 getSemanticData (SMWDIWikiPage $diWikiPage, $core_props_only)
 
 flush ( $force=false)
 
 printAll ( $ns_restriction, $delay, $delayeach)
 

Protected Attributes

 $serializer
 
 $add_backlinks = false
 
 $delay_flush
 
 $outputfile
 

Detailed Description

File holding the SMWExportController class that provides basic functions for exporting pages to RDF and OWL.

Author
Markus Krötzsch Class for controlling the export of SMW page data, supporting high-level features such as recursive export and backlink inclusion. The class controls export independent of the serialisation syntax that is used.

Constructor & Destructor Documentation

◆ __construct()

SMWExportController::__construct ( Serializer  $serializer,
Queue  $queue,
ExpDataFactory  $expDataFactory 
)
Since
1.5.5
Parameters
Serializer$serializerinstance used for syntactic serialization
Queue$queue
ExpDataFactory$expDataFactory

Member Function Documentation

◆ enableBacklinks()

SMWExportController::enableBacklinks (   $enable)

Enable or disable inclusion of backlinks into the output.

Parameters
boolean$enable

◆ fitsNsRestriction()

static SMWExportController::fitsNsRestriction (   $res,
  $ns 
)
static

This function checks whether some article fits into a given namespace restriction. Restrictions are encoded as follows: a non-negative number requires the namespace to be identical to the given number; "-1" requires the namespace to be different from Category, Property, and Type; "false" means "no restriction".

Parameters
$resmixed encoding the restriction as described above
$nsinteger the namespace constant to be checked
Returns
boolean

◆ flush()

SMWExportController::flush (   $force = false)
protected

Send to the output what has been serialized so far. The flush might be deferred until later unless $force is true.

◆ getSemanticData()

SMWExportController::getSemanticData ( SMWDIWikiPage  $diWikiPage,
  $core_props_only 
)
protected

Retrieve a copy of the semantic data for a wiki page, possibly filtering it so that only essential properties are included (in some cases, we only want to export stub information about a page). We make a copy of the object since we may want to add more data later on and we do not want to modify the store's result which may be used for caching purposes elsewhere.

◆ prepareSerialization()

SMWExportController::prepareSerialization (   $outfilename = '')
protected

Initialize all internal structures to begin with some serialization. Returns true if initialization was successful (this means that the optional output file is writable).

Parameters
string$outfilenameURL of the file that output should be written to, or empty string for writing to the standard output.
Returns
boolean

◆ printAll()

SMWExportController::printAll (   $ns_restriction,
  $delay,
  $delayeach 
)
protected
Since
2.0 made protected; use printAllToFile or printAllToOutput

◆ printAllToFile()

SMWExportController::printAllToFile (   $outfile,
  $ns_restriction,
  $delay,
  $delayeach 
)

Exports semantic data for all pages within the wiki and for all elements that are referred to a file resource

Since
2.0
Parameters
string$outfilethe output file URI, or false if printing to stdout
mixed$ns_restrictionnamespace restriction, see fitsNsRestriction()
integer$delaynumber of microseconds for which to sleep during export to reduce server load in long-running operations
integer$delayeachnumber of pages to process between two sleeps

◆ printAllToOutput()

SMWExportController::printAllToOutput (   $ns_restriction,
  $delay,
  $delayeach 
)

Exports semantic data for all pages within the wiki and for all elements that are referred to the stdout

Since
2.0
Parameters
mixed$ns_restrictionnamespace restriction, see fitsNsRestriction()
integer$delaynumber of microseconds for which to sleep during export to reduce server load in long-running operations
integer$delayeachnumber of pages to process between two sleeps

◆ printPageList()

SMWExportController::printPageList (   $offset = 0,
  $limit = 30 
)

Print basic definitions a list of pages ordered by their page id. Offset and limit refer to the count of existing pages, not to the page id.

Parameters
integer$offsetthe number of the first (existing) page to serialize a declaration for
integer$limitthe number of pages to serialize

◆ printPages()

SMWExportController::printPages (   $pages,
  $recursion = 1,
  $revisiondate = false 
)

This function prints all selected pages, specified as an array of page names (strings with namespace identifiers).

Parameters
array$pageslist of page names to export
integer$recursiondetermines how pages are exported recursively: "0" means that referenced resources are only declared briefly, "1" means that all referenced resources are also exported recursively (propbably retrieving the whole wiki).
string$revisiondatefilter page list by including only pages that have been changed since this date; format "YmdHis"
Todo:
Consider dropping the $revisiondate filtering and all associated functionality. Is anybody using this?

◆ printWikiInfo()

SMWExportController::printWikiInfo ( )

Print basic information about this site.

◆ serializePage()

SMWExportController::serializePage ( SMWDIWikiPage  $diWikiPage,
  $recursiondepth = 1 
)
protected

Serialize data associated to a specific page. This method works on the level of pages, i.e. it serialises parts of SMW content and implements features like recursive export or backlinks that are available for this type of data.

The recursion depth means the following. Depth of 1 or above means the object is serialised with all property values, and referenced objects are serialised with depth reduced by 1. Depth 0 means that only minimal declarations are serialised, so no dependencies are added. A depth of -1 encodes "infinite" depth, i.e. a complete recursive serialisation without limit.

Parameters
SMWDIWikiPage$diWikiPagespecifying the page to be exported
integer$recursiondepthspecifying the depth of recursion

Member Data Documentation

◆ $add_backlinks

SMWExportController::$add_backlinks = false
protected

Boolean to indicate whether all objects that are exported in full (with all data) should also lead to the inclusion of all "inlinks" that they receive from other objects. If yes, these other objects are also serialised with at least the relevant inlinking properties included. Adding such dependencies counts as "recursive serialisation" and whether or not inlinking objects are included in full depends on the setting for recursion depth. Setting this to true enables "browsable RDF".

◆ $delay_flush

SMWExportController::$delay_flush
protected

Controls how long to wait until flushing content to output. Flushing early may reduce the memory footprint of serialization functions. Flushing later has some advantages for export formats like RDF/XML where global namespace declarations are only possible by modifying the header, so that only local declarations are possible after the first flush.

◆ $outputfile

SMWExportController::$outputfile
protected

File handle for a potential output file to write to, or null if printing to standard output.


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

About | General disclaimer | Privacy policy