danielebarchiesi@0
|
1 <?php
|
danielebarchiesi@0
|
2
|
danielebarchiesi@0
|
3 /**
|
danielebarchiesi@0
|
4 * @file
|
danielebarchiesi@0
|
5 * Hooks provided by the RDF module.
|
danielebarchiesi@0
|
6 */
|
danielebarchiesi@0
|
7
|
danielebarchiesi@0
|
8 /**
|
danielebarchiesi@0
|
9 * @addtogroup hooks
|
danielebarchiesi@0
|
10 * @{
|
danielebarchiesi@0
|
11 */
|
danielebarchiesi@0
|
12
|
danielebarchiesi@0
|
13 /**
|
danielebarchiesi@0
|
14 * Allow modules to define RDF mappings for field bundles.
|
danielebarchiesi@0
|
15 *
|
danielebarchiesi@0
|
16 * Modules defining their own field bundles can specify which RDF semantics
|
danielebarchiesi@0
|
17 * should be used to annotate these bundles. These mappings are then used for
|
danielebarchiesi@0
|
18 * automatic RDFa output in the HTML code.
|
danielebarchiesi@0
|
19 *
|
danielebarchiesi@0
|
20 * @return
|
danielebarchiesi@0
|
21 * A list of mapping structures, where each mapping is an associative array:
|
danielebarchiesi@0
|
22 * - type: The name of an entity type (e.g., 'node', 'comment', and so on.)
|
danielebarchiesi@0
|
23 * - bundle: The name of the bundle (e.g., 'page', 'blog', or
|
danielebarchiesi@0
|
24 * RDF_DEFAULT_BUNDLE for default mappings.)
|
danielebarchiesi@0
|
25 * - mapping: The mapping structure which applies to the entity type and
|
danielebarchiesi@0
|
26 * bundle. A mapping structure is an array with keys corresponding to
|
danielebarchiesi@0
|
27 * existing field instances in the bundle. Each field is then described in
|
danielebarchiesi@0
|
28 * terms of the RDF mapping:
|
danielebarchiesi@0
|
29 * - predicates: An array of RDF predicates which describe the relation
|
danielebarchiesi@0
|
30 * between the bundle (RDF subject) and the value of the field (RDF
|
danielebarchiesi@0
|
31 * object). This value is either some text, another bundle, or a URI in
|
danielebarchiesi@0
|
32 * general.
|
danielebarchiesi@0
|
33 * - datatype: Is used along with 'callback' to format data so that it is
|
danielebarchiesi@0
|
34 * readable by machines. A typical example is a date which can be written
|
danielebarchiesi@0
|
35 * in many different formats but should be translated into a uniform
|
danielebarchiesi@0
|
36 * format for machine consumption.
|
danielebarchiesi@0
|
37 * - callback: A function name to invoke for 'datatype'.
|
danielebarchiesi@0
|
38 * - type: A string used to determine the type of RDFa markup which will be
|
danielebarchiesi@0
|
39 * used in the final HTML output, depending on whether the RDF object is a
|
danielebarchiesi@0
|
40 * literal text or another RDF resource.
|
danielebarchiesi@0
|
41 * - rdftype: A special property used to define the type of the instance.
|
danielebarchiesi@0
|
42 * Its value should be an array of RDF classes.
|
danielebarchiesi@0
|
43 *
|
danielebarchiesi@0
|
44 * @ingroup rdf
|
danielebarchiesi@0
|
45 */
|
danielebarchiesi@0
|
46 function hook_rdf_mapping() {
|
danielebarchiesi@0
|
47 return array(
|
danielebarchiesi@0
|
48 array(
|
danielebarchiesi@0
|
49 'type' => 'node',
|
danielebarchiesi@0
|
50 'bundle' => 'blog',
|
danielebarchiesi@0
|
51 'mapping' => array(
|
danielebarchiesi@0
|
52 'rdftype' => array('sioct:Weblog'),
|
danielebarchiesi@0
|
53 'title' => array(
|
danielebarchiesi@0
|
54 'predicates' => array('dc:title'),
|
danielebarchiesi@0
|
55 ),
|
danielebarchiesi@0
|
56 'created' => array(
|
danielebarchiesi@0
|
57 'predicates' => array('dc:date', 'dc:created'),
|
danielebarchiesi@0
|
58 'datatype' => 'xsd:dateTime',
|
danielebarchiesi@0
|
59 'callback' => 'date_iso8601',
|
danielebarchiesi@0
|
60 ),
|
danielebarchiesi@0
|
61 'body' => array(
|
danielebarchiesi@0
|
62 'predicates' => array('content:encoded'),
|
danielebarchiesi@0
|
63 ),
|
danielebarchiesi@0
|
64 'uid' => array(
|
danielebarchiesi@0
|
65 'predicates' => array('sioc:has_creator'),
|
danielebarchiesi@0
|
66 'type' => 'rel',
|
danielebarchiesi@0
|
67 ),
|
danielebarchiesi@0
|
68 'name' => array(
|
danielebarchiesi@0
|
69 'predicates' => array('foaf:name'),
|
danielebarchiesi@0
|
70 ),
|
danielebarchiesi@0
|
71 ),
|
danielebarchiesi@0
|
72 ),
|
danielebarchiesi@0
|
73 );
|
danielebarchiesi@0
|
74 }
|
danielebarchiesi@0
|
75
|
danielebarchiesi@0
|
76 /**
|
danielebarchiesi@0
|
77 * Allow modules to define namespaces for RDF mappings.
|
danielebarchiesi@0
|
78 *
|
danielebarchiesi@0
|
79 * Many common namespace prefixes are defined in rdf_rdf_namespaces(). However,
|
danielebarchiesi@0
|
80 * if a module implements hook_rdf_mapping() and uses a prefix that is not
|
danielebarchiesi@0
|
81 * defined in rdf_rdf_namespaces(), this hook should be used to define the new
|
danielebarchiesi@0
|
82 * namespace prefix.
|
danielebarchiesi@0
|
83 *
|
danielebarchiesi@0
|
84 * @return
|
danielebarchiesi@0
|
85 * An associative array of namespaces where the key is the namespace prefix
|
danielebarchiesi@0
|
86 * and the value is the namespace URI.
|
danielebarchiesi@0
|
87 *
|
danielebarchiesi@0
|
88 * @ingroup rdf
|
danielebarchiesi@0
|
89 */
|
danielebarchiesi@0
|
90 function hook_rdf_namespaces() {
|
danielebarchiesi@0
|
91 return array(
|
danielebarchiesi@0
|
92 'content' => 'http://purl.org/rss/1.0/modules/content/',
|
danielebarchiesi@0
|
93 'dc' => 'http://purl.org/dc/terms/',
|
danielebarchiesi@0
|
94 'foaf' => 'http://xmlns.com/foaf/0.1/',
|
danielebarchiesi@0
|
95 'og' => 'http://ogp.me/ns#',
|
danielebarchiesi@0
|
96 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
|
danielebarchiesi@0
|
97 'sioc' => 'http://rdfs.org/sioc/ns#',
|
danielebarchiesi@0
|
98 'sioct' => 'http://rdfs.org/sioc/types#',
|
danielebarchiesi@0
|
99 'skos' => 'http://www.w3.org/2004/02/skos/core#',
|
danielebarchiesi@0
|
100 'xsd' => 'http://www.w3.org/2001/XMLSchema#',
|
danielebarchiesi@0
|
101 );
|
danielebarchiesi@0
|
102 }
|
danielebarchiesi@0
|
103
|
danielebarchiesi@0
|
104 /**
|
danielebarchiesi@0
|
105 * @} End of "addtogroup hooks".
|
danielebarchiesi@0
|
106 */
|