diff --git a/CHANGELOG.md b/CHANGELOG.md index bf4296c0688..5b7f10fe18e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We added a new fetcher to enable users to search all available E-Libraries simultaneously. [koppor#369](https://github.com/koppor/jabref/issues/369) - We added the field "entrytype" to the export sort criteria [#6531](https://github.com/JabRef/jabref/pull/6531) - We added the possibility to change the display order of the fields in the entry editor. The order can now be configured using drag and drop in the "Customize entry types" dialog [#6152](https://github.com/JabRef/jabref/pull/6152) +- We added native support for biblatex-software [#6574](https://github.com/JabRef/jabref/issues/6574) - We added a missing restart warning for AutoComplete in the preferences dialog. [#6351](https://github.com/JabRef/jabref/issues/6351) - We added a note to the citation key pattern preferences dialog as a temporary workaround for a JavaFX bug, about committing changes in a table cell, if the focus is lost. [#5825](https://github.com/JabRef/jabref/issues/5825) diff --git a/docs/adr/0013-add-native-support-biblatex-software.md b/docs/adr/0013-add-native-support-biblatex-software.md new file mode 100644 index 00000000000..7f1d2c028d7 --- /dev/null +++ b/docs/adr/0013-add-native-support-biblatex-software.md @@ -0,0 +1,48 @@ +# Add Native Support for BibLatex-Sotware +* Deciders: Oliver Kopp + +Technical Story: [6574-Adding support for biblatex-software](https://github.com/JabRef/jabref/issues/6574) + +## Context and Problem Statement + +JabRef does not right now have support for Biblatex-Software out of the box, users have to add custome entry type. +With citing software becoming fairly common , native support is helpful. + + +## Decision Drivers + +* None of the existing flows should be impacted + +## Considered Options + +* Add the new entry types to the existing biblatex types +* Add a divider with label Biblatex-Software under which the new entries are listed : Native support for Biblatex-Software +* Support via customized entry types : A user can load a customized bib file + +## Decision Outcome + +Chosen option: Add a new divider, because comes out best (see below). + +### Positive Consequences + +* Inbuilt coverage for a entry type that is getting more and more importance + +### Negative Consequences + +* Adds a little bit more clutter to the Add Entry pane + +## Pros and Cons of the Options + +### Adding the new entry types to the existing biblatex types + +* Good, because there is no need for a new category in the add entry pane + +### Add a divider with label Biblatex-Software with relevant types + +* Good, since this gives the user a bit more clarity + +### Support via customized entry types + +* Good, because no code needs to be changed +* Bad, because documentation is needed +* Bad, because the users are not guided through the UI, but have to do other steps. diff --git a/src/main/java/org/jabref/gui/EntryType.fxml b/src/main/java/org/jabref/gui/EntryType.fxml index da5daa62136..a2d43feffbd 100644 --- a/src/main/java/org/jabref/gui/EntryType.fxml +++ b/src/main/java/org/jabref/gui/EntryType.fxml @@ -26,6 +26,11 @@ + + + + + diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index fc3fbfb1d65..3eaecd94a4e 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -7,7 +7,9 @@ import javafx.application.Platform; import javafx.event.Event; import javafx.fxml.FXML; + import javax.inject.Inject; + import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.ComboBox; @@ -27,6 +29,7 @@ import org.jabref.model.database.BibDatabaseMode; import org.jabref.model.entry.BibEntryType; import org.jabref.model.entry.types.BiblatexEntryTypeDefinitions; +import org.jabref.model.entry.types.BiblatexSoftwareEntryTypeDefinitions; import org.jabref.model.entry.types.BibtexEntryTypeDefinitions; import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.IEEETranEntryTypeDefinitions; @@ -52,10 +55,12 @@ public class EntryTypeView extends BaseDialog { @FXML private FlowPane bibTexPane; @FXML private FlowPane ieeetranPane; @FXML private FlowPane customPane; + @FXML private FlowPane biblatexSoftwarePane; @FXML private TitledPane biblatexTitlePane; @FXML private TitledPane bibTexTitlePane; @FXML private TitledPane ieeeTranTitlePane; @FXML private TitledPane customTitlePane; + @FXML private TitledPane biblatexSoftwareTitlePane; @Inject StateManager stateManager; @@ -140,9 +145,11 @@ public void initialize() { ieeeTranTitlePane.managedProperty().bind(ieeeTranTitlePane.visibleProperty()); biblatexTitlePane.managedProperty().bind(biblatexTitlePane.visibleProperty()); customTitlePane.managedProperty().bind(customTitlePane.visibleProperty()); + biblatexSoftwareTitlePane.managedProperty().bind(biblatexSoftwareTitlePane.visibleProperty()); if (basePanel.getBibDatabaseContext().isBiblatexMode()) { addEntriesToPane(biblatexPane, BiblatexEntryTypeDefinitions.ALL); + addEntriesToPane(biblatexSoftwarePane, BiblatexSoftwareEntryTypeDefinitions.ALL); bibTexTitlePane.setVisible(false); ieeeTranTitlePane.setVisible(false); @@ -155,6 +162,7 @@ public void initialize() { } } else { biblatexTitlePane.setVisible(false); + biblatexSoftwareTitlePane.setVisible(false); addEntriesToPane(bibTexPane, BibtexEntryTypeDefinitions.ALL); addEntriesToPane(ieeetranPane, IEEETranEntryTypeDefinitions.ALL); diff --git a/src/main/java/org/jabref/model/database/BibDatabase.java b/src/main/java/org/jabref/model/database/BibDatabase.java index b8c7d5471d7..7ba57bf2efc 100644 --- a/src/main/java/org/jabref/model/database/BibDatabase.java +++ b/src/main/java/org/jabref/model/database/BibDatabase.java @@ -61,15 +61,15 @@ public class BibDatabase { private String epilog = ""; private String sharedDatabaseID; - public BibDatabase() { - this.registerListener(new KeyChangeListener(this)); - } - public BibDatabase(List entries) { this(); insertEntries(entries); } + public BibDatabase() { + this.registerListener(new KeyChangeListener(this)); + } + /** * @param toResolve maybenull The text to resolve. * @param database maybenull The database to use for resolving the text. diff --git a/src/main/java/org/jabref/model/entry/BibEntryTypesManager.java b/src/main/java/org/jabref/model/entry/BibEntryTypesManager.java index f56230a110a..19d23afd288 100644 --- a/src/main/java/org/jabref/model/entry/BibEntryTypesManager.java +++ b/src/main/java/org/jabref/model/entry/BibEntryTypesManager.java @@ -12,6 +12,7 @@ import org.jabref.model.entry.field.BibField; import org.jabref.model.entry.field.FieldFactory; import org.jabref.model.entry.types.BiblatexEntryTypeDefinitions; +import org.jabref.model.entry.types.BiblatexSoftwareEntryTypeDefinitions; import org.jabref.model.entry.types.BibtexEntryTypeDefinitions; import org.jabref.model.entry.types.EntryType; import org.jabref.model.entry.types.EntryTypeFactory; @@ -20,7 +21,7 @@ public class BibEntryTypesManager { public static final String ENTRYTYPE_FLAG = "jabref-entrytype: "; private final InternalEntryTypes BIBTEX = new InternalEntryTypes(Stream.concat(BibtexEntryTypeDefinitions.ALL.stream(), IEEETranEntryTypeDefinitions.ALL.stream()).collect(Collectors.toList())); - private final InternalEntryTypes BIBLATEX = new InternalEntryTypes(BiblatexEntryTypeDefinitions.ALL); + private final InternalEntryTypes BIBLATEX = new InternalEntryTypes(Stream.concat(BiblatexEntryTypeDefinitions.ALL.stream(), BiblatexSoftwareEntryTypeDefinitions.ALL.stream()).collect(Collectors.toList())); public BibEntryTypesManager() { } @@ -97,6 +98,7 @@ public List getAllCustomTypes(BibDatabaseMode mode) { } else { return customizedTypes.stream() .filter(entryType -> BiblatexEntryTypeDefinitions.ALL.stream().noneMatch(biblatexType -> biblatexType.getType().equals(entryType.getType()))) + .filter(entryType -> BiblatexSoftwareEntryTypeDefinitions.ALL.stream().noneMatch(biblatexSoftware -> biblatexSoftware.getType().equals(entryType.getType()))) .collect(Collectors.toList()); } } diff --git a/src/main/java/org/jabref/model/entry/field/StandardField.java b/src/main/java/org/jabref/model/entry/field/StandardField.java index a79a4208e4b..a6f0a998b5f 100644 --- a/src/main/java/org/jabref/model/entry/field/StandardField.java +++ b/src/main/java/org/jabref/model/entry/field/StandardField.java @@ -55,11 +55,14 @@ public enum StandardField implements Field { FOREWORD("foreword", FieldProperty.PERSON_NAMES), FOLDER("folder"), GENDER("gender", FieldProperty.GENDER), + HALID("hal_id"), + HALVERSION("hal_version"), HOLDER("holder", FieldProperty.PERSON_NAMES), HOWPUBLISHED("howpublished"), IDS("ids", FieldProperty.MULTIPLE_ENTRY_LINK), INSTITUTION("institution"), INTRODUCTION("introduction", FieldProperty.PERSON_NAMES), + INTRODUCEDIN("introducedin"), ISBN("isbn", "ISBN", FieldProperty.ISBN), ISRN("isrn", "ISRN"), ISSN("issn", "ISSN"), @@ -74,6 +77,7 @@ public enum StandardField implements Field { LANGUAGE("language", FieldProperty.LANGUAGE), LABEL("label"), LIBRARY("library"), + LICENSE("license"), LOCATION("location"), MAINSUBTITLE("mainsubtitle", FieldProperty.BOOK_NAME), MAINTITLE("maintitle", FieldProperty.BOOK_NAME), @@ -98,7 +102,10 @@ public enum StandardField implements Field { PUBSTATE("pubstate", FieldProperty.PUBLICATION_STATE), PRIMARYCLASS("primaryclass"), RELATED("related", FieldProperty.MULTIPLE_ENTRY_LINK), + RELATEDTYPE("relatedtype"), + RELATEDSTRING("relatedstring"), REPORTNO("reportno"), + REPOSITORY("repository"), REVIEW("review"), REVISION("revision"), SCHOOL("school"), @@ -109,6 +116,7 @@ public enum StandardField implements Field { SORTKEY("sortkey"), SORTNAME("sortname", FieldProperty.PERSON_NAMES), SUBTITLE("subtitle"), + SWHID("swhid"), TITLE("title"), TITLEADDON("titleaddon"), TRANSLATOR("translator", FieldProperty.PERSON_NAMES), diff --git a/src/main/java/org/jabref/model/entry/types/BiblatexSoftwareEntryTypeDefinitions.java b/src/main/java/org/jabref/model/entry/types/BiblatexSoftwareEntryTypeDefinitions.java new file mode 100644 index 00000000000..0fc48e6d904 --- /dev/null +++ b/src/main/java/org/jabref/model/entry/types/BiblatexSoftwareEntryTypeDefinitions.java @@ -0,0 +1,53 @@ +package org.jabref.model.entry.types; + +import java.util.Arrays; +import java.util.List; + +import org.jabref.model.entry.BibEntryType; +import org.jabref.model.entry.BibEntryTypeBuilder; +import org.jabref.model.entry.field.OrFields; +import org.jabref.model.entry.field.StandardField; + +public class BiblatexSoftwareEntryTypeDefinitions { + private static final BibEntryType SOFTWARE = new BibEntryTypeBuilder() + .withType(StandardEntryType.Software) + .withImportantFields(StandardField.DATE, StandardField.DOI, StandardField.EPRINTTYPE, StandardField.EPRINTCLASS, StandardField.EPRINT, + StandardField.EDITOR, StandardField.FILE, StandardField.HALID, StandardField.HALVERSION, StandardField.INSTITUTION, StandardField.INTRODUCEDIN, + StandardField.LICENSE, StandardField.MONTH, StandardField.NOTE, StandardField.ORGANIZATION, StandardField.PUBLISHER, StandardField.RELATED, + StandardField.RELATEDSTRING, StandardField.REPOSITORY, StandardField.SWHID, StandardField.URLDATE, StandardField.VERSION) + .withRequiredFields(new OrFields(StandardField.AUTHOR, StandardField.EDITOR), StandardField.TITLE, StandardField.URL, StandardField.VERSION, StandardField.YEAR) + .build(); + + private static final BibEntryType SOFTWAREVERSION = new BibEntryTypeBuilder() + .withType(StandardEntryType.SoftwareVersion) + .withImportantFields(StandardField.DATE, StandardField.EPRINTCLASS, StandardField.EPRINTTYPE, StandardField.HALID, StandardField.HALVERSION, + StandardField.INSTITUTION, StandardField.INTRODUCEDIN, StandardField.LICENSE, StandardField.MONTH, StandardField.NOTE, StandardField.ORGANIZATION, + StandardField.PUBLISHER, StandardField.RELATED, StandardField.RELATEDTYPE, StandardField.RELATEDSTRING, + StandardField.REPOSITORY, StandardField.SWHID, StandardField.SUBTITLE, StandardField.URLDATE) + .withRequiredFields(new OrFields(StandardField.AUTHOR, StandardField.EDITOR), StandardField.TITLE, StandardField.URL, StandardField.YEAR, StandardField.VERSION) + .withDetailFields(StandardField.DATE, StandardField.EPRINTCLASS, StandardField.EPRINTTYPE, StandardField.HALID, StandardField.HALVERSION, + StandardField.INSTITUTION, StandardField.INTRODUCEDIN, StandardField.LICENSE, StandardField.MONTH, StandardField.NOTE, StandardField.ORGANIZATION, + StandardField.PUBLISHER, StandardField.RELATED, StandardField.RELATEDTYPE, StandardField.RELATEDSTRING, + StandardField.REPOSITORY, StandardField.SWHID, StandardField.SUBTITLE, StandardField.URLDATE) + .withRequiredFields(new OrFields(StandardField.AUTHOR, StandardField.EDITOR), StandardField.TITLE, StandardField.URL, StandardField.YEAR) + .build(); + private static final BibEntryType SOFTWAREMODULE = new BibEntryTypeBuilder() + .withType(StandardEntryType.SoftwareModule) + .withImportantFields(StandardField.DATE, StandardField.DOI, StandardField.EPRINTTYPE, StandardField.EPRINTCLASS, StandardField.EPRINT, + StandardField.EDITOR, StandardField.FILE, StandardField.HALID, StandardField.HALVERSION, StandardField.INSTITUTION, StandardField.INTRODUCEDIN, + StandardField.LICENSE, StandardField.MONTH, StandardField.NOTE, StandardField.ORGANIZATION, StandardField.PUBLISHER, StandardField.RELATED, + StandardField.RELATEDSTRING, StandardField.REPOSITORY, StandardField.SWHID, StandardField.URLDATE, StandardField.VERSION) + .withRequiredFields(StandardField.AUTHOR, StandardField.SUBTITLE, StandardField.URL, StandardField.YEAR) + .build(); + + private static final BibEntryType CODEFRAGMENT = new BibEntryTypeBuilder() + .withType(StandardEntryType.CodeFragment) + .withImportantFields(StandardField.DATE, StandardField.DOI, StandardField.EPRINTTYPE, StandardField.EPRINTCLASS, StandardField.EPRINT, + StandardField.EDITOR, StandardField.FILE, StandardField.HALID, StandardField.HALVERSION, StandardField.INSTITUTION, StandardField.INTRODUCEDIN, + StandardField.LICENSE, StandardField.MONTH, StandardField.NOTE, StandardField.ORGANIZATION, StandardField.PUBLISHER, StandardField.RELATED, + StandardField.RELATEDSTRING, StandardField.REPOSITORY, StandardField.SWHID, StandardField.URLDATE, StandardField.VERSION) + .withRequiredFields(StandardField.URL) + .build(); + + public static final List ALL = Arrays.asList(SOFTWAREVERSION, SOFTWARE, SOFTWAREMODULE, CODEFRAGMENT); +} diff --git a/src/main/java/org/jabref/model/entry/types/StandardEntryType.java b/src/main/java/org/jabref/model/entry/types/StandardEntryType.java index 6f6f91ac6a5..fb2922e61a0 100644 --- a/src/main/java/org/jabref/model/entry/types/StandardEntryType.java +++ b/src/main/java/org/jabref/model/entry/types/StandardEntryType.java @@ -36,7 +36,10 @@ public enum StandardEntryType implements EntryType { Thesis("Thesis"), WWW("WWW"), Software("Software"), - Dataset("Dataset"); + Dataset("Dataset"), + SoftwareVersion("SoftwareVersion"), + SoftwareModule("SoftwareModule"), + CodeFragment("CodeFragment"); private final String displayName; diff --git a/src/test/resources/testbib/biblatex-software.bib b/src/test/resources/testbib/biblatex-software.bib new file mode 100644 index 00000000000..b8b45a2e8ea --- /dev/null +++ b/src/test/resources/testbib/biblatex-software.bib @@ -0,0 +1,101 @@ +@softwareversion {delebecque:hal-02090402-condensed, + title = {Scilab}, + author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice + and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe}, + url = {https://www.scilab.org/}, + date = {1994-01}, + file = {https://hal.inria.fr/hal-02090402/file/scilab-1.1.tar.gz}, + institution = {Inria}, + license = {Scilab license}, + hal_id = {hal-02090402}, + hal_version = {v1}, + swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a; + origin=https://hal.archives-ouvertes.fr/hal-02090402}, + version = {1.1}, + note = {First Scilab version. It was distributed by anonymous ftp.}, + repository= {https://github.com/scilab/scilab}, + abstract = {Software for Numerical Computation freely distributed.} +} + +@software {delebecque:hal-02090402, + title = {Scilab}, + author = {Delebecque, Fran{\c c}ois and Gomez, Claude and Goursat, Maurice + and Nikoukhah, Ramine and Steer, Serge and Chancelier, Jean-Philippe}, + date = {1994}, + institution = {Inria}, + license = {Scilab license}, + hal_id = {hal-02090402}, + hal_version = {v1}, + url = {https://www.scilab.org/}, + abstract = {Software for Numerical Computation freely distributed.}, + repository= {https://github.com/scilab/scilab}, +} + +@softwareversion {delebecque:hal-02090402v1, + version = {1.1}, + date = {1994-01}, + file = {https://hal.inria.fr/hal-02090402/file/scilab-1.1.tar.gz}, + swhid = {swh:1:dir:1ba0b67b5d0c8f10961d878d91ae9d6e499d746a; + origin=https://hal.archives-ouvertes.fr/hal-02090402}, + note = {First Scilab version. It was distributed by anonymous ftp.}, + crossref = {delebecque:hal-02090402} +} + + @software {cgal, + title = {The Computational Geometry Algorithms Library}, + author = {{The CGAL Project}}, + editor = {{CGAL Editorial Board}}, + date = {1996}, + url = {https://cgal.org/} + } + + @softwareversion{cgal:5-0-2, + crossref = {cgal}, + version = {{5.0.2}}, + url = {https://docs.cgal.org/5.02}, + date = {2020}, + swhid = {swh:1:rel:636541bbf6c77863908eae744610a3d91fa58855; + origin=https://github.com/CGAL/cgal/} + } + + @softwaremodule{cgal:lp-gi-20a, + crossref = {cgal:5-0-2}, + author = {Menelaos Karavelas}, + subtitle = {{2D} Voronoi Diagram Adaptor}, + license = {GPL}, + introducedin = {cgal:3-1}, + url = {https://doc.cgal.org/5.0.2/Manual/packages.html#PkgVoronoiDiagram2}, + } + + @softwaremodule{cgal:lp-gi-20a-condensed, + title = {The Computational Geometry Algorithms Library}, + subtitle = {{2D} Voronoi Diagram Adaptor}, + author = {Menelaos Karavelas}, + editor = {{CGAL Editorial Board}}, + license = {GPL}, + version = {{5.0.2}}, + introducedin = {cgal:3-1}, + date = {2020}, + swhid = {swh:1:rel:636541bbf6c77863908eae744610a3d91fa58855; + origin=https://github.com/CGAL/cgal/}, + url = {https://doc.cgal.org/5.0.2/Manual/packages.html#PkgVoronoiDiagram2}, + } + +@software {parmap, + title = {The Parmap library}, + author = {Di Cosmo, Roberto and Marco Danelutto}, + date = {2020}, + version = {1.1.1}, + institution = {{Inria} and {University of Paris} and {University of Pisa}}, + license = {LGPL-2.0}, + url = {https://rdicosmo.github.io/parmap/}, + repository= {https://github.com/rdicosmo/parmap}, +} + +@codefragment {simplemapper, + subtitle = {Core mapping routine}, + swhid = {swh:1:cnt:43a6b232768017b03da934ba22d9cc3f2726a6c5; + lines=192-228; + origin=https://github.com/rdicosmo/parmap}, + crossref = {parmap} +}