7.x rdf.module rdf_mapping_save($mapping)

Saves an RDF mapping to the database.

Takes a mapping structure returned by hook_rdf_mapping() implementations and creates or updates a record mapping for each encountered entity type/bundle pair. If available, adds default values for non-existent mapping keys.


$mapping: The RDF mapping to save, as an array.

Return value

Status flag indicating the outcome of the operation.

Related topics

5 calls to rdf_mapping_save()
RdfCrudTestCase::testCRUD in modules/rdf/rdf.test
Test inserting, loading, updating, and deleting RDF mappings.
RdfRdfaMarkupTestCase::testAttributesInMarkupFile in modules/rdf/rdf.test
Ensure that file fields have the correct resource as the object in RDFa when displayed as a teaser.
rdf_modules_installed in modules/rdf/rdf.module
Implements hook_modules_installed().
rdf_test_install in modules/rdf/tests/rdf_test.install
Implements hook_install().
standard_install in profiles/standard/standard.install
Implements hook_install().


modules/rdf/rdf.module, line 241
Enables semantically enriched output for Drupal sites in the form of RDFa.


function rdf_mapping_save($mapping) {

  // In the case where a field has a mapping defined in the default entity
  // mapping, but a mapping is not specified in the bundle-specific mapping,
  // then use the default mapping for that field.
  $mapping['mapping'] += _rdf_get_default_mapping($mapping['type']);
  $status = db_merge('rdf_mapping')
    'type' => $mapping['type'],
    'bundle' => $mapping['bundle'],
    'mapping' => serialize($mapping['mapping']),
  return $status;