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

Public Member Functions

 resetCacheBy (SMWDIWikiPage $diWikiPage)
 
 findDataItemForExpElement (ExpElement $expElement)
 
 decodeURI ($uri)
 

Static Public Member Functions

static getInstance ()
 
static clear ()
 
static initBaseURIs ()
 
static makeExportData (SMWSemanticData $semdata)
 
static makeExportDataForSubject (SMWDIWikiPage $diWikiPage, $addStubData=false)
 
static addPropertyValues (SMWDIProperty $property, array $dataItems, SMWExpData &$expData)
 
static getResourceElementForProperty (SMWDIProperty $diProperty, $helperProperty=false, $seekImportVocabulary=true)
 
static getResourceElementForWikiPage (SMWDIWikiPage $diWikiPage, $markForAuxiliaryUsage=false)
 
static getOWLPropertyType ($type= '')
 
static getSpecialPropertyResource ($propertyKey, $forNamespace=NS_MAIN)
 
static getSpecialNsResource ($namespaceId, $localName)
 
static expandURI ($uri)
 
static getNamespaceUri ($shortName)
 
static getOntologyExpData ($ontologyuri)
 
static getDataItemExpElement (SMWDataItem $dataItem)
 
static getDataItemHelperExpElement (SMWDataItem $dataItem)
 
static hasHelperExpElement (DIProperty $property)
 

Public Attributes

const POOLCACHE_ID = 'exporter.shared'
 

Static Protected Member Functions

static hasSpecialPropertyResource (DIProperty $property)
 

Static Protected Attributes

static $m_exporturl = false
 
static $m_ent_wiki = false
 
static $m_ent_property = false
 
static $m_ent_category = false
 
static $m_ent_wikiurl = false
 

Detailed Description

SMWExporter is a class for converting internal page-based data (SMWSemanticData) into a format for easy serialisation in OWL or RDF.

Author
Markus Krötzsch

Member Function Documentation

static SMWExporter::addPropertyValues ( SMWDIProperty  $property,
array  $dataItems,
SMWExpData $expData 
)
static

Extend a given SMWExpData element by adding export data for the specified property data itme. This method is called when constructing export data structures from SMWSemanticData objects.

Parameters
$propertySMWDIProperty
$dataItemsarray of SMWDataItem objects for the given property
$dataSMWExpData to add the data to

TODO: currently no full check for avoiding OWL DL illegal redirects is done (OWL property type ignored)

static SMWExporter::clear ( )
static
Since
2.0
SMWExporter::decodeURI (   $uri)
Returns
string
static SMWExporter::expandURI (   $uri)
static

This function expands standard XML entities used in some generated URIs. Given a string with such entities, it returns a string with all entities properly replaced.

Note
The function SMWExporter::getInstance()->getNamespaceUri() is often more suitable. This XML-specific method might become obsolete.
Parameters
$uristring of the URI to be expanded
Returns
string of the expanded URI
SMWExporter::findDataItemForExpElement ( ExpElement  $expElement)

Try to find an SMWDataItem that the given ExpElement might represent. Returns null if this attempt failed.

Parameters
ExpElement$expElement
Returns
SMWDataItem or null
static SMWExporter::getDataItemExpElement ( SMWDataItem  $dataItem)
static
See also
ElementFactory::mapDataItemToElement
static SMWExporter::getDataItemHelperExpElement ( SMWDataItem  $dataItem)
static

Create an SWMExpElement that encodes auxiliary data for representing values of the specified dataitem object in a simplified fashion. This is done for types of dataitems that are not supported very well in current systems, or that do not match a standard datatype in RDF. For example, time points (DITime) are encoded as numbers. The number can replace the actual time for all query and ordering purposes (the order in either case is linear and maps to the real number line). Only data retrieval should better use the real values to avoid that rounding errors lead to unfaithful recovery of data. Note that the helper values do not maintain any association with their original values – they are a fully redundant alternative representation, not an additional piece of information for the main values. Even if decoding is difficult, they must be in one-to-one correspondence to the original value.

For dataitems that do not have such a simplification, the method returns null.

