User login

Best practice for an upgraded site to define RDF mappings for RDFa output?

A site that has been upgraded from Drupal 6 to Drupal 7 has not even had this code from standard.install in the Standard profile run yet. Can generic mappings like this be easily taken care of in other custom configuration of RDF or should this (plus more?) go in an update hook?

<?php
 
// Insert default pre-defined RDF mapping into the database.
 
$rdf_mappings = array(
    array(
     
'type' => 'node',
     
'bundle' => 'page',
     
'mapping' => array(
       
'rdftype' => array('foaf:Document'),
      ),
    ),
    array(
     
'type' => 'node',
     
'bundle' => 'article',
     
'mapping' => array(
       
'field_image' => array(
         
'predicates' => array('og:image', 'rdfs:seeAlso'),
         
'type' => 'rel',
        ),
       
'field_tags' => array(
         
'predicates' => array('dc:subject'),
         
'type' => 'rel',
        ),
      ),
    ),
  );
  foreach (
$rdf_mappings as $rdf_mapping) {
   
rdf_mapping_save($rdf_mapping);
  }
?>
Searched words: 
sitewide RDFa best-practice following D7 to D7 site upgrade

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.