=== modified file 'modules/field/field.info.inc'
--- modules/field/field.info.inc	2009-09-05 09:57:21 +0000
+++ modules/field/field.info.inc	2009-09-05 15:03:43 +0000
@@ -206,7 +206,7 @@ function _field_info_collate_fields($res
     }
 
     // Populate 'fields' only with non-deleted fields.
-    $info['fields'] = array();
+    $info['field'] = array();
     foreach ($info['field_ids'] as $field) {
       if (!$field['deleted']) {
         $info['fields'][$field['field_name']] = $field;

=== modified file 'modules/field/field.module'
--- modules/field/field.module	2009-08-28 06:51:07 +0000
+++ modules/field/field.module	2009-09-05 14:59:43 +0000
@@ -222,6 +222,26 @@ function field_modules_disabled($modules
 }
 
 /**
+ * Implementation of hook_rdf_mapping().
+ *
+ * @return array
+ *   The RDF mappings of all field instances
+ */
+function field_rdf_mapping() {
+  $mapping = array();
+
+  foreach (field_info_instances() as $bundle_name => $instances) {
+    foreach ($instances as $field_name => $instance) {
+      if (isset($instance['rdf_mapping'])) {
+        $mapping[$bundle_name][$field_name] = $instance['rdf_mapping'];
+      }
+    }
+  }
+
+  return $mapping;
+}
+
+/**
  * Allows a module to update the database for fields and columns it controls.
  *
  * @param string $module
@@ -669,9 +689,19 @@ function template_preprocess_field(&$var
       'field-' . $element['#field_name'] . '-' . $bundle,
     ),
   );
+
+  if (isset($variables['#attributes']) && is_array($variables['#attributes']['class'])) {
+    $variables['classes_array'] = array_merge($variables['#attributes']['class'], $variables['classes_array']);
+  }
+
   $variables = array_merge($variables, $additions);
 }
 
+function template_process_field(&$variables) {
+  unset($variables['#attributes']['class']);
+  $variables['attributes'] = empty($variables['#attributes']) ? '' : ' ' . drupal_attributes($variables['#attributes']);
+}
+
 /**
  * @} End of "defgroup field"
  */

=== modified file 'modules/field/field.test'
--- modules/field/field.test	2009-08-31 05:35:47 +0000
+++ modules/field/field.test	2009-09-05 09:30:15 +0000
@@ -2324,3 +2324,70 @@ class FieldBulkDeleteTestCase extends Fi
     $this->assertEqual(count($fields), 0, 'The field is purged.');
   }
 }
+
+/**
+ * Unit test class for fields RDF mappings functionality.
+ */
+class FieldRdfMappingTestCase extends FieldTestCase {
+  protected $field_a, $field_b;
+  protected $field_instance_a, $field_instance_b;
+
+  public static function getInfo() {
+    return array(
+      'name'  => t('Field RDFa output'),
+      'description'  => t("Ensure that RDFa is output for fields."),
+      'group' => t('Field')
+    );
+  }
+
+  function setUp() {
+    DrupalWebTestCase::setUp('field_test', 'rdf');
+
+    // Define a field instance with a simple RDF mapping.
+    $this->field_a = array(
+      'field_name' => drupal_strtolower($this->randomName()),
+      'type' => 'test_field',
+    );
+    field_create_field($this->field_a);
+    $this->field_instance_a = array(
+      'field_name' => $this->field_a['field_name'],
+      'bundle' => 'test_bundle',
+      'rdf_mapping' => array(
+        'property' => array('dc:something'),
+      ),
+    );
+    field_create_instance($this->field_instance_a);
+
+    // Define a field instance with a RDF mapping having multiple RDF properties.
+    $this->field_b = array(
+      'field_name' => drupal_strtolower($this->randomName()),
+      'type' => 'test_field',
+    );
+    field_create_field($this->field_b);
+    $this->field_instance_b = array(
+      'field_name' => $this->field_b['field_name'],
+      'bundle' => 'test_bundle',
+      'rdf_mapping' => array(
+        'property' => array(
+          'dc:something',
+          'dc:somethingelse',
+        ),
+      ),
+    );
+    field_create_instance($this->field_instance_b);
+  }
+
+  function testRdfMapping() {
+    $rdf_mapping = rdf_get_mapping('test_bundle');
+
+    // Simple mapping works.
+    $this->assertTrue(is_array($rdf_mapping[$this->field_instance_b['field_name']]));
+    $this->assertTrue(in_array('dc:something', $rdf_mapping[$this->field_instance_a['field_name']]['property']));
+
+    // Multiple mapping works.
+    $this->assertTrue(is_array($rdf_mapping[$this->field_instance_b['field_name']]['property']));
+    $this->assertTrue(in_array('dc:something', $rdf_mapping[$this->field_instance_b['field_name']]['property']));
+    $this->assertTrue(in_array('dc:somethingelse', $rdf_mapping[$this->field_instance_b['field_name']]['property']));
+  }
+
+}

=== modified file 'modules/field/theme/field.tpl.php'
--- modules/field/theme/field.tpl.php	2009-08-28 06:51:07 +0000
+++ modules/field/theme/field.tpl.php	2009-09-05 11:24:46 +0000
@@ -20,10 +20,13 @@
  *     field type is "text" it would result in "field-type-text".
  *   - field-label-[label_display]: The current label position. For example, if the
  *     label position is "above" it would result in "field-label-above".
+ * - $attributes: String of additional attributes that can be attached to the
+ *   field container.
  *
  * Other variables:
  * - $object: The object to which the field is attached.
  * - $field: The field array.
+ * - $instance: The field instance array.
  * - $build_mode: Build mode, e.g. 'full', 'teaser'...
  * - $field_name: The field name.
  * - $field_type: The field type.
@@ -45,7 +48,7 @@
     <?php endif; ?>
     <div class="field-items">
       <?php foreach ($items as $delta => $item) : ?>
-        <div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"><?php print render($item); ?></div>
+        <div class="field-item <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print $attributes ?>><?php print render($item); ?></div>
       <?php endforeach; ?>
     </div>
   </div>

