`biber --tool`이 .bib 파일에서 비표준 필드를 제거하지 못하도록 방지

`biber --tool`이 .bib 파일에서 비표준 필드를 제거하지 못하도록 방지

이 질문은 다음에서 발생한 부작용에 관한 것입니다.이 답변. 이 부작용을 피하는 한 가지 방법은 비버를 사용하지 않는 것입니다 bibtool -biblatex.이 답변.

.bib 파일의 biblatex 항목에서 , , 및 biber --tool같은 필드를 자동으로 제거하는 데 사용하고 있습니다 . 이에 대한 부작용은 모든 비표준 필드1도 제거되는 것처럼 보이는데, 이를 방지하고 싶습니다. 다음은 최소한의 예입니다.abstractreviewgroupsfile

다음은 .bib 파일의 항목입니다 mybib.bib.

@Thesis{Author_18_TheThesis,
 author           = {Mr Author},
 title            = {The Thesis},
 type             = {Doctoral Dissertation},
 institution      = {Department of Documents, University of Stackexchange},
 year             = {2018},
 abstract         = {This is the abstract.},
 file             = {:author/Author_18_TheThesis.pdf:PDF},
 review           = {This is the review.},
 groups           = {publications},
 ispreprintpublic = {true},
}

이는 다음 clean-bibfiles.conf에 대한 구성 파일 입니다 biber --tool.

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <output_fieldcase>lower</output_fieldcase>
    <output_indent>2</output_indent>
    <output_align>true</output_align>
    <sourcemap>
        <maps datatype="bibtex" map_overwrite="1">
            <map map_overwrite="1">
                <map_step map_field_set="abstract" map_null="1"/>
                <map_step map_field_set="review" map_null="1"/>
                <map_step map_field_set="groups" map_null="1"/>
                <map_step map_field_set="file" map_null="1"/>
            </map>
        </maps>
    </sourcemap>
</config>

실행하면 다음 biblatex 항목이 포함된 파일이 biber --tool --configfile=clean-bibfiles.conf mybib.bib생성됩니다 .mybib_bibertool.bib

@thesis{Author_18_TheThesis,
  author      = {Author, Mr},
  institution = {Department of Documents, University of Stackexchange},
  date        = {2018},
  title       = {The Thesis},
  type        = {Doctoral Dissertation},
}

비표준 필드가 ispreprintpublic항목에서 제거되었습니다. 정확하게 말하자면, groupsreview필드는 소스 맵에 없더라도 제거됩니다. 둘 다 비표준 필드이거나 각각 기사 유형에서 "차용"되었기 때문입니다. 를 사용할 때 해당 필드가 자동으로 제거되는 것을 방지하는 방법은 무엇입니까 biber --tool?


¹예를 들어 "2.1.1 일반 유형" 및 "4.2.4.1 일반 필드"를 참조하세요.biblatex 문서.

답변1

실제로 는 biber데이터 모델의 일부가 아닌 필드를 처리하지 않으므로 데이터 소스에 비표준 필드나 항목 유형이 있는 경우 biber이를 포함하는 데이터 모델을 제공해야 합니다.

하지만 이 작업을 진행하기 전에 필요한 기본 데이터 모델에 실제로 누락된 것이 무엇인지 아는 것이 좋습니다. 다음 옵션 을 사용하여 그렇게 할 수 있습니다 --validate-datamodel.

biber --tool --validate-datamodel mybib.bib

해당 항목이 포함된 .bib 파일에서 다음과 같은 경고가 표시됩니다.

WARN - Datamodel: Entry 'Author_18_TheThesis' (mybib.bib): Field 'review' invalid in data model - ignoring
WARN - Datamodel: Entry 'Author_18_TheThesis' (mybib.bib): Field 'groups' invalid in data model - ignoring
WARN - Datamodel: Entry 'Author_18_TheThesis' (mybib.bib): Field 'ispreprintpublic' invalid in data model - ignoring

필드와 데이터 모델을 포함해야 한다는 것을 정확하게 알 review수 있습니다 groups.ispreprintpublic

(물론 데이터 모델에 review및 를 추가한 groups다음 소스 맵에 놓는 것은 "일반적인" 일이 아닙니다. 여기서는 일반성과 절차를 위해 이 작업을 수행하고 있습니다.)

사용자 정의 biber-tool.conf파일을 설정하려면(이라고 불렀으므로 clean-bibfiles.conf그대로 유지하지만 일반적으로 이 절차를 통해 수행할 수 있는 다른 작업이 있습니다) 비표준 라인을 포함하도록 데이터 모델을 조정해야 합니다. 그룹 내의 필드입니다 <fields>...</fields>. 귀하의 경우(여기서는 "리터럴" 유형 필드라고 가정):

<field fieldtype="field" datatype="literal">review</field>
<field fieldtype="field" datatype="literal">groups</field>
<field fieldtype="field" datatype="literal">ispreprintpublic</field>

그리고 그룹 내에 다음을 <entryfields><entrytype>thesis</entrytype>...</entryfields>추가합니다.

<field>review</field>
<field>groups</field>
<field>ispreprintpublic</field>

그러면 결과는 다음 clean-bibfiles.conf과 같아야 합니다.

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <output_fieldcase>title</output_fieldcase>
  <output_indent>2</output_indent>
  <output_align>true</output_align>
  <sourcemap>
    <maps datatype="bibtex" map_overwrite="1">
      <map map_overwrite="1">
        <map_step map_field_set="abstract" map_null="1"/>
        <map_step map_field_set="review" map_null="1"/>
        <map_step map_field_set="groups" map_null="1"/>
        <map_step map_field_set="file" map_null="1"/>
      </map>
    </maps>
  </sourcemap>
  <datamodel>
    <fields>
      <field fieldtype="field" datatype="literal">review</field>
      <field fieldtype="field" datatype="literal">groups</field>
      <field fieldtype="field" datatype="literal">ispreprintpublic</field>
    </fields>
    <entryfields>
      <entrytype>thesis</entrytype>
      <field>review</field>
      <field>groups</field>
      <field>ispreprintpublic</field>
    </entryfields>
  </datamodel>
</config>

이 구성 파일을 사용하면 다음 명령이 실행됩니다.

biber --tool --validate-datamodel --configfile=clean-bibfiles.conf mybib.bib

mybib_bibertool.bib원하는 대로 항목을 출력합니다 .

@Thesis{Author_18_TheThesis,
  Author           = {Author, Mr},
  Institution      = {Department of Documents, University of Stackexchange},
  Date             = {2018},
  Ispreprintpublic = {test},
  Title            = {The Thesis},
  Type             = {Doctoral Dissertation},
}

기본 데이터 모델 및 구성을 확인하려면 다음을 사용하여 기본값 위치를 찾을 수 있습니다 biber-tool.conf.

biber --tool-config

이것은 특별히 간단하지 않을 수도 있습니다. 하지만 PLK의 말을 인용하자면논평위: "도구 모드에서 데이터 모델을 사용하면 이러한 종류의 문제보다 더 큰 이점이 있습니다."

관련 정보