Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Rdf\RdfVocabulary Class Reference

RDF vocabulary for use in mapping for wikibase data model. More...

Public Member Functions

 __construct (array $conceptUris, array $dataUris, EntitySourceDefinitions $entitySourceDefinitions, array $rdfTurtleNodePrefixes, array $rdfTurtlePredicatePrefixes, array $canonicalLanguageCodes=[], array $dataTypeUris=[], array $pagePropertyDefs=[], string $licenseUrl='http://creativecommons.org/publicdomain/zero/1.0/')
 
 getNamespaces ()
 Returns a map of namespace names (prefixes) to URIs. More...
 
 getNamespaceURI ( $ns)
 Returns the base URI for a given namespace (aka prefix). More...
 
 getEntityLName (EntityId $entityId)
 Returns a local name for the given entity using the given prefix. More...
 
 getEntityRepositoryName (EntityId $entityId)
 
 getStatementLName (Statement $statement)
 Returns a qname for the given statement using the given prefix. More...
 
 getEntityTypeName ( $type)
 Returns a qname for the given entity type. More...
 
 getDataTypeURI (string $dataTypeId)
 Get Wikibase property data type Uri for ontology. More...
 
 getValueTypeName (DataValue $val)
 Get Wikibase value type name for ontology. More...
 
 getMediaFileURI ( $file)
 Create Commons URL from filename value. More...
 
 getGeoShapeURI ( $file)
 Create data entry point URL for geo shapes. More...
 
 getTabularDataURI ( $file)
 Create data entry point URL for tabular data. More...
 
 getCanonicalLanguageCode ( $languageCode)
 
 getPagePropertyDefs ()
 Get the map of configured page properties. More...
 
 getLicenseUrl ()
 

Static Public Member Functions

static getOntologyURI ()
 Return current ontology version URI. More...
 

Public Attributes

const FORMAT_VERSION = '1.0.0'
 
const NS_ONTOLOGY = 'wikibase'
 
const NS_ENTITY = ''
 
const NS_DATA = 'data'
 
const NS_STATEMENT = 's'
 
const NS_REFERENCE = 'ref'
 
const NS_VALUE = 'v'
 
const NSP_DIRECT_CLAIM = 't'
 
const NSP_DIRECT_CLAIM_NORM = 'tn'
 
const NSP_CLAIM = 'p'
 
const NSP_CLAIM_STATEMENT = 'ps'
 
const NSP_CLAIM_VALUE = 'psv'
 
const NSP_CLAIM_VALUE_NORM = 'psn'
 
const NSP_QUALIFIER = 'pq'
 
const NSP_QUALIFIER_VALUE = 'pqv'
 
const NSP_QUALIFIER_VALUE_NORM = 'pqn'
 
const NSP_REFERENCE = 'pr'
 
const NSP_REFERENCE_VALUE = 'prv'
 
const NSP_REFERENCE_VALUE_NORM = 'prn'
 
const NSP_NOVALUE = 'no'
 
const NS_SKOS = 'skos'
 
const NS_SCHEMA_ORG = 'schema'
 
const NS_CC = 'cc'
 
const NS_GEO = 'geo'
 
const NS_PROV = 'prov'
 
const ONE_ENTITY = 'http://www.wikidata.org/entity/Q199'
 URI for unit "1" See: https://phabricator.wikimedia.org/T105432. More...
 
const WIKIBASE_RANK_BEST = 'BestRank'
 
const RANK_MAP
 
 $claimToValue = []
 
 $claimToValueNormalized = []
 
 $normalizedPropertyValueNamespace = []
 
 $entityNamespaceNames = []
 
 $dataNamespaceNames = []
 
 $statementNamespaceNames = []
 
 $propertyNamespaceNames = []
 

Private Member Functions

 getConceptNamespaces ( $nodeNamespacePrefix, $predicateNamespacePrefix, $baseUri, $dataUri)
 Generates mapping of concept namespaces (including the prefix) to URIs using the given URI base. More...
 
 getConceptUriBase ( $baseUri)
 Returns the base part of concept URIs. More...
 

Private Attributes

const ONTOLOGY_VERSION = '1.0'
 
const ONTOLOGY_BASE_URI = 'http://wikiba.se/ontology'
 
const SKOS_URI = 'http://www.w3.org/2004/02/skos/core#'
 
const SCHEMA_ORG_URI = 'http://schema.org/'
 
const CC_URI = 'http://creativecommons.org/ns#'
 
const MEDIA_URI = 'http://commons.wikimedia.org/wiki/Special:FilePath/'
 
