RDF namespaces registry

Last updated on
31 March 2023

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

At the core of the RDF mappings defined in the RDF mapping API are CURIEs such as 'sioc:Post' which refer to the particular class or property of a vocabulary. For example, 'sioc:Post' refers to the Post class of the SIOC vocabulary. The prefix 'sioc' used in this CURIE is bound to the SIOC vocabulary namespace via the prefix or xmlns: attributes in RDFa. Modules can define prefix bindings by implementing hook_rdf_namespaces(), and Drupal core defines its own.

Only one single binding can exist for each prefix in a given Drupal request, so it's important for modules to avoid defining conflicting prefix bindings. In the majority of the cases, this is not a problem because popular vocabularies have well defined prefixes that the community has agreed on. Some are also defined in the RDFa Core Initial Context. However for any use case using less popular vocabularies, modules in contrib should agree on 'canonical', commonly used prefixes to avoid conflicts across modules.

TL;DR: If your module needs to use one of the prefixes below, then that prefix should be mapped to the 'canonical' namespace listed below. This will help prevent conflicts with other modules that might map the same prefix to a different namespace.

/**
 * Implements hook_rdf_namespaces().
 */
function rdf_rdf_namespaces() {
  return array(
    // Core RDF namespaces which don't need to be redefined in modules.
    'content'  => 'http://purl.org/rss/1.0/modules/content/',
    'dc'       => 'http://purl.org/dc/terms/',
    'foaf'     => 'http://xmlns.com/foaf/0.1/',
    'og'       => 'http://ogp.me/ns#',
    'rdfs'     => 'http://www.w3.org/2000/01/rdf-schema#',
    'sioc'     => 'http://rdfs.org/sioc/ns#',
    'sioct'    => 'http://rdfs.org/sioc/types#',
    'skos'     => 'http://www.w3.org/2004/02/skos/core#',
    'xsd'      => 'http://www.w3.org/2001/XMLSchema#',
    // RDF namespaces that contributed and custom modules should use if needed.
    // Only define the ones that are actually use in your module.
    'schema'   => 'http://schema.org/',
    'rnews'    => 'http://iptc.org/std/rNews/2011-10-07#',
    'dbp'      => 'http://dbpedia.org/property/',
    'grddl'    => 'http://www.w3.org/2003/g/data-view#',
    'ma'       => 'http://www.w3.org/ns/ma-ont#',advanced_help
    'owl'      => 'http://www.w3.org/2002/07/owl#',
    'prov'     => 'http://www.w3.org/ns/prov#',
    'rdf'      => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
    'rdfa'     => 'http://www.w3.org/ns/rdfa#',
    'rif'      => 'http://www.w3.org/2007/rif#',
    'rr'       => 'http://www.w3.org/ns/r2rml#',
    'sd'       => 'http://www.w3.org/ns/sparql-service-description#',
    'skosxl'   => 'http://www.w3.org/2008/05/skos-xl#',
    'wdr'      => 'http://www.w3.org/2007/05/powder#',
    'void'     => 'http://rdfs.org/ns/void#',
    'wdrs'     => 'http://www.w3.org/2007/05/powder-s#',
    'xhv'      => 'http://www.w3.org/1999/xhtml/vocab#',
    'xml'      => 'http://www.w3.org/XML/1998/namespace',
    'org'      => 'http://www.w3.org/ns/org#',
    'gldp'     => 'http://www.w3.org/ns/people#',
    'cnt'      => 'http://www.w3.org/2008/content#',
    'dcat'     => 'http://www.w3.org/ns/dcat#',
    'earl'     => 'http://www.w3.org/ns/earl#',
    'ht'       => 'http://www.w3.org/2006/http#',
    'ptr'      => 'http://www.w3.org/2009/pointers#',
    'cc'       => 'http://creativecommons.org/ns#',
    'ctag'     => 'http://commontag.org/ns#',
    'dcterms'  => 'http://purl.org/dc/terms/',
    'dc11'     => 'http://purl.org/dc/elements/1.1/',
    'gr'       => 'http://purl.org/goodrelations/v1#',
    'ical'     => 'http://www.w3.org/2002/12/cal/icaltzd#',
    'rev'      => 'http://purl.org/stuff/rev#',
    'v'        => 'http://rdf.data-vocabulary.org/#',
    'vcard'    => 'http://www.w3.org/2006/vcard/ns#',
    'adms'     => 'http://www.w3.org/ns/adms#',
    'doap'     => 'http://usefulinc.com/ns/doap#',
  );
}

Help improve this page

Page status: No known problems

You can: