5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
8 * Provides an interface defining an RDF mapping entity.
10 interface RdfMappingInterface extends ConfigEntityInterface {
13 * Gets the mapping for the bundle-level data.
15 * The prepared bundle mapping should be used when outputting data in RDF
16 * serializations such as RDFa. In the prepared mapping, the mapping
17 * configuration's CURIE arrays are processed into CURIE strings suitable for
23 public function getPreparedBundleMapping();
26 * Gets the mapping config for the bundle-level data.
28 * This function returns the bundle mapping as stored in config, which may
29 * contain CURIE arrays. If the mapping is needed for output in a
30 * serialization format, such as RDFa, then getPreparedBundleMapping() should
34 * The bundle mapping, or an empty array if there is no mapping.
36 public function getBundleMapping();
39 * Sets the mapping config for the bundle-level data.
41 * This only sets bundle-level mappings, such as the RDF type. Mappings for
42 * a bundle's fields should be handled with setFieldMapping.
45 * -Map the 'article' bundle to 'sioc:Post'.
47 * rdf_get_mapping('node', 'article')
48 * ->setBundleMapping(array(
49 * 'types' => array('sioc:Post'),
54 * @param array $mapping
57 * @return \Drupal\rdf\Entity\RdfMapping
58 * The RdfMapping object.
60 public function setBundleMapping(array $mapping);
63 * Gets the prepared mapping for a field.
65 * The prepared field mapping should be used when outputting data in RDF
66 * serializations such as RDFa. In the prepared mapping, the mapping
67 * configuration's CURIE arrays are processed into CURIE strings suitable for
70 * @param string $field_name
71 * The name of the field.
74 * The prepared field mapping, or an empty array if there is no mapping.
76 public function getPreparedFieldMapping($field_name);
79 * Gets the mapping config for a field.
81 * This function returns the field mapping as stored in config, which may
82 * contain CURIE arrays. If the mapping is needed for output in a
83 * serialization format, such as RDFa, then getPreparedFieldMapping() should
86 * @param string $field_name
87 * The name of the field.
90 * The field mapping config array, or an empty array if there is no mapping.
92 public function getFieldMapping($field_name);
95 * Sets the mapping config for a field.
97 * @param string $field_name
98 * The name of the field.
99 * @param array $mapping
102 * @return \Drupal\rdf\Entity\RdfMapping
103 * The RdfMapping object.
105 public function setFieldMapping($field_name, array $mapping = []);