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 (DIWikiPage $diWikiPage)
 
 makeExportData (SemanticData $semanticData)
 
 makeExportDataForSubject (DIWikiPage $subject, $addStubData=false)
 
 findDataItemForExpElement (ExpElement $expElement)
 
 getOWLPropertyType (DIProperty $property)
 
 newExpNsResourceById ( $namespaceId, $localName)
 
 expandURI ( $uri)
 
 decodeURI ( $uri)
 
 newExpElement (SMWDataItem $dataItem)
 
 newAuxiliaryExpElement (SMWDataItem $dataItem)
 

Static Public Member Functions

static getInstance ()
 
static clear ()
 
static initBaseURIs ()
 
static addPropertyValues (SMWDIProperty $property, array $dataItems, SMWExpData &$expData)
 
static getResourceElementForProperty (SMWDIProperty $diProperty, $helperProperty=false, $seekImportVocabulary=true)
 
static getResourceElementForWikiPage (DIWikiPage $diWikiPage, $markForAuxiliaryUsage=false)
 
static getSpecialPropertyResource ( $propertyKey, $forNamespace=NS_MAIN)
 
static getSpecialNsResource ( $namespaceId, $localName)
 
static getNamespaceUri ( $shortName)
 
static hasHelperExpElement (DIProperty $property)
 

Public Attributes

const OWL_OBJECT_PROPERTY = 'ObjectProperty'
 
const OWL_DATATYPE_PROPERTY = 'DatatypeProperty'
 
const OWL_ANNOTATION_PROPERTY = 'AnnotationProperty'
 
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 (SemanticData) into a format for easy serialisation in OWL or RDF.

Author
Markus Krötzsch

Member Function Documentation

◆ addPropertyValues()

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 SemanticData 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)

◆ clear()

static SMWExporter::clear ( )
static
Since
2.0

◆ decodeURI()

SMWExporter::decodeURI (   $uri)
Returns
string

◆ expandURI()

SMWExporter::expandURI (   $uri)

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

◆ findDataItemForExpElement()

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

◆ getInstance()

static SMWExporter::getInstance ( )
static
Since
2.0
Returns
SMWExporter

◆ getNamespaceUri()

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

◆ getOWLPropertyType()

SMWExporter::getOWLPropertyType ( DIProperty  $property)

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.

◆ getResourceElementForProperty()

static SMWExporter::getResourceElementForProperty ( SMWDIProperty  $diProperty,
  $helperProperty = false,
  $seekImportVocabulary = true 
)
static
See also
ExpResourceMapper::mapPropertyToResourceElement

◆ getResourceElementForWikiPage()

static SMWExporter::getResourceElementForWikiPage ( DIWikiPage  $diWikiPage,
  $markForAuxiliaryUsage = false 
)
static
See also
ExpResourceMapper::mapWikiPageToResourceElement

◆ getSpecialNsResource()

static SMWExporter::getSpecialNsResource (   $namespaceId,
  $localName 
)
static
Deprecated:
since 3.2, use 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

◆ getSpecialPropertyResource()

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

◆ hasHelperExpElement()

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()->newAuxiliaryExpElement().

Parameters
DIProperty$property
Returns
boolean

◆ initBaseURIs()

static SMWExporter::initBaseURIs ( )
static

Make sure that necessary base URIs are initialised properly.

◆ makeExportData()

SMWExporter::makeExportData ( SemanticData  $semanticData)

Create exportable data from a given semantic data record.

Parameters
SemanticData$semanticData
Returns
SMWExpData

◆ makeExportDataForSubject()

SMWExporter::makeExportDataForSubject ( DIWikiPage  $subject,
  $addStubData = false 
)

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
DIWikiPage$subject
$addStubDataboolean to indicate if additional data should be added to make a stub entry for this page
Returns
SMWExpData

◆ newAuxiliaryExpElement()

SMWExporter::newAuxiliaryExpElement ( SMWDataItem  $dataItem)

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 newAuxiliaryExpElement( $dataItem->getSortKeyDataItem() ). Query conditions like ">" use sortkeys for values, and helper elements are always preferred in query answering.
Parameters
$dataItemSMWDataItem
Returns
ExpElement|null

◆ newExpElement()

SMWExporter::newExpElement ( SMWDataItem  $dataItem)
Since
3.1
Parameters
SMWDataItem$dataItem,;
Returns
ExpElement

◆ newExpNsResourceById()

SMWExporter::newExpNsResourceById (   $namespaceId,
  $localName 
)

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

◆ resetCacheBy()

SMWExporter::resetCacheBy ( DIWikiPage  $diWikiPage)
Since
2.2

Member Data Documentation

◆ OWL_ANNOTATION_PROPERTY

const SMWExporter::OWL_ANNOTATION_PROPERTY = 'AnnotationProperty'

These are needed in OWL DL for semantic reasons as a mechanism to attach meta-data to owl entities (classes, properties and individuals). This data is ignored by reasoners.

◆ OWL_DATATYPE_PROPERTY

const SMWExporter::OWL_DATATYPE_PROPERTY = 'DatatypeProperty'

Datatype properties link individuals to data values and is defined as an instance of the built-in OWL class owl:DatatypeProperty.

◆ OWL_OBJECT_PROPERTY

const SMWExporter::OWL_OBJECT_PROPERTY = 'ObjectProperty'

Object properties link individuals to individuals and is defined as an instance of the built-in OWL class owl:ObjectProperty.

◆ POOLCACHE_ID

const SMWExporter::POOLCACHE_ID = 'exporter.shared'

In-memory cache reference


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

About | General disclaimer | Privacy policy