Revision 32875
Added by Argiro Kokogiannaki almost 10 years ago
modules/uoa-joomla/branches/october-release/joomla-2.5.3/com_openaire/site/models/claim.php | ||
---|---|---|
592 | 592 |
throw new Exception('error parsing DOI record'); |
593 | 593 |
if (($bookNodes = $xpath -> query('./book', $crossrefNode)) == FALSE) |
594 | 594 |
throw new Exception('error parsing DOI record'); |
595 |
/* if (($conferenceNodes = $xpath -> query('./conference', $crossrefNode)) == FALSE)
|
|
595 |
if (($conferenceNodes = $xpath -> query('./conference', $crossrefNode)) == FALSE) |
|
596 | 596 |
throw new Exception('error parsing DOI record'); |
597 |
if (($dissertationNodes = $xpath -> query('./dissertation', $crossrefNode)) == FALSE) |
|
597 |
/* if (($dissertationNodes = $xpath -> query('./dissertation', $crossrefNode)) == FALSE)
|
|
598 | 598 |
throw new Exception('error parsing DOI record'); |
599 | 599 |
if (($reportPaperNodes = $xpath -> query('./report-paper', $crossrefNode)) == FALSE) |
600 | 600 |
throw new Exception('error parsing DOI record'); |
... | ... | |
613 | 613 |
} else if (($bookNode = $bookNodes -> item(0)) != NULL) { |
614 | 614 |
$result = $this -> parseBook($doi, $xpath, $bookNode); |
615 | 615 |
JLog :: add('Retrieved book in ' . (microtime(TRUE) - $time) . ' s', JLog :: INFO, self :: LOG); |
616 |
return result; |
|
617 |
/* else if (($conferenceNode = $conferenceNodes -> item(0)) != NULL) |
|
618 |
return conference; |
|
619 |
else if (($dissertationNode = $dissertationNodes -> item(0)) != NULL) |
|
616 |
return $result; |
|
617 |
}else if (($conferenceNode = $conferenceNodes -> item(0)) != NULL){ |
|
618 |
$result = $this -> parseConference($doi, $xpath, $conferenceNode); |
|
619 |
JLog :: add('Retrieved conference in ' . (microtime(TRUE) - $time) . ' s', JLog :: INFO, self :: LOG); |
|
620 |
return $result; |
|
621 |
/* else if (($dissertationNode = $dissertationNodes -> item(0)) != NULL) |
|
620 | 622 |
return dissertation; |
621 | 623 |
else if (($reportPaperNode = $reportPaperNodes -> item(0)) != NULL) |
622 | 624 |
return reportPaper; |
... | ... | |
633 | 635 |
JLog :: add('Retrieved 0 DOI records in ' . (microtime(TRUE) - $time) . ' s', JLog :: INFO, self :: LOG); |
634 | 636 |
return $result; |
635 | 637 |
} else |
636 |
throw new Exception('error parsing DOI record'); |
|
638 |
throw new Exception('error parsing DOI record - unknown schema');
|
|
637 | 639 |
} catch (Exception $e) { |
638 | 640 |
JLog :: add('Error performing DOI search (doi: ' . $doi . '): ' . $e -> getMessage(), JLog :: ERROR, self :: LOG); |
639 | 641 |
return NULL; |
... | ... | |
799 | 801 |
} |
800 | 802 |
return $result; |
801 | 803 |
} |
802 |
|
|
804 |
// Parse a Conference out of a DOI record. |
|
805 |
// $doi the DOI of the record |
|
806 |
// $xpath the DOMXPath to parse |
|
807 |
// $conferenceNode the book node to start from |
|
808 |
// return a result (object) containing publications and total |
|
809 |
private function parseConference($doi, $xpath, $conferenceNode) { |
|
810 |
|
|
811 |
if (($eventMetadata = $xpath -> query('./event_metadata', $conferenceNode)) == FALSE) |
|
812 |
throw new Exception('error parsing DOI record'); |
|
813 |
if (($proceedingsMetadata = $xpath -> query('./proceedings_metadata', $conferenceNode)) == FALSE) |
|
814 |
throw new Exception('error parsing DOI record'); |
|
815 |
if (($conferencePaperNodes = $xpath -> query('./conference_paper', $conferenceNode)) == FALSE) |
|
816 |
throw new Exception('error parsing DOI record'); |
|
817 |
if (($resourceNodes = $xpath -> query('./conference_paper/doi_data/resource', $conferenceNode)) == FALSE) |
|
818 |
throw new Exception('error parsing DOI record'); |
|
819 |
if (($titleNodes = $xpath -> query('./conference_paper/titles/title', $conferenceNode)) == FALSE) |
|
820 |
throw new Exception('error parsing DOI record'); |
|
821 |
if (($contributorNodes = $xpath -> query('./conference_paper/contributors', $conferenceNode)) == FALSE) |
|
822 |
throw new Exception('error parsing DOI record'); |
|
823 |
if (($yearNodes = $xpath -> query('./conference_paper/publication_date/year', $conferenceNode)) == FALSE) |
|
824 |
throw new Exception('error parsing DOI record'); |
|
825 |
$publication = new JObject(); |
|
826 |
$publication -> id = $doi; |
|
827 |
$publication -> source = self :: DOI; |
|
828 |
$publication -> url = (($resourceNode = $resourceNodes -> item(0)) == NULL) ? NULL : trim($resourceNode -> nodeValue); |
|
829 |
$publication -> accessMode = NULL; |
|
830 |
$publication -> datasources = array(); |
|
831 |
$publication -> title = (($titleNode = $titleNodes -> item(0)) == NULL) ? NULL : trim($titleNode -> nodeValue); |
|
832 |
$publication -> authors = $this -> parseContributors($xpath, $contributorNodes); |
|
833 |
$publication -> publisher = NULL; |
|
834 |
$publication -> year = (($yearNode = $yearNodes -> item(0)) == NULL) ? NULL : intval(trim($yearNode -> nodeValue)); |
|
835 |
$publication -> language = NULL; |
|
836 |
$publication -> projects = array(); |
|
837 |
$publication -> embargoEndDate = NULL; |
|
838 |
$publication -> description = NULL; |
|
839 |
$result = new JObject(); |
|
840 |
$result -> publications = array(); |
|
841 |
$result -> totalPublications = 0; |
|
842 |
if (($publication -> id != NULL) || ($publication -> url != NULL) || ($publication -> title != NULL) || ($publication -> authors != NULL) || ($publication -> year != NULL)) { |
|
843 |
$result -> publications[] = $publication; |
|
844 |
$result -> totalPublications = 1; |
|
845 |
} |
|
846 |
return $result; |
|
847 |
} |
|
803 | 848 |
// Parse contributor metadata out of a DOI record. |
804 | 849 |
// $doi the DOI of the record |
805 | 850 |
// $xpath the DOMXPath to parse |
Also available in: Unified diff
searchDOI in croosref: fixed parsing for book, add parsing method for conference