Note
If a helper element is used, then it must be the same as getDataItemHelperExpElement( $dataItem->getSortKeyDataItem() ). Query conditions like ">" use sortkeys for values, and helper elements are always preferred in query answering.
Parameters
$dataItemSMWDataItem
Returns
ExpElement|null
static SMWExporter::getInstance ( )
static
Since
2.0
Returns
SMWExporter
static SMWExporter::getNamespaceUri (   $shortName)
static

Get the URI of a standard namespace prefix used in SMW, or the empty string if the prefix is not known.

Parameters
$shortNamestring id (prefix) of the namespace
Returns
string of the expanded URI
static SMWExporter::getOntologyExpData (   $ontologyuri)
static

Create an SMWExpData container that encodes the ontology header for an SMW exported OWL file.

Parameters
string$ontologyurispecifying the URI of the ontology, possibly empty
Returns
SMWExpData
static SMWExporter::getOWLPropertyType (   $type = '')
static

Determine what kind of OWL property some SMW property should be exported as. The input is an SMWTypesValue object, a typeid string, or empty (use default)

Todo:
An improved mechanism for selecting property types here is needed.
static SMWExporter::getResourceElementForProperty ( SMWDIProperty  $diProperty,
  $helperProperty = false,
  $seekImportVocabulary = true 
)
static
See also
DataItemToExpResourceEncoder::mapPropertyToResourceElement
static SMWExporter::getResourceElementForWikiPage ( SMWDIWikiPage  $diWikiPage,
  $markForAuxiliaryUsage = false 
)
static
See also
DataItemToExpResourceEncoder::mapWikiPageToResourceElement
static SMWExporter::getSpecialNsResource (   $namespaceId,
  $localName 
)
static

Create an ExpNsResource for some special element that belongs to a known vocabulary. An exception is generated when given parameters that do not fit any known vocabulary.

Parameters
$namespaceIdstring (e.g. "rdf")
$localNamestring (e.g. "type")
Returns
ExpNsResource
static SMWExporter::getSpecialPropertyResource (   $propertyKey,
  $forNamespace = NS_MAIN 
)
static

Get an ExpNsResource for a special property of SMW, or null if no resource is assigned to the given property key. The optional namespace is used to select the proper resource for properties that must take the type of the annotated object into account for some reason.

Parameters
$propertyKeystring the Id of the special property
$forNamespaceinteger the namespace of the page which has a value for this property
Returns
ExpNsResource|null
static SMWExporter::hasHelperExpElement ( DIProperty  $property)
static

Check whether the values of a given type of dataitem have helper values in the sense of SMWExporter::getInstance()->getDataItemHelperExpElement().

Parameters
DIProperty$property
Returns
boolean
static SMWExporter::hasSpecialPropertyResource ( DIProperty  $property)
staticprotected
static SMWExporter::initBaseURIs ( )
static

Make sure that necessary base URIs are initialised properly.

static SMWExporter::makeExportData ( SMWSemanticData  $semdata)
static

Create exportable data from a given semantic data record.

Parameters
$semdataSMWSemanticData
Returns
SMWExpData
static SMWExporter::makeExportDataForSubject ( SMWDIWikiPage  $diWikiPage,
  $addStubData = false 
)
static

Make an SMWExpData object for the given page, and include the basic properties about this subject that are not directly represented by SMW property values. The optional parameter $typevalueforproperty can be used to pass a particular SMWTypesValue object that is used for determining the OWL type for property pages.

Todo:
Take into account whether the wiki page belongs to a builtin property, and ensure URI alignment/type declaration in this case.
Parameters
$diWikiPageSMWDIWikiPage
$addStubDataboolean to indicate if additional data should be added to make a stub entry for this page
Returns
SMWExpData
SMWExporter::resetCacheBy ( SMWDIWikiPage  $diWikiPage)
Since
2.2

Member Data Documentation

SMWExporter::$m_ent_category = false
staticprotected
SMWExporter::$m_ent_property = false
staticprotected
SMWExporter::$m_ent_wiki = false
staticprotected
SMWExporter::$m_ent_wikiurl = false
staticprotected
SMWExporter::$m_exporturl = false
staticprotected
const SMWExporter::POOLCACHE_ID = 'exporter.shared'

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