diff --git a/config/schema/pathauto_pattern.schema.yml b/config/schema/pathauto_pattern.schema.yml
index 1cadb39..69d0189 100644
--- a/config/schema/pathauto_pattern.schema.yml
+++ b/config/schema/pathauto_pattern.schema.yml
@@ -28,7 +28,7 @@ pathauto.pattern.*:
     weight:
       type: integer
       label: 'Weight'
-    context_definitions:
+    relationships:
       type: sequence
       label: 'Context definitions'
       sequence:
diff --git a/src/Entity/PathautoPattern.php b/src/Entity/PathautoPattern.php
index f7619e8..c0d8862 100644
--- a/src/Entity/PathautoPattern.php
+++ b/src/Entity/PathautoPattern.php
@@ -16,6 +16,7 @@ use Drupal\Core\Plugin\Context\ContextInterface;
 use Drupal\Core\Plugin\ContextAwarePluginInterface;
 use Drupal\Core\Plugin\DefaultSingleLazyPluginCollection;
 use Drupal\pathauto\PathautoPatternInterface;
+use Drupal\rules\Context\ContextDefinitionInterface;
 
 /**
  * Defines the Pathauto pattern entity.
@@ -110,14 +111,14 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
   protected $weight = 0;
 
   /**
-   * @var \Drupal\Core\Plugin\Context\ContextInterface[]
+   * @var \Drupal\Core\Plugin\Context\ContextInterface[]|NULL
    */
-  protected $contexts = [];
+  protected $contexts = NULL;
 
   /**
    * @var array
    */
-  protected $context_definitions = [];
+  protected $relationships = [];
 
   /**
    * The plugin collection that holds the selection criteria condition plugins.
@@ -140,19 +141,6 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
     }
     $this->selection_criteria = $criteria;
 
-    /** @var \Drupal\Core\Plugin\Context\ContextInterface[] $contexts */
-    $contexts = $this->getContexts();
-    foreach ($this->getAliasType()->getContexts() as $plugin_context_id => $plugin_context) {
-      unset($contexts[$plugin_context_id]);
-    }
-    $this->context_definitions = [];
-    foreach ($contexts as $context_id => $context) {
-      $this->context_definitions[] = [
-        'id' => $context_id,
-        'label' => $context->getContextDefinition()->getLabel()
-      ];
-    }
-
     // Invalidate the static caches.
     \Drupal::service('pathauto.generator')->resetCaches();
   }
@@ -160,31 +148,6 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
   /**
    * {@inheritdoc}
    */
