diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
index 623140f..433af38 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php
@@ -101,6 +101,12 @@ public function viewElements(FieldItemListInterface $items) {
           // Hide the element links.
           $elements[$delta][$target_type][$item->target_id]['links']['#access'] = FALSE;
         }
+        // Add a resource attribute to set the mapping property's value to the
+        // entity's url. Since we don't know what the markup of the entity will
+        // be, we shouldn't rely on the markup for structured data such as RDFa.
+        if (!empty($item->_attributes)) {
+          $item->_attributes += array('resource' => $entity->url());
+        }
       }
       else {
         // This is an "auto_create" item.
diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
index 7cdac18..cbe257e 100644
--- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
+++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php
@@ -75,6 +75,14 @@ public function viewElements(FieldItemListInterface $items) {
             '#type' => 'link',
             '#title' => $label,
           ) + $uri->toRenderArray();
+
+          if (!empty($item->_attributes)) {
+            $elements[$delta]['#options'] += array('attributes' => array());
+            $elements[$delta]['#options']['attributes'] += $item->_attributes;
+            // Unset field item attributes since they have been included in the
+            // formatter output and should not be rendered in the field template.
+            unset($item->_attributes);
+          }
         }
         else {
           $elements[$delta] = array('#markup' => check_plain($label));
diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EntityReferenceRdfaTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EntityReferenceRdfaTest.php
new file mode 100644
index 0000000..de7c504
--- /dev/null
+++ b/core/modules/rdf/lib/Drupal/rdf/Tests/Field/EntityReferenceRdfaTest.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ * @file
+ * Contains \Drupal\rdf\Tests\Field\TaxonomyTermReferenceRdfaTest.
+ */
+
+namespace Drupal\rdf\Tests\Field;
+
+use Drupal\rdf\Tests\Field\FieldRdfaTestBase;
+use Drupal\Core\Field\FieldDefinitionInterface;
+use Drupal\Core\Language\Language;
+
+/**
+ * Tests the RDFa output of the entity reference field formatter.
+ */
+class EntityReferenceRdfaTest extends FieldRdfaTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $fieldType = 'entity_reference';
+
+  /**
+   * The term for testing.
+   *
+   * @var \Drupal\taxonomy\Entity\Term
+   */
+  protected $term;
+
+  /**
+   * The URI of the term for testing.
+   *
+   * @var string
+   */
+  protected $termUri;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = array('entity', 'entity_reference', 'options', 'text', 'filter');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Field formatter: entity reference',
+      'description' => 'Tests RDFa output by entity reference field formatters.',
+      'group' => 'RDF',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp();
+
+    $this->installSchema('entity_test', array('entity_test_rev', 'entity_test_rev_revision'));
+
+    $field = entity_create('field_config', array(
+      'name' => $this->fieldName,
+      'entity_type' => 'entity_test',
+      'type' => $this->fieldType
+    ));
+    $field->save();
+    entity_create('field_instance_config', array(
+      'entity_type' => 'entity_test',
+      'field_name' => $this->fieldName,
+      'bundle' => 'entity_test',
+    ))->save();
+
+    $this->entity = entity_create('entity_test', array(
+      'name' => $this->randomName(),
+      'langcode' => Language::LANGCODE_NOT_SPECIFIED,
+    ));
+    $this->entity->save();
+
+    $entity2 = entity_create('entity_test', array(
+      'name' => $this->randomName(),
+      'langcode' => Language::LANGCODE_NOT_SPECIFIED,
+    ));
+    $entity2->save();
+
+    // Add the mapping.
+    $mapping = rdf_get_mapping('entity_test', 'entity_test');
+    $mapping->setFieldMapping($this->fieldName, array(
+      'properties' => array('schema:knows'),
+    ))->save();
+
+    // Set up test values.
+    $this->entity = entity_create('entity_test');
+    $this->entity->{$this->fieldName}->target_id = 2;
+    $this->entity->save();
+    $this->uri = $this->getAbsoluteUri($this->entity);
+  }
+
+  /**
+   * Tests all the entity reference formatters.
+   */
+  public function testAllFormatters() {
+    // Tests the label formatter.
+    $this->assertFormatterRdfa(array('type' => 'entity_reference_label'), 'http://schema.org/knows', array('value' => $this->entity->{$this->fieldName}->target_id, 'type' => 'literal'));
+    // Tests the entity formatter.
+    $entity_uri = $this->getAbsoluteUri($this->entity);
+    $this->assertFormatterRdfa(array('type'=>'taxonomy_term_reference_link'), 'http://schema.org/knows', array('value' => $entity_uri, 'type' => 'uri'));
+  }
+
+}