const COMMONS_DATA_URI = 'http://commons.wikimedia.org/data/main/'
 
const GEO_URI = 'http://www.opengis.net/ont/geosparql#'
 
const PROV_URI = 'http://www.w3.org/ns/prov#'
 
const GREGORIAN_CALENDAR = 'http://www.wikidata.org/entity/Q1985727'
 
const JULIAN_CALENDAR = 'http://www.wikidata.org/entity/Q1985786'
 
 $namespaces = []
 
 $canonicalLanguageCodes
 
 $dataTypeUris
 
 $pagePropertyDefs
 
 $licenseUrl
 
 $sourceNameByEntityType
 

Static Private Attributes

static $canonicalLanguageCodeCache = []
 

Detailed Description

RDF vocabulary for use in mapping for wikibase data model.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Rdf\RdfVocabulary::__construct ( array  $conceptUris,
array  $dataUris,
EntitySourceDefinitions  $entitySourceDefinitions,
array  $rdfTurtleNodePrefixes,
array  $rdfTurtlePredicatePrefixes,
array  $canonicalLanguageCodes = [],
array  $dataTypeUris = [],
array  $pagePropertyDefs = [],
string  $licenseUrl = 'http://creativecommons.org/publicdomain/zero/1.0/' 
)
Parameters
string[]$conceptUrisAssociative array mapping repository names to base URIs for entity concept URIs.
string[]$dataUrisAssociative array mapping source/repository names to base URIs for entity description URIs.
EntitySourceDefinitions$entitySourceDefinitions
string[]$rdfTurtleNodePrefixes
string[]$rdfTurtlePredicatePrefixes
string[]$canonicalLanguageCodesMapping of non-standard to canonical language codes.
string[]$dataTypeUrisMapping of property data type IDs to their URIs, if different from the default mapping.
string[][]$pagePropertyDefsMapping of page props, e.g.: pageProp => [ 'name' => wikibase predicate, 'type' => integer ] All predicates will be prefixed with wikibase:
string$licenseUrl

Member Function Documentation

◆ getCanonicalLanguageCode()

Wikibase\Repo\Rdf\RdfVocabulary::getCanonicalLanguageCode (   $languageCode)
Parameters
string$languageCodeAny non-standard or canonical language code
Returns
string Canonical language code

◆ getConceptNamespaces()

Wikibase\Repo\Rdf\RdfVocabulary::getConceptNamespaces (   $nodeNamespacePrefix,
  $predicateNamespacePrefix,
  $baseUri,
  $dataUri 
)
private

Generates mapping of concept namespaces (including the prefix) to URIs using the given URI base.

Parameters
string$nodeNamespacePrefix
string$predicateNamespacePrefix
string$baseUri
string$dataUri
Returns
string[]

◆ getConceptUriBase()

Wikibase\Repo\Rdf\RdfVocabulary::getConceptUriBase (   $baseUri)
private

Returns the base part of concept URIs.

Parameters
string$baseUri
Returns
string

◆ getDataTypeURI()

Wikibase\Repo\Rdf\RdfVocabulary::getDataTypeURI ( string  $dataTypeId)

Get Wikibase property data type Uri for ontology.

Parameters
string$dataTypeId
Returns
string

◆ getEntityLName()

Wikibase\Repo\Rdf\RdfVocabulary::getEntityLName ( EntityId  $entityId)

Returns a local name for the given entity using the given prefix.

Parameters
EntityId$entityId
Returns
string

◆ getEntityRepositoryName()

Wikibase\Repo\Rdf\RdfVocabulary::getEntityRepositoryName ( EntityId  $entityId)
Parameters
EntityId$entityId
Returns
string

◆ getEntityTypeName()

Wikibase\Repo\Rdf\RdfVocabulary::getEntityTypeName (   $type)

Returns a qname for the given entity type.

For well known types, these qnames refer to classes from the Wikibase ontology.

Parameters
string$type
Returns
string

◆ getGeoShapeURI()

Wikibase\Repo\Rdf\RdfVocabulary::getGeoShapeURI (   $file)

Create data entry point URL for geo shapes.

Parameters
string$file
Returns
string

◆ getLicenseUrl()

Wikibase\Repo\Rdf\RdfVocabulary::getLicenseUrl ( )
Returns
string

◆ getMediaFileURI()

Wikibase\Repo\Rdf\RdfVocabulary::getMediaFileURI (   $file)

Create Commons URL from filename value.

Parameters
string$file
Returns
string

◆ getNamespaces()

