comparison core/modules/rdf/src/RdfMappingInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\rdf;
4
5 use Drupal\Core\Config\Entity\ConfigEntityInterface;
6
7 /**
8 * Provides an interface defining an RDF mapping entity.
9 */
10 interface RdfMappingInterface extends ConfigEntityInterface {
11
12 /**
13 * Gets the mapping for the bundle-level data.
14 *
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
18 * output.
19 *
20 * @return array
21 * The bundle mapping.
22 */
23 public function getPreparedBundleMapping();
24
25 /**
26 * Gets the mapping config for the bundle-level data.
27 *
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
31 * be used instead.
32 *
33 * @return array
34 * The bundle mapping, or an empty array if there is no mapping.
35 */
36 public function getBundleMapping();
37
38 /**
39 * Sets the mapping config for the bundle-level data.
40 *
41 * This only sets bundle-level mappings, such as the RDF type. Mappings for
42 * a bundle's fields should be handled with setFieldMapping.
43 *
44 * Example usage:
45 * -Map the 'article' bundle to 'sioc:Post'.
46 * @code
47 * rdf_get_mapping('node', 'article')
48 * ->setBundleMapping(array(
49 * 'types' => array('sioc:Post'),
50 * ))
51 * ->save();
52 * @endcode
53 *
54 * @param array $mapping
55 * The bundle mapping.
56 *
57 * @return \Drupal\rdf\Entity\RdfMapping
58 * The RdfMapping object.
59 */
60 public function setBundleMapping(array $mapping);
61
62 /**
63 * Gets the prepared mapping for a field.
64 *
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
68 * output.
69 *
70 * @param string $field_name
71 * The name of the field.
72 *
73 * @return array
74 * The prepared field mapping, or an empty array if there is no mapping.
75 */
76 public function getPreparedFieldMapping($field_name);
77
78 /**
79 * Gets the mapping config for a field.
80 *
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
84 * be used instead.
85 *
86 * @param string $field_name
87 * The name of the field.
88 *
89 * @return array
90 * The field mapping config array, or an empty array if there is no mapping.
91 */
92 public function getFieldMapping($field_name);
93
94 /**
95 * Sets the mapping config for a field.
96 *
97 * @param string $field_name
98 * The name of the field.
99 * @param array $mapping
100 * The field mapping.
101 *
102 * @return \Drupal\rdf\Entity\RdfMapping
103 * The RdfMapping object.
104 */
105 public function setFieldMapping($field_name, array $mapping = []);
106
107 }