Author: david
Date: Fri Oct 9 16:01:39 2009
New Revision: 3711
Log:
Update EAD import for name access points as QubitRelation objects. Fixes issue
#1044.
Modified:
trunk/apps/qubit/modules/object/config/import/ead.yml
trunk/lib/model/QubitInformationObject.php
Modified: trunk/apps/qubit/modules/object/config/import/ead.yml
==============================================================================
--- trunk/apps/qubit/modules/object/config/import/ead.yml Fri Oct 9
13:50:12 2009 (r3710)
+++ trunk/apps/qubit/modules/object/config/import/ead.yml Fri Oct 9
16:01:39 2009 (r3711)
@@ -138,17 +138,17 @@
controlaccess_corpname:
XPath: "(controlaccess/corpname |
controlaccess/controlaccess/corpname)"
Method: setActorByName
- Parameters: [$nodeValue, "$options = array('event_type_id' =>
QubitTerm::SUBJECT_ID, 'entity_type_id' => QubitTerm::CORPORATE_BODY_ID,
'source' => $importDOM->xpath->query('@source', $domNode2)->item(0)->nodeValue,
'rules' => $importDOM->xpath->query('@rules', $domNode2)->item(0)->nodeValue)"]
+ Parameters: [$nodeValue, "$options = array('relation_type_id' =>
QubitTerm::NAME_ACCESS_POINT_ID, 'entity_type_id' =>
QubitTerm::CORPORATE_BODY_ID, 'source' => $importDOM->xpath->query('@source',
$domNode2)->item(0)->nodeValue, 'rules' => $importDOM->xpath->query('@rules',
$domNode2)->item(0)->nodeValue)"]
controlaccess_persname:
XPath: "(controlaccess/persname |
controlaccess/controlaccess/persname)"
Method: setActorByName
- Parameters: [$nodeValue, "$options = array('event_type_id' =>
QubitTerm::SUBJECT_ID, 'entity_type_id' => QubitTerm::PERSON_ID, 'source' =>
$importDOM->xpath->query('@source', $domNode2)->item(0)->nodeValue, 'rules' =>
$importDOM->xpath->query('@rules', $domNode2)->item(0)->nodeValue)"]
+ Parameters: [$nodeValue, "$options = array('relation_type_id' =>
QubitTerm::NAME_ACCESS_POINT_ID, 'entity_type_id' => QubitTerm::PERSON_ID,
'source' => $importDOM->xpath->query('@source', $domNode2)->item(0)->nodeValue,
'rules' => $importDOM->xpath->query('@rules', $domNode2)->item(0)->nodeValue)"]
controlaccess_famname:
XPath: "(controlaccess/famname | controlaccess/controlaccess/famname)"
Method: setActorByName
- Parameters: [$nodeValue, "$options = array('event_type_id' =>
QubitTerm::SUBJECT_ID, 'entity_type_id' => QubitTerm::FAMILY_ID, 'source' =>
$importDOM->xpath->query('@source', $domNode2)->item(0)->nodeValue, 'rules' =>
$importDOM->xpath->query('@rules', $domNode2)->item(0)->nodeValue)"]
+ Parameters: [$nodeValue, "$options = array('relation_type_id' =>
QubitTerm::NAME_ACCESS_POINT_ID, 'entity_type_id' => QubitTerm::FAMILY_ID,
'source' => $importDOM->xpath->query('@source', $domNode2)->item(0)->nodeValue,
'rules' => $importDOM->xpath->query('@rules', $domNode2)->item(0)->nodeValue)"]
controlaccess_geogname:
XPath: "(controlaccess/geogname |
controlaccess/controlaccess/geogname)"
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Fri Oct 9 13:50:12 2009
(r3710)
+++ trunk/lib/model/QubitInformationObject.php Fri Oct 9 16:01:39 2009
(r3711)
@@ -1172,40 +1172,46 @@
public function setActorByName($name, $options)
{
- // only create an Actor and linked Event if the event type is indicated
- if (isset($options['event_type_id']))
+ // only create an linked Actor if the event or relation type is indicated
+ if (!isset($options['event_type_id']) &&
!isset($options['relation_type_id']))
{
- // see if the Actor record already exists, if not create it
- $criteria = new Criteria;
- $criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
- $criteria->add(QubitActorI18n::AUTHORIZED_FORM_OF_NAME, $name);
- if (null === $actor = QubitActor::getOne($criteria))
+ return;
+ }
+
+ // see if the Actor record already exists, if not create it
+ $criteria = new Criteria;
+ $criteria->addJoin(QubitActor::ID, QubitActorI18n::ID);
+ $criteria->add(QubitActorI18n::AUTHORIZED_FORM_OF_NAME, $name);
+
+ if (null === $actor = QubitActor::getOne($criteria))
+ {
+ $actor = new QubitActor;
+ $actor->setAuthorizedFormOfName($name);
+ if (isset($options['entity_type_id']))
{
- $actor = new QubitActor;
- $actor->setAuthorizedFormOfName($name);
- if (isset($options['entity_type_id']))
- {
- // set actor entityTypeId
- $actor->setEntityTypeId($options['entity_type_id']);
- }
- if (isset($options['source']))
- {
- // set actor entityTypeId
- $actor->setSources($options['source']);
- }
- if (isset($options['rules']))
- {
- // set actor entityTypeId
- $actor->setRules($options['rules']);
- }
- if (isset($options['history']))
- {
- $actor->setHistory($options['history']);
- }
- $actor->save();
+ // set actor entityTypeId
+ $actor->setEntityTypeId($options['entity_type_id']);
}
+ if (isset($options['source']))
+ {
+ // set actor entityTypeId
+ $actor->setSources($options['source']);
+ }
+ if (isset($options['rules']))
+ {
+ // set actor entityTypeId
+ $actor->setRules($options['rules']);
+ }
+ if (isset($options['history']))
+ {
+ $actor->setHistory($options['history']);
+ }
+ $actor->save();
+ }
+ if (isset($options['event_type_id']))
+ {
// create an event object to link the information object and actor
$event = new QubitEvent;
$event->setActorId($actor->getId());
@@ -1215,19 +1221,34 @@
$event->setDateDisplay($options['dates']);
}
+ $this->events[] = $event;
+ }
+ else if (isset($options['relation_type_id']))
+ {
+ // only add Actor as name access point if they are not already linked to
+ // an event (i.e. they are not already a "creator", "accumulator", etc.)
+ $c = new Criteria;
+ $c->add(QubitEvent::INFORMATION_OBJECT_ID, $this->id);
+ $c->add(QubitEvent::ACTOR_ID, $actor->id);
+
// only add Actor as name access point if there is no pre-existing
relation
$existingRelation = false;
foreach ($this->events as $existingEvent)
{
- if ($event->getActorId() == $existingEvent->getActorId())
+ if ($actor->id == $existingEvent->actorId)
{
$existingRelation = true;
break;
}
}
+
if (!$existingRelation)
{
- $this->events[] = $event;
+ $relation = new QubitRelation;
+ $relation->objectId = $actor->id;
+ $relation->typeId = QubitTerm::NAME_ACCESS_POINT_ID;
+
+ $this->relationsRelatedBysubjectId[] = $relation;
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---