src/ContextGenerator/JsonldContextGenerator.php
public function getFieldsRdf(RdfMappingInterface $rdfMapping, $field_name, FieldDefinitionInterface $fieldDefinition, array $allRdfNameSpaces) {
    $termDefinition = [];
    $fieldContextFragment = [];
    $fieldRDFMapping = $rdfMapping->getPreparedFieldMapping($field_name);
    if (!empty($fieldRDFMapping)) {
      // If one ore more properties, all will share same datatype so
      // get that before iterating.
      // First get our defaults, no-user or config based input.
      $default_field_term_mapping = $this->getTermContextFromField($fieldDefinition->getType());

      // Now we start overriding from config entity defined mappings.
      // Assume all non defined mapping types as "property".
      $reltype = isset($fieldRDFMapping['mapping_type']) ? $fieldRDFMapping['mapping_type'] : 'property';

      if (isset($fieldRDFMapping['datatype']) && ($reltype == 'property')) {
        $termDefinition = ['@type' => $fieldRDFMapping['datatype']];
      }
      if (!isset($fieldRDFMapping['datatype']) && ($reltype != 'property')) {
        $termDefinition = ['@type' => '@id'];
      }

      // This should respect user provided mapping and fill rest with defaults.
      $termDefinition = $termDefinition + $default_field_term_mapping;

      // Now iterate over all properties for this field
      // trying to parse them as compact IRI.
      foreach ($fieldRDFMapping['properties'] as $property) {
        $compactedDefinition = $this->parseCompactedIri($property);
        if ($compactedDefinition['prefix'] != NULL) {
          // Check if the namespace prefix exists.
          if (array_key_exists($compactedDefinition['prefix'], $allRdfNameSpaces)) {
            // Just overwrite as many times as needed,
            // still faster than checking if
            // it's there in the first place.
            $fieldContextFragment[$compactedDefinition['prefix']] = $allRdfNameSpaces[$compactedDefinition['prefix']];
            $fieldContextFragment[$property] = $termDefinition;
          }
        }
      }
    }

    return $fieldContextFragment;
  }
public function getFieldsRdf(RdfMappingInterface $rdfMapping, $field_name, FieldDefinitionInterface $fieldDefinition, array $allRdfNameSpaces) {
    $termDefinition = [];
    $fieldContextFragment = [];
    $fieldRDFMapping = $rdfMapping->getPreparedFieldMapping($field_name);
    if (!empty($fieldRDFMapping)) {
      // If one ore more properties, all will share same datatype so
      // get that before iterating.
      // First get our defaults, no-user or config based input.
      $default_field_term_mapping = $this->getTermContextFromField($fieldDefinition->getType());

      // Now we start overriding from config entity defined mappings.
      // Assume all non defined mapping types as "property".
      $reltype = isset($fieldRDFMapping['mapping_type']) ? $fieldRDFMapping['mapping_type'] : 'property';

      if (isset($fieldRDFMapping['datatype']) && ($reltype == 'property')) {
        $termDefinition = ['@type' => $fieldRDFMapping['datatype']];
      }
      if (!isset($fieldRDFMapping['datatype']) && ($reltype != 'property')) {
        $termDefinition = ['@type' => '@id'];
      }

      // This should respect user provided mapping and fill rest with defaults.
      $termDefinition = $termDefinition + $default_field_term_mapping;

      // Now iterate over all properties for this field
      // trying to parse them as compact IRI.
      foreach ($fieldRDFMapping['properties'] as $property) {
        $compactedDefinition = $this->parseCompactedIri($property);
        if ($compactedDefinition['prefix'] != NULL) {
          // Check if the namespace prefix exists.
          if (array_key_exists($compactedDefinition['prefix'], $allRdfNameSpaces)) {
            // Just overwrite as many times as needed,
            // still faster than checking if
            // it's there in the first place.
            $fieldContextFragment[$compactedDefinition['prefix']] = $allRdfNameSpaces[$compactedDefinition['prefix']];
            $fieldContextFragment[$property] = $termDefinition;
          }
        }
      }
    }

    return $fieldContextFragment;
  }
{@inheritdoc}