1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<?php
/**
* @file
* Contains \Drupal\rdf\RdfMappingInterface
*/
namespace Drupal\rdf;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
/**
* Provides an interface defining an RDF mapping entity.
*/
interface RdfMappingInterface extends ConfigEntityInterface {
/**
* Gets the mapping for the bundle-level data.
*
* The prepared bundle mapping should be used when outputting data in RDF
* serializations such as RDFa. In the prepared mapping, the mapping
* configuration's CURIE arrays are processed into CURIE strings suitable for
* output.
*
* @return array
* The bundle mapping.
*/
public function getPreparedBundleMapping();
/**
* Gets the mapping config for the bundle-level data.
*
* This function returns the bundle mapping as stored in config, which may
* contain CURIE arrays. If the mapping is needed for output in a
* serialization format, such as RDFa, then getPreparedBundleMapping() should
* be used instead.
*
* @return array
* The bundle mapping, or an empty array if there is no mapping.
*/
public function getBundleMapping();
/**
* Sets the mapping config for the bundle-level data.
*
* This only sets bundle-level mappings, such as the RDF type. Mappings for
* a bundle's fields should be handled with setFieldMapping.
*
* Example usage:
* -Map the 'article' bundle to 'sioc:Post'.
* @code
* rdf_get_mapping('node', 'article')
* ->setBundleMapping(array(
* 'types' => array('sioc:Post'),
* ))
* ->save();
* @endcode
*
* @param array $mapping
* The bundle mapping.
*
* @return \Drupal\rdf\Entity\RdfMapping
* The RdfMapping object.
*/
public function setBundleMapping(array $mapping);
/**
* Gets the prepared mapping for a field.
*
* The prepared field mapping should be used when outputting data in RDF
* serializations such as RDFa. In the prepared mapping, the mapping
* configuration's CURIE arrays are processed into CURIE strings suitable for
* output.
*
* @param string $field_name
* The name of the field.
*
* @return array
* The prepared field mapping, or an empty array if there is no mapping.
*/
public function getPreparedFieldMapping($field_name);
/**
* Gets the mapping config for a field.
*
* This function returns the field mapping as stored in config, which may
* contain CURIE arrays. If the mapping is needed for output in a
* serialization format, such as RDFa, then getPreparedFieldMapping() should
* be used instead.
*
* @param string $field_name
* The name of the field.
*
* @return array
* The field mapping config array, or an empty array if there is no mapping.
*/
public function getFieldMapping($field_name);
/**
* Sets the mapping config for a field.
*
* @param string $field_name
* The name of the field.
* @param array $mapping
* The field mapping.
*
* @return \Drupal\rdf\Entity\RdfMapping
* The RdfMapping object.
*/
public function setFieldMapping($field_name, array $mapping = array());
}
|