-  public static function postLoad(EntityStorageInterface $storage, array &$entities) {
-    /** @var \Drupal\ctools\TypedDataResolver $resolver */
-    $resolver = \Drupal::service('ctools.typed_data.resolver');
-    /** @var \Drupal\pathauto\Entity\PathautoPattern $entity */
-    foreach ($entities as $entity) {
-      foreach ($entity->getContextDefinitions() as $definition) {
-        $context = $resolver->convertTokenToContext($definition['id'], $entity->getContexts());
-        $new_definition = new ContextDefinition(
-          $context->getContextDefinition()->getDataType(),
-          $definition['label'],
-          $context->getContextDefinition()->isRequired(),
-          $context->getContextDefinition()->isMultiple(),
-          $context->getContextDefinition()->getDescription(),
-          $context->getContextDefinition()->getDefaultValue()
-        );
-        $new_context = new Context($new_definition, $context->hasContextValue() ? $context->getContextValue() : NULL);
-        $entity->addContext($definition['id'], $new_context);
-      }
-    }
-    parent::postLoad($storage, $entities);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public static function postDelete(EntityStorageInterface $storage, array $entities) {
     parent::postDelete($storage, $entities);
     // Invalidate the static caches.
@@ -256,36 +219,47 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
   /**
    * {@inheritdoc}
    */
-  public function hasContext($token) {
-    $contexts = $this->getAliasType()->getContexts();
-    $contexts += $this->contexts;
-    return !empty($contexts[$token]);
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getContext($token) {
-    $contexts = $this->getAliasType()->getContexts();
-    $contexts += $this->contexts;
-    return $contexts[$token];
+  protected function getContexts() {
+    if (is_null($this->contexts)) {
+      $this->contexts = $this->getAliasType()->getContexts();
+      foreach ($this->getRelationships() as $definition) {
+        /** @var \Drupal\ctools\TypedDataResolver $resolver */
+        $resolver = \Drupal::service('ctools.typed_data.resolver');
+        /** @var \Drupal\pathauto\Entity\PathautoPattern $entity */
+        $context = $resolver->convertTokenToContext($definition['id'], $this->contexts);
+        $context_definition = $context->getContextDefinition();
+        if (!empty($definition['label'])) {
+          $context_definition->setLabel($definition['label']);
+        }
+        $contexts[$definition['id']] = new Context($context_definition, $context->getContextValue());
+        $this->contexts[$definition['id']] = $contexts[$definition['id']];
+      }
+    }
+    return $this->contexts;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getContexts() {
-    $contexts = $this->getAliasType()->getContexts();
-    $contexts += $this->contexts;
-    return $contexts;
+  public function hasRelationship($token) {
+    foreach ($this->getRelationships() as $key => $definition) {
+      if ($definition['id'] == $token) {
+        return TRUE;
+      }
+    }
+    return FALSE;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function addContext($token, ContextInterface $context) {
-    if (!$this->hasContext($token)) {
-      $this->contexts[$token] = $context;
+  public function addRelationship($token, $label = NULL) {
+    if (!$this->hasRelationship($token)) {
+      $this->relationships[] = [
+        'id' => $token,
+        'label' => $label,
+      ];
+      $this->contexts = NULL;
     }
     return $this;
   }
@@ -293,9 +267,13 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
   /**
    * {@inheritdoc}
    */
-  public function replaceContext($token, ContextInterface $context) {
-    if ($this->hasContext($token)) {
-      $this->contexts[$token] = $context;
+  public function replaceRelationship($token, $label) {
+    if ($this->hasRelationship($token)) {
+      $this->relationships[] = [
+        'id' => $token,
+        'label' => $label,
+      ];
+      $this->contexts = NULL;
     }
     return $this;
   }
@@ -303,9 +281,12 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
   /**
    * {@inheritdoc}
    */
-  public function removeContext($token) {
-    if (isset($this->contexts[$token])) {
-      unset($this->contexts[$token]);
+  public function removeRelationship($token) {
+    foreach ($this->getRelationships() as $key => $definition) {
+      if ($definition['id'] == $token) {
+        unset($this->relationships[$key]);
+        $this->contexts = NULL;
+      }
     }
     return $this;
   }
@@ -313,8 +294,8 @@ class PathautoPattern extends ConfigEntityBase implements PathautoPatternInterfa
   /**
    * {@inheritdoc}
    */
-  public function getContextDefinitions() {
-    return $this->context_definitions;
+  public function getRelationships() {
+    return $this->relationships;
   }
 
   /**
diff --git a/src/Form/PatternEditForm.php b/src/Form/PatternEditForm.php
index 02615fa..4febcf6 100644
--- a/src/Form/PatternEditForm.php
+++ b/src/Form/PatternEditForm.php
@@ -244,9 +244,7 @@ class PatternEditForm extends EntityForm {
             ]
           ]
         );
-        $new_definition = new ContextDefinition('language', 'Language');
-        $new_context = new Context($new_definition);
-        $entity->addContext($language_mapping, $new_context);
+        $entity->addRelationship($language_mapping, t('Language'));
       }
 
     }
diff --git a/src/PathautoPatternInterface.php b/src/PathautoPatternInterface.php
index 33d67d2..0597187 100644
--- a/src/PathautoPatternInterface.php
+++ b/src/PathautoPatternInterface.php
@@ -8,7 +8,6 @@
 namespace Drupal\pathauto;
 
 use Drupal\Core\Config\Entity\ConfigEntityInterface;
-use Drupal\Core\Plugin\Context\ContextInterface;
 
 /**
  * Provides an interface for defining Pathauto pattern entities.
@@ -63,17 +62,7 @@ interface PathautoPatternInterface extends ConfigEntityInterface {
   /**
    * @return bool
    */
-  public function hasContext($token);
-
-  /**
-   * @return \Drupal\Core\Plugin\Context\ContextInterface
-   */
-  public function getContext($token);
-
-  /**
-   * @return \Drupal\Core\Plugin\Context\ContextInterface[]
-   */
-  public function getContexts();
+  public function hasRelationship($token);
 
   /**
    * @param string $token
@@ -81,7 +70,7 @@ interface PathautoPatternInterface extends ConfigEntityInterface {
    *
    * @return $this
    */
-  public function addContext($token, ContextInterface $context);
+  public function addRelationship($token, $label = NULL);
 
   /**
    * @param string $token
@@ -89,16 +78,16 @@ interface PathautoPatternInterface extends ConfigEntityInterface {
    *
    * @return $this
    */
-  public function replaceContext($token, ContextInterface $context);
+  public function replaceRelationship($token, $label);
 
   /**
    * @param string $token
    *
    * @return $this
    */
-  public function removeContext($token);
+  public function removeRelationship($token);
 
-  public function getContextDefinitions();
+  public function getRelationships();
 
   /**
    * Gets the selection condition collection.
diff --git a/src/Tests/PathautoUnitTest.php b/src/Tests/PathautoUnitTest.php
index 1a89d5e..f07835c 100644
--- a/src/Tests/PathautoUnitTest.php
+++ b/src/Tests/PathautoUnitTest.php
@@ -103,9 +103,7 @@ class PathautoUnitTest extends KernelTestBase {
       ]
     );
 
-    $new_definition = new ContextDefinition('language', 'Language');
-    $new_context = new Context($new_definition);
-    $pattern->addContext('node:langcode:language', $new_context);
+    $pattern->addRelationship('node:langcode:language');
     $pattern->save();
 
     $pattern = $this->createPattern('node', '/[node:title]', -1);
