locdb / loc-db

This is the central component of the LOC-DB project.
9 stars 2 forks source link

Provenance to Resource #10

Closed lgalke closed 5 years ago

lgalke commented 6 years ago

Hey @anlausch

Currently, the provenance of a bibliographic resource gets reverse engineered in the front-end (as shown in the ugly accessor code below). For long-term it would be desirable to attach the provenance property already in the back-end, as soon as the data is retrieved from the respective external source. Would you agree?

export class ProvenResource extends BibliographicResource { 
  constructor(br: BibliographicResource) { 
    super();
    Object.assign(this, br);
  }
  get provenance(): Provenance { 
    let prov = Provenance.unknown;
    if (this._id) { 
      prov = Provenance.locdb;
    } else if (this.identifiers.find(id => id.scheme === ExternalSource.swb)) { 
      prov =  Provenance.swb;
    } else if (this.identifiers.find(id => id.scheme === ExternalSource.crossref )) { 
      prov = Provenance.crossref
    } else if (this.identifiers.find(id => id.scheme === ExternalSource.gScholar)) { 
      prov = Provenance.gScholar;
    } 

    return prov
  } 
}
anlausch commented 6 years ago

I am thinking about using the open citations provenance meta data [1] in the future. What do you think?

[1] S. 3 of https://figshare.com/articles/Metadata_for_the_OpenCitations_Corpus/3443876