Wikibase\Repo\Rdf\RdfVocabulary::getNamespaces ( )

Returns a map of namespace names (prefixes) to URIs.

Returns
string[]

◆ getNamespaceURI()

Wikibase\Repo\Rdf\RdfVocabulary::getNamespaceURI (   $ns)

Returns the base URI for a given namespace (aka prefix).

Parameters
string$nsThe namespace name
Exceptions
OutOfBoundsExceptionif $ns is not a known namespace
Returns
string the URI for the given namespace

◆ getOntologyURI()

static Wikibase\Repo\Rdf\RdfVocabulary::getOntologyURI ( )
static

Return current ontology version URI.

Returns
string

◆ getPagePropertyDefs()

Wikibase\Repo\Rdf\RdfVocabulary::getPagePropertyDefs ( )

Get the map of configured page properties.

Returns
string[][]

◆ getStatementLName()

Wikibase\Repo\Rdf\RdfVocabulary::getStatementLName ( Statement  $statement)

Returns a qname for the given statement using the given prefix.

Parameters
Statement$statement
Returns
string

◆ getTabularDataURI()

Wikibase\Repo\Rdf\RdfVocabulary::getTabularDataURI (   $file)

Create data entry point URL for tabular data.

Parameters
string$file
Returns
string

◆ getValueTypeName()

Wikibase\Repo\Rdf\RdfVocabulary::getValueTypeName ( DataValue  $val)

Get Wikibase value type name for ontology.

Parameters
DataValue$val
Returns
string

Member Data Documentation

◆ $canonicalLanguageCodeCache

Wikibase\Repo\Rdf\RdfVocabulary::$canonicalLanguageCodeCache = []
staticprivate

◆ $canonicalLanguageCodes

Wikibase\Repo\Rdf\RdfVocabulary::$canonicalLanguageCodes
private

◆ $claimToValue

Wikibase\Repo\Rdf\RdfVocabulary::$claimToValue = []

◆ $claimToValueNormalized

Wikibase\Repo\Rdf\RdfVocabulary::$claimToValueNormalized = []

◆ $dataNamespaceNames

Wikibase\Repo\Rdf\RdfVocabulary::$dataNamespaceNames = []

◆ $dataTypeUris

Wikibase\Repo\Rdf\RdfVocabulary::$dataTypeUris
private

◆ $entityNamespaceNames

Wikibase\Repo\Rdf\RdfVocabulary::$entityNamespaceNames = []

◆ $licenseUrl

Wikibase\Repo\Rdf\RdfVocabulary::$licenseUrl
private

◆ $namespaces

Wikibase\Repo\Rdf\RdfVocabulary::$namespaces = []
private

◆ $normalizedPropertyValueNamespace

Wikibase\Repo\Rdf\RdfVocabulary::$normalizedPropertyValueNamespace = []

◆ $pagePropertyDefs

Wikibase\Repo\Rdf\RdfVocabulary::$pagePropertyDefs
private

◆ $propertyNamespaceNames

Wikibase\Repo\Rdf\RdfVocabulary::$propertyNamespaceNames = []

◆ $sourceNameByEntityType

Wikibase\Repo\Rdf\RdfVocabulary::$sourceNameByEntityType
private

◆ $statementNamespaceNames

Wikibase\Repo\Rdf\RdfVocabulary::$statementNamespaceNames = []

◆ CC_URI

const Wikibase\Repo\Rdf\RdfVocabulary::CC_URI = 'http://creativecommons.org/ns#'
private

◆ COMMONS_DATA_URI

const Wikibase\Repo\Rdf\RdfVocabulary::COMMONS_DATA_URI = 'http://commons.wikimedia.org/data/main/'
private

◆ FORMAT_VERSION

const Wikibase\Repo\Rdf\RdfVocabulary::FORMAT_VERSION = '1.0.0'

◆ GEO_URI

const Wikibase\Repo\Rdf\RdfVocabulary::GEO_URI = 'http://www.opengis.net/ont/geosparql#'
private

◆ GREGORIAN_CALENDAR

const Wikibase\Repo\Rdf\RdfVocabulary::GREGORIAN_CALENDAR = 'http://www.wikidata.org/entity/Q1985727'
private

◆ JULIAN_CALENDAR

const Wikibase\Repo\Rdf\RdfVocabulary::JULIAN_CALENDAR = 'http://www.wikidata.org/entity/Q1985786'
private

◆ MEDIA_URI

const Wikibase\Repo\Rdf\RdfVocabulary::MEDIA_URI = 'http://commons.wikimedia.org/wiki/Special:FilePath/'
private

