Skip to content

Commit

Permalink
[6574] Added support for biblatex-software
Browse files Browse the repository at this point in the history
Added change to changelog

 md checkstyle fixed

checkstyle fixed
  • Loading branch information
hemantgs committed Aug 10, 2020
1 parent 7d66c25 commit 7f8df6b
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

### Changed

Expand Down
49 changes: 49 additions & 0 deletions docs/adr/0013-add-native-support-biblatex-software.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# \[Added Native Support for BibLatex-Sotware\]

* Status: Proposed
* 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 comen , native support would be helpful.


## Decision Drivers

* The new entry types definitions should be added to the Select Entry Pane and be separated by a divider
* None of the existing flows should be impacted

## Considered Options

* Adding the new entry types to the existing biblatex types , but it conflicted with an already existing type(software)
* Add a divider with label Biblatex-Software underwhich 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: Yet to be decided.

### 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, since ther 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

*
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/EntryType.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
<FlowPane fx:id="biblatexPane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="biblatexSoftwareTitlePane" animated="false" collapsible="false" text="Biblatex-Software">
<content>
<FlowPane fx:id="biblatexSoftwarePane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="bibTexTitlePane" animated="false" collapsible="false" text="BibTeX">
<content>
<FlowPane fx:id="bibTexPane" prefHeight="200.0" prefWidth="200.0"/>
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -52,10 +55,12 @@ public class EntryTypeView extends BaseDialog<EntryType> {
@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;

Expand Down Expand Up @@ -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);
Expand All @@ -155,6 +162,7 @@ public void initialize() {
}
} else {
biblatexTitlePane.setVisible(false);
biblatexSoftwareTitlePane.setVisible(false);
addEntriesToPane(bibTexPane, BibtexEntryTypeDefinitions.ALL);
addEntriesToPane(ieeetranPane, IEEETranEntryTypeDefinitions.ALL);

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/model/database/BibDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public class BibDatabase {
private String epilog = "";
private String sharedDatabaseID;

public BibDatabase() {
this.registerListener(new KeyChangeListener(this));
}

public BibDatabase(List<BibEntry> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
}
Expand Down Expand Up @@ -97,6 +98,7 @@ public List<BibEntryType> 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());
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/jabref/model/entry/field/StandardField.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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),
Expand All @@ -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"),
Expand All @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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<BibEntryType> ALL = Arrays.asList(SOFTWAREVERSION, SOFTWARE, SOFTWAREMODULE, CODEFRAGMENT);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
97 changes: 97 additions & 0 deletions src/test/resources/testbib/biblatex-software.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@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}
}

0 comments on commit 7f8df6b

Please sign in to comment.