Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.3] 1924 export associations as resource relationship #1933

Open
wants to merge 39 commits into
base: Development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1f00e00
create DwcArchiverAssociation.php and implement mapping in setFieldAr…
Atticus29 Dec 3, 2024
b12ac39
finish implementing first version of classes/DwcArchiverAssociation.php
Atticus29 Dec 3, 2024
fa08ff9
silence association sql print
Atticus29 Dec 3, 2024
31843c8
add translations, include Resource Relationship extension checkbox, a…
Atticus29 Dec 3, 2024
1204989
fix minor bug
Atticus29 Dec 3, 2024
bc9520e
make association download work. Populate? No.
Atticus29 Dec 4, 2024
a356238
allow writeOutRecordBlock to handle the union required for two-way as…
Atticus29 Dec 4, 2024
4320a0a
add symbiota native columns to the export
Atticus29 Dec 4, 2024
0976003
make it so there is no data cutoff for xdebugger
Atticus29 Dec 10, 2024
8e8464f
fix bug where download was not working when association search was be…
Atticus29 Dec 10, 2024
50604f5
comment out associatedOccurrences
Atticus29 Dec 10, 2024
5db000b
remove appendSpecimenDuplicateAssociations, getAssociationJSON, and g…
Atticus29 Dec 10, 2024
20a3b08
remove some cruft and change some translations
Atticus29 Dec 10, 2024
439e119
fix bug where occurrence download was not respecting association cons…
Atticus29 Dec 10, 2024
ba6a9c4
fix bug where ->associationManager->getAssociatedRecords was being ru…
Atticus29 Dec 11, 2024
229be08
begin to implement the changes where omoccurassociations is joined to…
Atticus29 Dec 12, 2024
33ed860
association export mod
egbot Dec 12, 2024
44fc6f8
Merge pull request #1961 from BioKIC/associations-export-egbot
egbot Dec 18, 2024
77948ac
cherry pick copy changes and resolve merge conflicts
Atticus29 Jan 15, 2025
5015abf
resolve merge conflicts with Development
Atticus29 Jan 15, 2025
af00f35
add warning to users about uniqueness of occurrenceId over other iden…
Atticus29 Jan 15, 2025
894fa64
fix typo in recordID
Atticus29 Jan 15, 2025
572d440
add temporary columns to aid in troubleshooting
Atticus29 Jan 16, 2025
5bf4767
fix typos and minor bugs in collections/search/js/searchform.js
Atticus29 Jan 16, 2025
e8e2138
resolve merge conflicts with Development
Atticus29 Jan 16, 2025
61db6fa
fix bug where was not targeting the correct keys for DWC-formatted d…
Atticus29 Jan 17, 2025
9bcbfc6
rename DwcArchiverAssociation to DwcArchiverResourceRelationship
Atticus29 Jan 17, 2025
b50ad33
remove renamed class file
Atticus29 Jan 21, 2025
3b44f25
comment out appendSpecimenDuplicateAssociations call per ticket issue…
Atticus29 Jan 21, 2025
e3fdff9
remove no-longer-needed schema change
Atticus29 Jan 21, 2025
d7c609f
remove unnecessary TODO
Atticus29 Jan 21, 2025
5451d3c
get more things from the omoccurrences table. Fix bug in setSqlBase l…
Atticus29 Jan 22, 2025
8b2f361
add left join of the object omoccurrences entry to fetch relatedResou…
Atticus29 Jan 22, 2025
8c5128d
refine relatedResourceID and resourceRelationshipID
Atticus29 Jan 22, 2025
70076ea
make relatedResourceID refer to the object
Atticus29 Jan 22, 2025
de7712a
continue improvements to resourceRelationshipID and relatedResourceID
Atticus29 Jan 22, 2025
f266105
add missing translations
Atticus29 Jan 22, 2025
2f8bb6d
resolve merge conflicts
Atticus29 Jan 28, 2025
d961163
1924 pt2 external and observational occurrences (#2135)
Atticus29 Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 50 additions & 47 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"xdebugSettings": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was autoformatted. But also the xdebugSettings section was added because my xDebugger values were being very confusingly truncated. Fixed here slash not at all sure why this is being tracked in the repo.

"max_children": 128,
"max_data": -1,
"max_depth": 3
}
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": ["-dxdebug.start_with_request=yes"],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}
23 changes: 16 additions & 7 deletions classes/AssociationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,41 @@ public function getRelationshipTypes(){



public function getAssociatedRecords($associationArr) {
public function getAssociatedRecords($associationArr, $relationshipAccessor='relationship') {
$sql = '';

if (array_key_exists('relationship', $associationArr) && $associationArr['relationship'] !== 'none') {


if (array_key_exists($relationshipAccessor, $associationArr) && $associationArr[$relationshipAccessor] !== 'none') {
$familyJoinStr = '';
// $shouldUseFamily = array_key_exists('associated-taxa', $associationArr) && $associationArr['associated-taxa'] == '3';
$shouldUseFamily = true; // fixes bug that occurs when user selects "Scientific name" taxon type instead of family and then searches for a family. Silly user.
if ($shouldUseFamily) $familyJoinStr = 'LEFT JOIN taxstatus ts ON o.tidinterpreted = ts.tid';

// "Forward" association
$relationshipType = (array_key_exists('relationship', $associationArr) && $associationArr['relationship'] !== 'any') ? $associationArr['relationship'] : 'IS NOT NULL';
$relationshipStr = (array_key_exists('relationship', $associationArr) && $associationArr['relationship'] !== 'any') ? ("='" . $relationshipType . "'") : ' IS NOT NULL';
$relationshipType = (array_key_exists($relationshipAccessor, $associationArr) && $associationArr[$relationshipAccessor] !== 'any') ? $associationArr[$relationshipAccessor] : 'IS NOT NULL';
$relationshipStr = (array_key_exists($relationshipAccessor, $associationArr) && $associationArr[$relationshipAccessor] !== 'any') ? ("='" . $relationshipType . "'") : ' IS NOT NULL';

$forwardSql = "SELECT oa.occid FROM omoccurrences o INNER JOIN omoccurassociations oa ON o.occid = oa.occidAssociate LEFT JOIN omoccurdeterminations od ON oa.occid = od.occid " . $familyJoinStr . " WHERE oa.relationship " . $relationshipStr . " ";
$forwardSql .= $this->getAssociatedTaxonWhereFrag($associationArr);

// "Reverse" association
$reverseAssociationType = (array_key_exists('relationship', $associationArr) && $associationArr['relationship'] !== 'any') ? $this->getInverseRelationshipOf($relationshipType) : 'IS NOT NULL';
$reverseRelationshipStr = (array_key_exists('relationship', $associationArr) && $associationArr['relationship'] !== 'any') ? ("='" . $reverseAssociationType . "'") : ' IS NOT NULL';
$reverseAssociationType = (array_key_exists($relationshipAccessor, $associationArr) && $associationArr[$relationshipAccessor] !== 'any') ? $this->getInverseRelationshipOf($relationshipType) : 'IS NOT NULL';
$reverseRelationshipStr = (array_key_exists($relationshipAccessor, $associationArr) && $associationArr[$relationshipAccessor] !== 'any') ? ("='" . $reverseAssociationType . "'") : ' IS NOT NULL';


$reverseSql = "SELECT oa.occidAssociate FROM omoccurrences o INNER JOIN omoccurassociations oa ON o.occid = oa.occid LEFT JOIN omoccurdeterminations od ON oa.occid = od.occid " . $familyJoinStr . " WHERE oa.relationship " . $reverseRelationshipStr . " ";

$reverseSql .= $this->getAssociatedTaxonWhereFrag($associationArr);

$sql .= "AND (o.occid IN (SELECT occid FROM ( " . $forwardSql . " UNION " . $reverseSql . " ) AS occids)";
// External associations
// $externalAndObservationalSql = "SELECT oa.occid FROM omoccurrences o INNER JOIN omoccurassociations oa ON o.occid = oa.occid LEFT JOIN omoccurdeterminations od ON oa.occid = od.occid " . $familyJoinStr . " WHERE (oa.associationType='observational' OR oa.associationType='externalOccurrence') AND oa.relationship " . $relationshipStr . " ";
$externalAndObservationalSql = "SELECT oa.occid FROM omoccurrences o INNER JOIN omoccurassociations oa ON o.occid = oa.occid LEFT JOIN omoccurdeterminations od ON oa.occid = od.occid " . $familyJoinStr . " WHERE (oa.associationType='observational' OR oa.associationType='externalOccurrence') AND oa.relationship " . $relationshipStr . " ";
$externalAndObservationalSql .= $this->getAssociatedTaxonWhereFrag($associationArr);

// $sql .= "AND (o.occid IN (SELECT occid FROM ( " . $forwardSql . " UNION " . $reverseSql . " ) AS occids)";

$sql .= "AND (o.occid IN (SELECT occid FROM ( " . $forwardSql . " UNION " . $reverseSql . " UNION " . $externalAndObservationalSql . " ) AS occids)";
}
return $sql;
}
Expand Down
4 changes: 2 additions & 2 deletions classes/DwcArchiverBaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ protected function setFileHandler($filePath){
$this->writeOutRecord(array_keys($this->fieldArr['fields']));
}

public function writeOutRecordBlock($occidArr){
public function writeOutRecordBlock($occidArr, $targetField='occid'){
if($occidArr){
$sql = $this->sqlBase.' WHERE occid IN('.implode(',',$occidArr).') ';
$sql = $this->sqlBase.' WHERE ' . $targetField . ' IN('.implode(',',$occidArr).') ';
if($rs = $this->conn->query($sql)){
while($r = $rs->fetch_assoc()){
$this->encodeArr($r);
Expand Down
92 changes: 90 additions & 2 deletions classes/DwcArchiverCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
include_once($SERVER_ROOT . '/classes/DwcArchiverAttribute.php');
include_once($SERVER_ROOT . '/classes/DwcArchiverMaterialSample.php');
include_once($SERVER_ROOT . '/classes/DwcArchiverIdentifier.php');
include_once($SERVER_ROOT . '/classes/DwcArchiverResourceRelationship.php');
include_once($SERVER_ROOT . '/classes/OccurrenceTaxaManager.php');
include_once($SERVER_ROOT . '/classes/OccurrenceAccessStats.php');
include_once($SERVER_ROOT . '/classes/PortalIndex.php');
Expand Down Expand Up @@ -46,6 +47,7 @@ class DwcArchiverCore extends Manager{
protected $includeAttributes = 0;
protected $includeMaterialSample = 0;
protected $includeIdentifiers = 0;
protected $includeAssociations = 0;
private $hasPaleo = false;
private $redactLocalities = 1;
private $rareReaderArr = array();
Expand All @@ -55,6 +57,7 @@ class DwcArchiverCore extends Manager{
private $attributeHandler = null;
private $materialSampleHandler = null;
private $identierHandler = null;
private $associationHandler = null;

private $geolocateVariables = array();

Expand Down Expand Up @@ -875,6 +878,10 @@ public function createDwcArchive($fileNameSeed = ''){
$zipArchive->addFile($this->targetPath . $this->ts . '-ident' . $this->fileExt);
$zipArchive->renameName($this->targetPath . $this->ts . '-ident' . $this->fileExt, 'identifiers' . $this->fileExt);
}
if ($this->includeAssociations && file_exists($this->targetPath . $this->ts . '-assoc' . $this->fileExt)) {
$zipArchive->addFile($this->targetPath . $this->ts . '-assoc' . $this->fileExt);
$zipArchive->renameName($this->targetPath . $this->ts . '-assoc' . $this->fileExt, 'associations' . $this->fileExt);
}
//Meta file
$this->writeMetaFile();
$zipArchive->addFile($this->targetPath . $this->ts . '-meta.xml');
Expand All @@ -895,6 +902,7 @@ public function createDwcArchive($fileNameSeed = ''){
if ($this->includeAttributes && file_exists($this->targetPath . $this->ts . '-attr' . $this->fileExt)) unlink($this->targetPath . $this->ts . '-attr' . $this->fileExt);
if ($this->includeMaterialSample && file_exists($this->targetPath . $this->ts . '-matSample' . $this->fileExt)) unlink($this->targetPath . $this->ts . '-matSample' . $this->fileExt);
if ($this->includeIdentifiers && file_exists($this->targetPath . $this->ts . '-ident' . $this->fileExt)) unlink($this->targetPath . $this->ts . '-ident' . $this->fileExt);
if ($this->includeAssociations && file_exists($this->targetPath . $this->ts . '-assoc' . $this->fileExt)) unlink($this->targetPath . $this->ts . '-assoc' . $this->fileExt);
unlink($this->targetPath . $this->ts . '-meta.xml');
if ($this->schemaType == 'dwc') rename($this->targetPath . $this->ts . '-eml.xml', $this->targetPath . str_replace('.zip', '.eml', $fileName));
else unlink($this->targetPath . $this->ts . '-eml.xml');
Expand Down Expand Up @@ -1120,6 +1128,35 @@ private function writeMetaFile(){
$rootElem->appendChild($extElem3);
}

//Association/Resource relationship extension https://rs.gbif.org/extension/resource_relationship_2024-02-19.xml
if ($this->includeAssociations && isset($this->fieldArrMap['associations'])) {
$extElem3 = $newDoc->createElement('extension');
$extElem3->setAttribute('encoding', $this->charSetOut);
$extElem3->setAttribute('fieldsTerminatedBy', $this->delimiter);
$extElem3->setAttribute('linesTerminatedBy', '\n');
$extElem3->setAttribute('fieldsEnclosedBy', '"');
$extElem3->setAttribute('ignoreHeaderLines', '1');
$extElem3->setAttribute('rowType', 'http://rs.tdwg.org/dwc/terms/ResourceRelationship');

$filesElem3 = $newDoc->createElement('files');
$filesElem3->appendChild($newDoc->createElement('location', 'associations' . $this->fileExt));
$extElem3->appendChild($filesElem3);

$coreIdElem3 = $newDoc->createElement('coreid');
$coreIdElem3->setAttribute('index', '0');
$extElem3->appendChild($coreIdElem3);

$mofCnt = 1;
foreach ($this->fieldArrMap['associations'] as $term) {
$fieldElem = $newDoc->createElement('field');
$fieldElem->setAttribute('index', $mofCnt);
$fieldElem->setAttribute('term', $term);
$extElem3->appendChild($fieldElem);
$mofCnt++;
}
$rootElem->appendChild($extElem3);
}

$newDoc->save($this->targetPath . $this->ts . '-meta.xml');

$this->logOrEcho('Done! (' . date('h:i:s A') . ")\n", 1);
Expand Down Expand Up @@ -1801,9 +1838,9 @@ private function writeOccurrenceFile(){
//$dynProp = $r['dynamicProperties'] . '; ' . $dynProp;
//$r['dynamicProperties'] = $dynProp;
}
if ($assocOccurStr = $dwcOccurManager->getAssociationStr($r['occid'])) $r['t_associatedOccurrences'] = $assocOccurStr;
// if ($assocOccurStr = $dwcOccurManager->getAssociationStr($r['occid'])) $r['t_associatedOccurrences'] = $assocOccurStr;
if ($assocSeqStr = $dwcOccurManager->getAssociatedSequencesStr($r['occid'])) $r['t_associatedSequences'] = $assocSeqStr;
if ($assocTaxa = $dwcOccurManager->getAssociationStr($r['occid'], 'observational')) $r['associatedTaxa'] = $assocTaxa;
// if ($assocTaxa = $dwcOccurManager->getAssociationStr($r['occid'], 'observational')) $r['associatedTaxa'] = $assocTaxa;
}
//$dwcOccurManager->appendUpperTaxonomy($r);
$dwcOccurManager->appendUpperTaxonomy2($r);
Expand All @@ -1822,6 +1859,7 @@ private function writeOccurrenceFile(){
if ($this->includeAttributes) $this->writeAttributeData($batchOccidArr);
if ($this->includeMaterialSample) $this->writeMaterialSampleData($batchOccidArr);
if ($this->includeIdentifiers) $this->writeIdentifierData($batchOccidArr);
if ($this->includeAssociations) $this->writeAssociationData($batchOccidArr);
if ($pubID && $portalManager) $portalManager->insertPortalOccurrences($pubID, $batchOccidArr);
unset($batchOccidArr);
$batchOccidArr = array();
Expand Down Expand Up @@ -1850,6 +1888,10 @@ private function writeOccurrenceFile(){
$this->writeIdentifierData($batchOccidArr);
$this->identierHandler = null;
}
if ($this->includeAssociations){
$this->writeAssociationData($batchOccidArr);
$this->associationHandler = null;
}
}
else {
$this->errorMessage = 'ERROR creating occurrence file: ' . $this->conn->error;
Expand All @@ -1868,6 +1910,7 @@ private function writeOccurrenceFile(){
if ($this->includeAttributes) $this->logOrEcho('Occurrence Attributes exported as a MeasurementsOrFact extension file... ');
if ($this->includeMaterialSample) $this->logOrEcho('Material Samples exported within a MaterialSample extension file... ');
if ($this->includeIdentifiers) $this->logOrEcho('Occurrence Alternative Identifiers exported as a Identifier extension file... ');
if ($this->includeAssociations) $this->logOrEcho('Occurrence Associations exported as a Resource Relationship extension file... ');
return $filePath;
}

Expand Down Expand Up @@ -2063,6 +2106,22 @@ private function writeIdentifierData($batchOccidArr){
if($this->identierHandler) $this->identierHandler->writeOutRecordBlock($batchOccidArr);
}

private function writeAssociationData($batchOccidArr){
if(!$this->associationHandler){
$this->associationHandler = new DwcArchiverResourceRelationship($this->conn);
$this->associationHandler->setSchemaType($this->schemaType);
$this->associationHandler->initiateProcess($this->targetPath . $this->ts . '-assoc' . $this->fileExt);
$this->fieldArrMap['associations'] = $this->associationHandler->getFieldArrTerms();
}
if($this->associationHandler){
$this->associationHandler->writeOutRecordBlock($batchOccidArr, 'oa.occid');
//Now add inverse relationships
$this->associationHandler->setSqlBase(true);
$this->associationHandler->writeOutRecordBlock($batchOccidArr, 'oa.occidAssociate');

}
}

private function writeCitationFile(){
$this->logOrEcho("Creating citation file (" . date('h:i:s A') . ")... ");
$filePath = $this->targetPath . $this->ts . '-citation.txt';
Expand Down Expand Up @@ -2247,6 +2306,11 @@ public function setIncludeIdentifiers($include){
else $this->includeIdentifiers = false;
}

public function setIncludeAssociations($include){
if($include) $this->includeAssociations = true;
else $this->includeAssociations = false;
}

public function hasAttributes($collid = false){
$bool = false;
$sql = 'SELECT occid FROM tmattributes LIMIT 1';
Expand Down Expand Up @@ -2284,6 +2348,30 @@ public function hasIdentifiers($collid = false){
return $bool;
}

public function hasAssociations($collid = false){
$bool = false;
$sql = 'SELECT occid FROM omoccurassociations LIMIT 1';
if(is_numeric($collid)){
$sql = "(SELECT o.occid FROM omoccurrences o INNER JOIN omoccurassociations a ON o.occid = a.occid WHERE o.collid = ?) UNION (SELECT o.occid FROM omoccurrences o INNER JOIN omoccurassociations a ON o.occid = a.occidAssociate WHERE o.collid = ?) LIMIT 1;";
}
$stmt = $this->conn->stmt_init();
if (!$stmt->prepare($sql)) {
throw new Exception("SQL Error: " . $stmt->error);
}
if (is_numeric($collid)) {
$stmt->bind_param('ii',$collid,$collid);
}
$stmt->execute();
$result = $stmt->get_result();
if ($result && $result->num_rows > 0) {
$bool = true;
}
$result->free();
$stmt->close();

return $bool;
}

public function setRedactLocalities($redact){
$this->redactLocalities = $redact;
}
Expand Down
6 changes: 3 additions & 3 deletions classes/DwcArchiverOccurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public function getOccurrenceArr(){
$this->occurDefArr['fields']['dataGeneralizations'] = 'o.dataGeneralizations';
$this->occurDefArr['terms']['dynamicProperties'] = 'http://rs.tdwg.org/dwc/terms/dynamicProperties';
$this->occurDefArr['fields']['dynamicProperties'] = 'o.dynamicProperties';
$this->occurDefArr['terms']['associatedOccurrences'] = 'http://rs.tdwg.org/dwc/terms/associatedOccurrences';
$this->occurDefArr['fields']['associatedOccurrences'] = '';
// $this->occurDefArr['terms']['associatedOccurrences'] = 'http://rs.tdwg.org/dwc/terms/associatedOccurrences';
// $this->occurDefArr['fields']['associatedOccurrences'] = '';
$this->occurDefArr['terms']['associatedSequences'] = 'http://rs.tdwg.org/dwc/terms/associatedSequences';
$this->occurDefArr['fields']['associatedSequences'] = '';
$this->occurDefArr['terms']['associatedTaxa'] = 'http://rs.tdwg.org/dwc/terms/associatedTaxa';
Expand Down Expand Up @@ -471,7 +471,7 @@ public function getAssociationStr($occid, $associationType = null){
$rs->free();
}
//Append associations of duplicate specimen
$this->appendSpecimenDuplicateAssociations($occid, $assocArr, $internalAssocOccidArr);
// $this->appendSpecimenDuplicateAssociations($occid, $assocArr, $internalAssocOccidArr);

//Append resource URLs to each output record
if($internalAssocOccidArr){
Expand Down
6 changes: 6 additions & 0 deletions classes/DwcArchiverPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function batchCreateDwca($collIdArr){
$includeAttributes = $this->includeAttributes;
$includeMatSample = $this->includeMaterialSample;
$includeIdentifiers = $this->includeIdentifiers;
$includeAssociations = $this->includeAssociations;
foreach($collIdArr as $id){
//Create a separate DWCA object for each collection
if($includeAttributes){
Expand All @@ -68,6 +69,10 @@ public function batchCreateDwca($collIdArr){
if($this->hasIdentifiers($id)) $this->includeIdentifiers = true;
else $this->includeIdentifiers = false;
}
if($includeAssociations){
if($this->hasAssociations($id)) $this->includeAssociations = true;
else $this->includeAssociations = false;
}
$this->resetCollArr($id);
$this->conditionArr['collid'] = $id;
$this->conditionSql = '';
Expand All @@ -79,6 +84,7 @@ public function batchCreateDwca($collIdArr){
$this->includeAttributes = $includeAttributes;
$this->includeMaterialSample = $includeMatSample;
$this->includeIdentifiers = $includeIdentifiers;
$this->includeAssociations = $includeAssociations;
//Reset $this->collArr with all the collections ran successfully and then rebuild the RSS feed
$this->resetCollArr(implode(',',$successArr));
$this->writeRssFile();
Expand Down
Loading