◆ NS_CC

const Wikibase\Repo\Rdf\RdfVocabulary::NS_CC = 'cc'

◆ NS_DATA

const Wikibase\Repo\Rdf\RdfVocabulary::NS_DATA = 'data'

◆ NS_ENTITY

const Wikibase\Repo\Rdf\RdfVocabulary::NS_ENTITY = ''

◆ NS_GEO

const Wikibase\Repo\Rdf\RdfVocabulary::NS_GEO = 'geo'

◆ NS_ONTOLOGY

const Wikibase\Repo\Rdf\RdfVocabulary::NS_ONTOLOGY = 'wikibase'

◆ NS_PROV

const Wikibase\Repo\Rdf\RdfVocabulary::NS_PROV = 'prov'

◆ NS_REFERENCE

const Wikibase\Repo\Rdf\RdfVocabulary::NS_REFERENCE = 'ref'

◆ NS_SCHEMA_ORG

const Wikibase\Repo\Rdf\RdfVocabulary::NS_SCHEMA_ORG = 'schema'

◆ NS_SKOS

const Wikibase\Repo\Rdf\RdfVocabulary::NS_SKOS = 'skos'

◆ NS_STATEMENT

const Wikibase\Repo\Rdf\RdfVocabulary::NS_STATEMENT = 's'

◆ NS_VALUE

const Wikibase\Repo\Rdf\RdfVocabulary::NS_VALUE = 'v'

◆ NSP_CLAIM

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_CLAIM = 'p'

◆ NSP_CLAIM_STATEMENT

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_CLAIM_STATEMENT = 'ps'

◆ NSP_CLAIM_VALUE

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_CLAIM_VALUE = 'psv'

◆ NSP_CLAIM_VALUE_NORM

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_CLAIM_VALUE_NORM = 'psn'

◆ NSP_DIRECT_CLAIM

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_DIRECT_CLAIM = 't'

◆ NSP_DIRECT_CLAIM_NORM

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_DIRECT_CLAIM_NORM = 'tn'

◆ NSP_NOVALUE

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_NOVALUE = 'no'

◆ NSP_QUALIFIER

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_QUALIFIER = 'pq'

◆ NSP_QUALIFIER_VALUE

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_QUALIFIER_VALUE = 'pqv'

◆ NSP_QUALIFIER_VALUE_NORM

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_QUALIFIER_VALUE_NORM = 'pqn'

◆ NSP_REFERENCE

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_REFERENCE = 'pr'

◆ NSP_REFERENCE_VALUE

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_REFERENCE_VALUE = 'prv'

◆ NSP_REFERENCE_VALUE_NORM

const Wikibase\Repo\Rdf\RdfVocabulary::NSP_REFERENCE_VALUE_NORM = 'prn'

◆ ONE_ENTITY

const Wikibase\Repo\Rdf\RdfVocabulary::ONE_ENTITY = 'http://www.wikidata.org/entity/Q199'

◆ ONTOLOGY_BASE_URI

const Wikibase\Repo\Rdf\RdfVocabulary::ONTOLOGY_BASE_URI = 'http://wikiba.se/ontology'
private

◆ ONTOLOGY_VERSION

const Wikibase\Repo\Rdf\RdfVocabulary::ONTOLOGY_VERSION = '1.0'
private

◆ PROV_URI

const Wikibase\Repo\Rdf\RdfVocabulary::PROV_URI = 'http://www.w3.org/ns/prov#'
private

◆ RANK_MAP

const Wikibase\Repo\Rdf\RdfVocabulary::RANK_MAP
Initial value:
= [
Statement::RANK_DEPRECATED => 'DeprecatedRank',
Statement::RANK_NORMAL => 'NormalRank',
Statement::RANK_PREFERRED => 'PreferredRank',
]
const RANK_PREFERRED
Rank enum.
Definition: Statement.php:29
const RANK_NORMAL
Definition: Statement.php:30
const RANK_DEPRECATED
Definition: Statement.php:31

◆ SCHEMA_ORG_URI

const Wikibase\Repo\Rdf\RdfVocabulary::SCHEMA_ORG_URI = 'http://schema.org/'
private

◆ SKOS_URI

const Wikibase\Repo\Rdf\RdfVocabulary::SKOS_URI = 'http://www.w3.org/2004/02/skos/core#'
private

◆ WIKIBASE_RANK_BEST

const Wikibase\Repo\Rdf\RdfVocabulary::WIKIBASE_RANK_BEST = 'BestRank'

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