Skip to content

Commit

Permalink
Merge pull request #10189 from JabRef/gvk
Browse files Browse the repository at this point in the history
Fix GVK Fetcher url
  • Loading branch information
Siedlerchr authored Aug 20, 2023
2 parents 5656412 + 21e8e72 commit 2baae9c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We now encrypt and store the custom API keys in the OS native credential store. [#10044](https://github.com/JabRef/jabref/issues/10044)
- We changed the behavior of group addition/edit, so that sorting by alphabetical order is not performed by default after the modification [#10017](https://github.com/JabRef/jabref/issues/10017)
- We fixed an issue with spacing in the cleanup dialogue. [#10081](https://github.com/JabRef/jabref/issues/10081)
- The GVK fetcher now uses the new [K10plus](https://www.bszgbv.de/services/k10plus/) database [#10189](https://github.com/JabRef/jabref/pull/10189)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class GvkFetcher implements SearchBasedParserFetcher {

private static final String URL_PATTERN = "http://sru.gbv.de/gvk?";
private static final String URL_PATTERN = "https://sru.k10plus.de/gvk?";

/**
* Searchkeys are used to specify a search request. For example "tit" stands for "title".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ private String getSubfield(String a, Element datafield) {
List<Element> liste = getChildren("subfield", datafield);

for (Element subfield : liste) {
if (subfield.getAttribute("code").equals(a)) {
if (subfield.getAttribute("code").equalsIgnoreCase(a)) {
return subfield.getTextContent();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public void setUp() {
.withField(StandardField.FILE, "ParsedFileField{description='', link='http://search.ebscohost.com/login.aspx?direct=true&scope=site&db=nlebk&db=nlabk&AN=1906353', fileType='PDF'}")
.withField(StandardField.ISBN, "9783960886402")
.withField(StandardField.KEYWORDS, "Klassen, Interfaces, Generics, Enums, Annotationen, Lambdas, Streams, Module, parallel, Parallele Programmierung, Serialisierung, funktional, funktionale Programmierung, Java EE, Jakarta EE")
.withField(StandardField.LOCATION, "Heidelberg")
.withField(StandardField.ADDRESS, "Heidelberg")
.withField(StandardField.PAGETOTAL, "396")
.withField(StandardField.PUBLISHER, "{dpunkt.verlag} and {Dpunkt. Verlag (Heidelberg)}");

bibEntryISBN0134685997 = new BibEntry(StandardEntryType.Misc)
Expand All @@ -62,7 +63,8 @@ public void setUp() {
.withField(StandardField.TITLEADDON, "Joshua Bloch")
.withField(StandardField.EDITION, "Third edition")
.withField(StandardField.ISBN, "0134685997")
.withField(StandardField.LOCATION, "Boston")
.withField(StandardField.PAGETOTAL, "392")
.withField(StandardField.ADDRESS, "Boston")
.withField(StandardField.PUBLISHER, "{Addison-Wesley}");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public void setUp() {
.withField(StandardField.PUBLISHER, "Addison-Wesley")
.withField(StandardField.YEAR, "2008")
.withField(StandardField.AUTHOR, "Joshua Bloch")
.withField(StandardField.SERIES, "The @Java series")
.withField(StandardField.ADDRESS, "Upper Saddle River, NJ [u.a.]")
.withField(StandardField.SERIES, "The Java series ... from the source")
.withField(StandardField.ADDRESS, "Upper Saddle River, NJ")
.withField(StandardField.EDITION, "2. ed., 5. print.")
.withField(StandardField.NOTE, "Literaturverz. S. 321 - 325")
.withField(StandardField.NOTE, "Includes bibliographical references and index. - Previous ed.: 2001. - Hier auch später erschienene, unveränderte Nachdrucke")
.withField(StandardField.ISBN, "9780321356680")
.withField(StandardField.PAGETOTAL, "XXI, 346")
.withField(new UnknownField("ppn_gvk"), "591166003")
Expand Down Expand Up @@ -67,15 +67,15 @@ public void simpleSearchQueryURLCorrect() throws Exception {
String query = "java jdk";
QueryNode luceneQuery = new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD);
URL url = fetcher.getURLForQuery(luceneQuery);
assertEquals("http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.all%3Djava+and+pica.all%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
assertEquals("https://sru.k10plus.de/gvk?version=1.1&operation=searchRetrieve&query=pica.all%3Djava+and+pica.all%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
}

@Test
public void complexSearchQueryURLCorrect() throws Exception {
String query = "kon:java tit:jdk";
QueryNode luceneQuery = new StandardSyntaxParser().parse(query, AbstractQueryTransformer.NO_EXPLICIT_FIELD);
URL url = fetcher.getURLForQuery(luceneQuery);
assertEquals("http://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.kon%3Djava+and+pica.tit%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
assertEquals("https://sru.k10plus.de/gvk?version=1.1&operation=searchRetrieve&query=pica.kon%3Djava+and+pica.tit%3Djdk&maximumRecords=50&recordSchema=picaxml&sortKeys=Year%2C%2C1", url.toString());
}

@Test
Expand Down

0 comments on commit 2baae9c

Please sign in to comment.