diff --git a/update_amda/makeHAPIMetadata.php b/update_amda/makeHAPIMetadata.php index 4299506..a4335ec 100644 --- a/update_amda/makeHAPIMetadata.php +++ b/update_amda/makeHAPIMetadata.php @@ -15,12 +15,30 @@ $xpath = new DOMXpath($doc); $dataset_nodes = $xpath->query("/dataRoot/dataCenter/mission/instrument/dataset | /dataRoot/dataCenter/mission/observatory/instrument/dataset | /dataRoot/dataCenter/mission/instrument/datasetGroup/dataset"); $datasets = array(); foreach ($dataset_nodes as $dataset_node) { + //Dataset id $datasetId = $dataset_node->getAttribute("xml:id"); if (empty($datasetId)) { echo "[WARNING] Cannot retrieve dataset id".PHP_EOL; continue; } + //Exclude dataset with group + $to_exclude = FALSE; + $crt_node = $dataset_node; + while (($crt_node != NULL) && !$to_exclude) { + if ($crt_node->nodeType == XML_ELEMENT_NODE) { + $group = $crt_node->getAttribute("group"); + if (!empty($group)) { + $to_exclude = TRUE; + } + } + $crt_node = $crt_node->parentNode; + } + if ($to_exclude) { + echo "[WARNING] Exclude dataset ".$datasetId." (group restriction)".PHP_EOL; + continue; + } + //Dataset start date $startDate = $dataset_node->getAttribute("dataStart"); if (empty($startDate)) { -- libgit2 0.21.2