Browse Source

Appropriate use of constants.

7.x-2.x
Daniel Lamb 10 years ago
parent
commit
edb81e78df
  1. 39
      islandora/include/rdf_mapping.inc
  2. 10
      islandora/islandora.module
  3. 3
      islandora_basic_image/islandora_basic_image.module
  4. 3
      islandora_collection/islandora_collection.module

39
islandora/include/rdf_mapping.inc

@ -10,71 +10,76 @@
* *
* @param string $bundle * @param string $bundle
* The bundle to associate with the RDF mapping. * The bundle to associate with the RDF mapping.
* @param string $rdf_type
* The RDF type to associate with the bundle.
*
* return array
* The default RDF mapping for Islandora content types.
*/ */
function islandora_get_default_rdf_mapping($bundle) { function islandora_get_default_rdf_mapping($bundle, $rdf_type) {
return array( return array(
array( array(
'type' => 'node', 'type' => 'node',
'bundle' => $bundle, 'bundle' => $bundle,
'mapping' => array( 'mapping' => array(
'rdftype' => array('islandora:collection'), 'rdftype' => array($rdf_type),
'field_dcterms_contributor' => array( ISLANDORA_DCTERMS_CONTRIBUTOR_FIELD => array(
'predicates' => array('dc:contributor'), 'predicates' => array('dc:contributor'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_coverage' => array( ISLANDORA_DCTERMS_COVERAGE_FIELD => array(
'predicates' => array('dc:coverage'), 'predicates' => array('dc:coverage'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_creator' => array( ISLANDORA_DCTERMS_CREATOR_FIELD => array(
'predicates' => array('dc:creator'), 'predicates' => array('dc:creator'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_date' => array( ISLANDORA_DCTERMS_DATE_FIELD => array(
'predicates' => array('dc:date'), 'predicates' => array('dc:date'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_description' => array( ISLANDORA_DCTERMS_DESCRIPTION_FIELD => array(
'predicates' => array('dc:description'), 'predicates' => array('dc:description'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_format' => array( ISLANDORA_DCTERMS_FORMAT_FIELD => array(
'predicates' => array('dc:format'), 'predicates' => array('dc:format'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_identifier' => array( ISLANDORA_DCTERMS_IDENTIFIER_FIELD => array(
'predicates' => array('dc:identifier'), 'predicates' => array('dc:identifier'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_language' => array( ISLANDORA_DCTERMS_LANGUAGE_FIELD => array(
'predicates' => array('dc:language'), 'predicates' => array('dc:language'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_publisher' => array( ISLANDORA_DCTERMS_PUBLISHER_FIELD => array(
'predicates' => array('dc:publisher'), 'predicates' => array('dc:publisher'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_relation' => array( ISLANDORA_DCTERMS_RELATION_FIELD => array(
'predicates' => array('dc:relation'), 'predicates' => array('dc:relation'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_rights' => array( ISLANDORA_DCTERMS_RIGHTS_FIELD => array(
'predicates' => array('dc:rights'), 'predicates' => array('dc:rights'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_source' => array( ISLANDORA_DCTERMS_SOURCE_FIELD => array(
'predicates' => array('dc:source'), 'predicates' => array('dc:source'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_subject' => array( ISLANDORA_DCTERMS_SUBJECT_FIELD => array(
'predicates' => array('dc:subject'), 'predicates' => array('dc:subject'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_title' => array( ISLANDORA_DCTERMS_TITLE_FIELD => array(
'predicates' => array('dc:title'), 'predicates' => array('dc:title'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),
'field_dcterms_type' => array( ISLANDORA_DCTERMS_TYPE_FIELD => array(
'predicates' => array('dc:type'), 'predicates' => array('dc:type'),
'datatype' => 'xsd:string', 'datatype' => 'xsd:string',
), ),

10
islandora/islandora.module

@ -5,10 +5,12 @@
* This is the new Islandora module. We need a better doc comment here. * This is the new Islandora module. We need a better doc comment here.
*/ */
define('ISLANDORA_NAMESPACE', 'http://islandora.ca/ontology/v2/');
define('FEDORA_NAMESPACE', 'http://fedora.info/definitions/v4/repository#');
define('ISLANDORA_TN_FIELD', 'field_tn'); define('ISLANDORA_TN_FIELD', 'field_tn');
define('ISLANDORA_MODS_FIELD', 'field_mods'); define('ISLANDORA_MODS_FIELD', 'field_mods');
define('ISLANDORA_FEDORA_HAS_PARENT', 'field_fedora_hasParent'); define('ISLANDORA_FEDORA_HAS_PARENT', 'field_fedora_has_parent');
define('ISLANDORA_PCDM_HAS_MEMBER', 'field_pcdm_hasMember'); define('ISLANDORA_PCDM_HAS_MEMBER', 'field_pcdm_has_member');
/** /**
* Implements hook_ctools_plugin_api(). * Implements hook_ctools_plugin_api().
@ -26,8 +28,8 @@ function islandora_ctools_plugin_api($owner, $api) {
*/ */
function islandora_rdf_namespaces() { function islandora_rdf_namespaces() {
return array( return array(
'islandora' => 'http://islandora.ca/ontology/v2/', 'islandora' => ISLANDORA_NAMESPACE,
'fedora' => 'http://fedora.info/definitions/v4/repository#', 'fedora' => FEDORA_NAMESPACE,
); );
} }

3
islandora_basic_image/islandora_basic_image.module

@ -6,6 +6,7 @@
*/ */
define('ISLANDORA_BASIC_IMAGE_CONTENT_TYPE', 'islandora_basic_image'); define('ISLANDORA_BASIC_IMAGE_CONTENT_TYPE', 'islandora_basic_image');
define('ISLANDORA_BASIC_IMAGE_RDF_TYPE', 'islandora:basic_image');
define('ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD', 'field_medium_size'); define('ISLANDORA_BASIC_IMAGE_MEDIUM_SIZE_FIELD', 'field_medium_size');
/** /**
@ -33,5 +34,5 @@ function islandora_basic_image_form($node, array &$form_state) {
*/ */
function islandora_basic_image_rdf_mapping() { function islandora_basic_image_rdf_mapping() {
module_load_include('inc', 'islandora', 'include/rdf_mapping'); module_load_include('inc', 'islandora', 'include/rdf_mapping');
return islandora_get_default_rdf_mapping(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE); return islandora_get_default_rdf_mapping(ISLANDORA_BASIC_IMAGE_CONTENT_TYPE, ISLANDORA_BASIC_IMAGE_RDF_TYPE);
} }

3
islandora_collection/islandora_collection.module

@ -6,6 +6,7 @@
*/ */
define('ISLANDORA_COLLECTION_CONTENT_TYPE', 'islandora_collection'); define('ISLANDORA_COLLECTION_CONTENT_TYPE', 'islandora_collection');
define('ISLANDORA_COLLECTION_RDF_TYPE', 'islandora:collection');
/** /**
* Implements hook_views_api(). * Implements hook_views_api().
@ -42,7 +43,7 @@ function islandora_collection_form($node, array &$form_state) {
*/ */
function islandora_collection_rdf_mapping() { function islandora_collection_rdf_mapping() {
module_load_include('inc', 'islandora', 'include/rdf_mapping'); module_load_include('inc', 'islandora', 'include/rdf_mapping');
return islandora_get_default_rdf_mapping(ISLANDORA_COLLECTION_CONTENT_TYPE); return islandora_get_default_rdf_mapping(ISLANDORA_COLLECTION_CONTENT_TYPE, ISLANDORA_COLLECTION_RDF_TYPE);
} }
/** /**

Loading…
Cancel
Save