Skip to content

Commit

Permalink
query by hal id only
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Feb 25, 2024
1 parent 97cd71d commit a7227b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Expand Up @@ -2119,9 +2119,6 @@ public String toBibTeX(String id, GrobidAnalysisConfig config) {
* the corresponding field and reset the generic pubnum field.
*/
public void checkIdentifier() {

System.out.println(pubnum);

// DOI
if (!StringUtils.isEmpty(pubnum) && StringUtils.isEmpty(doi)) {
Matcher doiMatcher = TextUtilities.DOIPattern.matcher(pubnum);
Expand Down
Expand Up @@ -115,7 +115,7 @@ public void close() {

/**
* Try to consolidate one bibliographical object with crossref metadata lookup web services based on
* core metadata
* core metadata. In practice, this method is used for consolidating header metadata.
*/
public BiblioItem consolidate(BiblioItem bib, String rawCitation, int consolidateMode) throws Exception {
final List<BiblioItem> results = new ArrayList<>();
Expand All @@ -125,6 +125,7 @@ public BiblioItem consolidate(BiblioItem bib, String rawCitation, int consolidat
theDOI = cleanDOI(theDOI);
}
final String doi = theDOI;
String halId = bib.getHalId();
String aut = bib.getFirstAuthorSurname();
String title = bib.getTitle();
String journalTitle = bib.getJournal();
Expand Down Expand Up @@ -171,6 +172,13 @@ public BiblioItem consolidate(BiblioItem bib, String rawCitation, int consolidat
arguments.put("query.bibliographic", rawCitation);
}
}
if (StringUtils.isNotBlank(halId)) {
// call based on the identified HAL ID
if (arguments == null)
arguments = new HashMap<String,String>();
if (GrobidProperties.getInstance().getConsolidationService() != GrobidConsolidationService.CROSSREF)
arguments.put("halid", halId);
}
if (StringUtils.isNotBlank(aut)) {
// call based on partial metadata
if (GrobidProperties.getInstance().getConsolidationService() != GrobidConsolidationService.CROSSREF) {
Expand Down Expand Up @@ -309,7 +317,9 @@ public void onError(int status, String message, Exception exception) {


/**
* Try tp consolidate a list of bibliographical objects in one operation with consolidation services
* Try tp consolidate a list of bibliographical objects in one operation with consolidation services.
* In practice this method is used for consolidating the metadata of all the extracted bibliographical
* references.
*/
public Map<Integer,BiblioItem> consolidate(List<BibDataSet> biblios) {
if (CollectionUtils.isEmpty(biblios))
Expand All @@ -333,6 +343,8 @@ public Map<Integer,BiblioItem> consolidate(List<BibDataSet> biblios) {
if (StringUtils.isNotBlank(doi)) {
doi = BiblioItem.cleanDOI(doi);
}
// first we get the exploitable metadata
String halId = theBiblio.getHalId();
String aut = theBiblio.getFirstAuthorSurname();
String title = theBiblio.getTitle();
String journalTitle = theBiblio.getJournal();
Expand Down Expand Up @@ -381,6 +393,13 @@ public Map<Integer,BiblioItem> consolidate(List<BibDataSet> biblios) {
arguments = new HashMap<String,String>();
arguments.put("doi", doi);
}
if (StringUtils.isNotBlank(halId)) {
// call based on the identified HAL ID
if (arguments == null)
arguments = new HashMap<String,String>();
if (GrobidProperties.getInstance().getConsolidationService() != GrobidConsolidationService.CROSSREF)
arguments.put("halid", halId);
}
if (StringUtils.isNotBlank(rawCitation)) {
// call with full raw string
if (arguments == null)
Expand Down

0 comments on commit a7227b5

Please sign in to comment.