Skip to content

Integration Mr. DLib#2189

Merged
lenhard merged 51 commits into
JabRef:masterfrom
BeelGroup:master
Feb 15, 2017
Merged

Integration Mr. DLib#2189
lenhard merged 51 commits into
JabRef:masterfrom
BeelGroup:master

Conversation

@stefanfeyer

@stefanfeyer stefanfeyer commented Oct 24, 2016

Copy link
Copy Markdown
Contributor

Integration of the recommendersystem Mr. DLib

Reason for pull request

We from Mr. DLib would like to integrate a recommendation system into JabRef. We believe that both sides will benefit from this.
This pull request is the basis for further and deeper discussion of what is the right way to implement this feature.

Changes made to JabRef

A new tab in the EntryEditor is added on the very right with a small MDL icon. A loading screen is shown in this tab while a Thread makes a request to the RESTful webservice of Mr. DLib. With the received response, a SAX parser parses the XML the response contains. Currently the html-code inside this XML is taken to display the six recommendations received from the server.
If you want to have a look how the XML delivered by the server please click the following link: https://api-dev.mr-dlib.org/v1/documents/gesis-smarth-0000003299/related_documents/

Notes

Please note, that this is only an example recommendations, the server-structure for handling the request is in implementation. Once this done, the title of the selected Item represents the request and based on this MR DLib will respond with matching articles.

Please note, that the appearance is only a suggestion. We are open and pleased for further input.

Please note, that code style is up to change. If you have improvements, they are all welcome.

A bug i couldn't deal with is, that the new "Related Articles" tab I created is only called up to 5 times. After that it don't get updated. It would be very helpful if someone could give me a hint where I have a mistake in my mental model of JabRef.

Current screenshot

jabref_screenshot_mdl_new

  • [no] Change in CHANGELOG.md described
  • [no] Tests created for changes
  • [yes] Screenshots added (for bigger UI changes)
  • [yes] Manually tested changed features in running JabRef
  • [yes] Check documentation status (Issue created for outdated help page at help.jabref.org?)
  • [-] If you changed the localization: Did you run gradle localizationUpdate?

I'm aware that gradlew check failed at:
BibtexDatabaseWriterTest. roundtrip
BibtexDatabaseWriterTest. roundtripWithUserComment
BibtexDatabaseWriterTest. roundtripWithUserCommentAndEntryChange
BibtexDatabaseWriterTest. roundtripWithUserCommentBeforeStringAndChange
AstrophysicsDataSystemTest. testPerformSearchByFamaeyMcGaughEntry
zbMATHTest. searchByQueryFindsEntry
LocalizationConsistencyTest. findMissingLocalizationKeys
XMPUtilTest. testCommandLineSeveral

I will check if this is caused by my work.
Kind regards, Stefan Feyer

@lenhard lenhard added [outdated] type: feature status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers mr.dlib labels Oct 24, 2016

@lenhard lenhard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! I added comments at a few places in your code. I know this is a prototype and not the final solution to be merged. I commented several details nevertheless to give you an impression of what you need to look out for.

For some weird reason, the travis build did not kick of for your branch. @JabRef/developers We need to look into this. A successful travis build is an absolute requirement. All tests should be successful and the AstrophysicsDataSystemTest should already work if you merge the current master into this branch (please do that). The LocalizationConsistencyTest fails because you used new localizations in your code, but did not add them to the localization files. All other tests also need to work, most importantly the BibtexDatabaseWriterTest. What counts, in the end, is the result of the travis build.

There are some architectural things to improve in your code. Not all code should go into gui, but the code should be nicely separated with a proper separation of concerns.

Unfortunately, I get a 404 when clicking your link above, so I cannot see your sample XML.

I cannot give you a very good hint regarding the update bug, unfortunately. However, things might be fixed when you hook into the threading model used by JabRef instead of a standalone thread.

You generated the distributed code using glassfish, right? As indicated in my comments, parts of that will need to be rewritten using unirest.

Regarding the content of the tab: As you know from the forum, we are not really happy with just transmitting HTML. Ultimately, whatever format you get back from the server, that data should be parsed into a collection of BibEntry. So a nicely parseable format would be of great advantage and JabRef already provides a number of parsers for the most important data formats. You can of course introduce a custom format, but then you would need to write the parser. Anyway, the resulting list of BibEntry could then be nicely layouted in the tab, which may of course also include some HTML, but this would need to be built on the side of JabRef. Please note that we are currently integrating JavaFX, so you will have quite advanced features at hand. When we have such a list of BibEntry, we can also build all kinds of nice integrating features with the rest of JabRef.

Finally, some thoughts from myself regarding aspects from the forum post: I understand that you want to be as flexible as possible and not link too deeply into the JabRef code. At the same time, we do not want to give away control of how the related articles tab looks at runtime. At the very least, we want to be able to sign off visual changes there. A relatively straight forward solution to this might a new library. You could move your parsing and layouting code into that library and keep it completely separate from JabRef. On the JabRef side, you would integrate the code exactly once (by, say, creating a MrDlibPane and a MrDlibFetcher at the right places) and we would include the library into our dependencies. Once uploaded to jcenter, you could update the visualization whenever you feel like and all we would have to do would be to upgrade the version number in our gradle file. In theory, this could keep everything nicely separate. You would not have to know too much about JabRef code, would be flexible, we would have a last say on our layout, and we would not have to fix and correct your visualization code when something breaks. What do you think?

More input from @JabRef/developers is also very welcome!

Comment thread build.gradle Outdated
compile 'org.mozilla:rhino:1.7.7.1'

// communication with Mr. DLib
compile 'org.glassfish.jersey.core:jersey-client:2.23.2'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the PR correctly, you use glassfish for REST calls, right? We already have the following dependency for REST support: 'com.mashape.unirest:unirest-java:1.4.9'

Since there is (hopefully) no need for two different REST libraries, please use the one we already have.

title = entry.getField("title").toString().replaceAll("\\{|\\[|\\]|\\}|(Optional)", "");

//localization is not yet set
relatedArticlePanel.setName(Localization.lang("Related articles"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add a new localization entry, you also have to add the entry to the localization files. Here is an explanation how this works: https://github.com/JabRef/jabref/wiki/Code-Howtos#using-localization-correctly


//Starting the Thread that makes the request to the server
Thread t = new Thread(relatedArticleTab);
t.start();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get multi-threading, you will need to hook into the parallelization framework we have in place. Have a look at AbstractWorker or maybe FindFullTextAction as an example.

We use a more or less centrally managed threading framework to make sure we can control it properly (choosing an appropriate thread pool). Moveover, spawning off threads at all levels and code is just a premier recipe for dead locking


//TODO native component, check: how does it work
tabbed.addTab(Localization.lang("Related articles"), IconTheme.getImage("mdl"),
relatedArticlePanel, Localization.lang("Show/edit Related articles"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding localization, see above.

*Works only 5 times. TODO: Check why
*
*/
public class EntryEditorTabRelatedArticles extends JEditorPane implements Runnable {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class does multiple things: GUI-related aspects and fetching of data. This should be separated. Please have a look at our architecture: https://github.com/JabRef/jabref/wiki/High-Level-Documentation

While your gui-related code should of course stay in the gui package. The code related to fetching data should go into an appropriate part of logic.

public void run() {
System.out.println("----- Thread Started -----");
try {
SSLContext sc = SSLContext.getInstance("TLSv1");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the following is just a dummy implementation of a certificate validation and should be replaced by a proper one in the end.

* Sets the default content. Like a "loading screen".
* With a gif as animation (gif is only a placeholder and can be adjusted at any time).
*/
private void setDefaultContent() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is quite a lot of potential for refactoring in this method, which can be subdivided into a number of small methods.


} catch (NoSuchAlgorithmException e) {
System.out.println("NoSuchAlgorithmException");
e.printStackTrace();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same fashion as there should be no sysouts in the code, e.printStackTrace() is equally an absolute no-go. This should also be turned into logging.

}

//Parsing the response with a SAX parser
try {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content parsing should be extracted into a new class.

this.htmlContent = htmlContent;
}

}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I cannot comment on the following file, I'll leave a comment here: gifs should not be located in the source tree. They should go into resources.

@lenhard

lenhard commented Oct 26, 2016

Copy link
Copy Markdown
Member

After thinking about the design some more, I came to the conclusion that the data transmission between Mr.DLib and JabRef should be implemented as a fetcher. After all, what we want to do is to transmit a search string and get back a collection of bibliographic data. That is exactly what we already have implemented in our fetcher framework and a variety of SearchBasedFetcher, see: https://github.com/JabRef/jabref/blob/master/src/main/java/net/sf/jabref/logic/importer/SearchBasedFetcher.java

If you reuse this infrastructure, it will be quite easy to integrate Mr.DLib in various other places of JabRef as well, such as the web fetch dialog. Essentially, this should work out of the box. It would be possible to access MrDLib in the same fashion as Google Scholar, IEEExplore, the ACM digital library, etc.

A MrDLibFetcher could easily be reused in gui part to display the results in a nice panel and we would have a proper separation of concerns.

@tobiasdiez

Copy link
Copy Markdown
Member

I strongly agree with @lenhard! The implementation as a fetcher would be ideal. Probably not as a SearchFetcher but as a kind of hybrid with FulltextFetcher: insert a BibEntry (or a bunch of them?) and get a list of BibEntry (the recommendations). This should be the only place in JabRef which knows about MrDLIB. The presentation of the recommended BibEntries can then happen via the Layouter (similar to the entry preview) or by implementing a new user interface (recommended).

@tobiasdiez tobiasdiez removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 26, 2016
@koppor

koppor commented Oct 28, 2016

Copy link
Copy Markdown
Member

Just to provide two-way linking: Discussion on discourse: http://discourse.jabref.org/t/integrating-related-articles-from-mrdlib-into-jabref/240/34

@lenhard

lenhard commented Oct 28, 2016

Copy link
Copy Markdown
Member

So just to document what we have decided in the call: The MrDLib team will implement a fetcher for MrDLib and take care about transforming whatever format they provide into BibEntries. Custom MrDLib fields will just be stored as fields in a BibEntry, which should work easily as BibEntries allow for basically any field name. On the GUI side, the related articles tab will invoke the fetcher, get a collection of entries and display those entries as a list of labels or panels or the like. These GUI elements will display the MrDLib HTML representation that is stored in a custom field of the entry (providing flexibility to the MrDLib team) and it will be possible to provide additional JabRef integration to the elements, as the bibliographic data is also available in the regular BibTeX fields.

@tobiasdiez Could you please provide some guidance as to how to best implement parallelism for the invocation of the fetcher in the gui?

@stefanfeyer

Copy link
Copy Markdown
Contributor Author

@lenhard you suggested a to implement a SearchBasedFetcher. Beside that, is a class SearchBasedParserFetcher what seems represent what we are trying to achieve:
/**

  • Provides a convenient interface for search-based fetcher, which follow the usual three-step procedure:
    1. Open a URL based on the search query
    1. Parse the response to get a list of {@link BibEntry}
    1. Post-process fetched entries
      */

Should I implement this class or stick to the SearchBasedFetcher

@tobiasdiez

tobiasdiez commented Nov 1, 2016

Copy link
Copy Markdown
Member

In general SearchBasedParserFetcher is fine to use. However, it might be better to create a completely new interface RecommendationFetcher which is kind of a hybrid between the SearchBasedFetcher and the FulltextFetcher:

  • you want to pass a BibEntry to the fetcher (and not a query as for the SearchBasedFetcher)
  • you want to get a list of BibEntry as a return (and not a single BibEntry as for the FulltextFetcher).

The semantics are also more clear with a new interface.

@lenhard

lenhard commented Nov 1, 2016

Copy link
Copy Markdown
Member

Now @tobiasdiez beat me in answering speed :-) But why not just reuse an EntryBasedParserFetcher? @tobiasdiez Is that not exactly what you describe? You enter an entire entry for building the query and get a List<BibEntry> back?

@stefanfeyer You can also reuse the Parser part the you find in the other fetchers. The code that transforms the result returned by MrDLib would then go into an implementation of a Parser that would be placed in logic.import.fileformat (a package in parallel to the fetcher package) and you can use such a parser in your new fetcher. This structure nicely separates getting the data from interpreting the data.

On an additional note, it seems that the parallelism part for the fetchers is not as sophisticated as I had hoped. The current fetching mechanism is implemented via a SwingWorker and you can find an example for its usage for fetching in net.sf.jabref.gui.EntryTypeDialog.FetcherWorker. You should parallelize the invocation of the fetcher in the related articles tab in a similar fashion.

@tobiasdiez

Copy link
Copy Markdown
Member

@lenhard oh, I forgot about the EntryBasedFetcher. You are right that it provides a method with the right signature. However, its purpose is actually a bit different, namely find possible hits in the online db which are matched by this entry (can be used to complete bibliographic information). Not sure if it is worth the hassle to create a new interface RecommendationFetcher in order to have a semantic distinction.

@lenhard

lenhard commented Nov 1, 2016

Copy link
Copy Markdown
Member

Well, as we are not actually planning to integrate more recommender systems, I would say a second interface that duplicates the functionality is not really needed. I think @stefanfeyer should go for the EntryBasedParserFetcher now. If, at a later point in time, we feel that we need another interface to better distinguish the semantics, introducing one will be easy and can be done by extending, but without having to rewrite code.

@koppor koppor changed the title Integration Mr. DLib [WIP] Integration Mr. DLib Nov 3, 2016
@stefanfeyer

Copy link
Copy Markdown
Contributor Author

Dear JabRef Team,
I restructured the implementation of the integration of Mr. DLib. This commit is mostly therefor, that you are up to date with the latest developments. I would like to have an confirmation, that the structure meets what we agreed on. Should I make a new PR for that?

Kind Regards, Stefan Feyer

Comment thread build.gradle Outdated
// need to use snapshots as the stable version is from 2013 and doesn't support v1.0.1 CitationStyles
compile 'org.citationstyles:styles:1.0.1-SNAPSHOT'
compile 'org.citationstyles:locales:1.0.1-SNAPSHOT'
compile 'de.undercouch:citeproc-java:0.6'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We is this needed as we are already using 1.0.0-SNAPSHOT (see line 125/132)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt change sth in this gradle file, i just deleted my dependency i added last time. it should be the original from your master branch. i will investigate why there is a change, this is not with purpose.

* @return
*/
private String formatTitleFromBibEntry(BibEntry selectedEntry) {
return selectedEntry.getField("title").toString().replaceAll("\\{|\\[|\\]|\\}|(Optional)", "");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matthiasgeiger

Copy link
Copy Markdown
Member

Hi Stefan,
reusing this PR is fine.

Without going into the details of the code: Generally the fetcher itself is following the correct approach.

However, letting the fetcher implement SwingWorker directly is not possible as it breaks architectural constraints: Classes in package net.sf.jabref.logic are not allowed to use any UI-related stuff. (This is also indicated by the failing test at TravisCI).

As I have not participated in the calls I'm not sure whether this was a topic. But another aspect which is critical for me is that in my opinion loading the related entries should NOT be performed upon opening an EntryEditor but at the time of switching to the "Related Entries" tab. Two reasons: 1. Efficiency on just cycling through without being interested in the related entries. 2. Privacy of our users.

Regards
Matthias

@lenhard

lenhard commented Nov 11, 2016

Copy link
Copy Markdown
Member

Just a few additions to the comment by @matthiasgeiger (which is entirely correct): The code relating to the SwingWorker should move into the gui package and then reuse the implementation of the fetcher (as discussed earlier: separation of concerns). This is indicated in the failing tests.

In the calls, we did not really talk about when the fetcher should be invoked. @matthiasgeiger is correct of course: Doing this in the background for all entries would be a significant privacy invasion. It should happen when a user clicks on the related article tab (indicating his or her will to view related articles). Hence, an action that fires when the related articles tab becomes selected that triggers the SwingWorker would probably be best. Needless to say, the query should be sent once. There is no need to re-query for selected articles if the results are already in.

@Siedlerchr

Siedlerchr commented Jan 30, 2017 via email

Copy link
Copy Markdown
Member

@koppor

koppor commented Jan 30, 2017

Copy link
Copy Markdown
Member

No SSL error with java version "1.8.0_111". I install java using choco install jre8 jdk8. And I keep it updated using choco upgrade all

@lenhard

lenhard commented Jan 30, 2017

Copy link
Copy Markdown
Member

Ok, I can confirm that this depends on the Java runtime. I just installed JDK 8u121 and the SSL error is gone. It is fine to require the most recent version of Java, but that means that a lot of users will run into this problem. Maybe we should catch SSLHandshakeException explicitly and if it occurs display a message in the panel that reads: "To use the feature, update Java", or something similar?

I went through my list a little with the related articles tab and sometimes I get such an exception for an entry. In this case, the related articles tab is just empty:

Could not copy input
java.io.FileNotFoundException: https://api-dev.mr-dlib.org/v1/documents/Windows%20Workflow%20Foundation%20(WF4)%20%20Introduction%20to%20State%20Machine%20Hands%20On%20Lab/related_documents?partner_id=jabref&app_id=jabref_desktop&app_version=*unknown*&app_lang=en
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at net.sf.jabref.logic.net.URLDownload.downloadToString(URLDownload.java:153)
	at net.sf.jabref.logic.importer.fetcher.MrDLibFetcher.makeServerRequest(MrDLibFetcher.java:83)
	at net.sf.jabref.logic.importer.fetcher.MrDLibFetcher.performSearch(MrDLibFetcher.java:53)
	at net.sf.jabref.gui.entryeditor.EntryEditorTabRelatedArticles$MrDLibFetcherWorker.doInBackground(EntryEditorTabRelatedArticles.java:179)
	at net.sf.jabref.gui.entryeditor.EntryEditorTabRelatedArticles$MrDLibFetcherWorker.doInBackground(EntryEditorTabRelatedArticles.java:166)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at javax.swing.SwingWorker.run(SwingWorker.java:334)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: https://api-dev.mr-dlib.org/v1/documents/Windows%20Workflow%20Foundation%20(WF4)%20%20Introduction%20to%20State%20Machine%20Hands%20On%20Lab/related_documents?partner_id=jabref&app_id=jabref_desktop&app_version=*unknown*&app_lang=en
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
	at net.sf.jabref.logic.net.URLDownload.openConnection(URLDownload.java:126)
	... 11 more

No localized message exception message defined. Falling back to getMessage().
net.sf.jabref.logic.importer.FetcherException: Problem downloading
java.util.concurrent.ExecutionException: net.sf.jabref.logic.importer.FetcherException: Problem downloading
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at javax.swing.SwingWorker.get(SwingWorker.java:602)
	at net.sf.jabref.gui.entryeditor.EntryEditorTabRelatedArticles.lambda$requestRecommendations$1(EntryEditorTabRelatedArticles.java:150)
	at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
	at javax.swing.SwingWorker$SwingWorkerPropertyChangeSupport.firePropertyChange(SwingWorker.java:854)
	at javax.swing.SwingWorker$SwingWorkerPropertyChangeSupport$1.run(SwingWorker.java:860)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
	at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
	at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
	at javax.swing.Timer.fireActionPerformed(Timer.java:313)
	at javax.swing.Timer$DoPostEvent.run(Timer.java:245)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: net.sf.jabref.logic.importer.FetcherException: Problem downloading
	at net.sf.jabref.logic.importer.fetcher.MrDLibFetcher.makeServerRequest(MrDLibFetcher.java:90)
	at net.sf.jabref.logic.importer.fetcher.MrDLibFetcher.performSearch(MrDLibFetcher.java:53)
	at net.sf.jabref.gui.entryeditor.EntryEditorTabRelatedArticles$MrDLibFetcherWorker.doInBackground(EntryEditorTabRelatedArticles.java:179)
	at net.sf.jabref.gui.entryeditor.EntryEditorTabRelatedArticles$MrDLibFetcherWorker.doInBackground(EntryEditorTabRelatedArticles.java:166)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at javax.swing.SwingWorker.run(SwingWorker.java:334)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: https://api-dev.mr-dlib.org/v1/documents/Windows%20Workflow%20Foundation%20(WF4)%20%20Introduction%20to%20State%20Machine%20Hands%20On%20Lab/related_documents?partner_id=jabref&app_id=jabref_desktop&app_version=*unknown*&app_lang=en
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1921)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1920)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1490)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
	at net.sf.jabref.logic.net.URLDownload.downloadToString(URLDownload.java:153)
	at net.sf.jabref.logic.importer.fetcher.MrDLibFetcher.makeServerRequest(MrDLibFetcher.java:83)
	... 9 more
Caused by: java.io.FileNotFoundException: https://api-dev.mr-dlib.org/v1/documents/Windows%20Workflow%20Foundation%20(WF4)%20%20Introduction%20to%20State%20Machine%20Hands%20On%20Lab/related_documents?partner_id=jabref&app_id=jabref_desktop&app_version=*unknown*&app_lang=en
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1872)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
	at net.sf.jabref.logic.net.URLDownload.openConnection(URLDownload.java:126)
	... 11 more

Also, I have to say that, similar as for @koppor, I have the feeling that there is no relation whatsoever between the articles recommended in the related articles tab and my actual entries. Honestly, if I saw these recommendations as a user I would want to turn of the feature as quickly as possible. Sorry for the harsh description, this is not meant to trash MrDLib, but this is what I would think as a user.

EDIT: Many of the recommendations for my (completely english) reference list in computer science seem to be german articles from law magazines. That is profoundly weird.

@koppor

koppor commented Jan 30, 2017

Copy link
Copy Markdown
Member

With "Recommendations totally out of scope" I meant that the recommended papers are not fitting the area of the original paper at all. They are computer science, but not in the field of business process management or related areas.

@stefanfeyer

Copy link
Copy Markdown
Contributor Author

@koppor we are working on that :)
reason:
atm dev server has only access to 6 Million papers from gesis/sowiport, which is mainly social sciences.
atm the import is running with additional 20 Million papers from the core-database. This should have been finished last year. But our server was too slow. We bought a new one and go on with it. There are still 5 Million left, but this will be finished soon. After that we will not facing this scope problem anymore.

@lenhard

lenhard commented Jan 30, 2017

Copy link
Copy Markdown
Member

@stefanfeyer On a positive note: The replies from MrDLib come in very quickly :-)

@tobiasdiez

Copy link
Copy Markdown
Member

Just implement the fix suggested in #2189 (comment) and it should work also under older java runtimes. And because 101 was released only last summer, I think there are a lot of users which have not yet updated to it.

@stefanfeyer

Copy link
Copy Markdown
Contributor Author

I implemented the fix. And reselved the errors from the test where possible.
Is there anything left to to?

Why couldn't I add a help page? Or if that is not suitable, where to put it in the help page?

@koppor

koppor commented Feb 6, 2017

Copy link
Copy Markdown
Member

I don't understand "Why couldn't I add a help page?". Isn't https://github.com/JabRef/help.jabref.org/blob/gh-pages/CONTRIBUTING.md helpful? I would suggest adding a screenshot to https://help.jabref.org/en/EntryEditor and explain the new tab in a new section in that help file.

@lenhard lenhard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have played around some more with the current status and the exceptions mentioned above are gone. The tab presents articles for all entries that I tested, so overall it is functional. The recommendations are unfortunately still unrelated to my entries, but I hope this will change.

Have a look at the travis-ci build: You still have checkstyle errors (wrong sort order of import statements). This needs to be fixed. Also, please add the german localization for your PR and for any other languages that you are speaking.


public void fixSSLVerification() {

LOGGER.warn("Fix SSL exception by accepting ALL certificates");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints a message into the log file every time the method is called. Please reduce the log level to debug.

@stefanfeyer

Copy link
Copy Markdown
Contributor Author

made the adjustments. our deploy to the productions server will happen this week. then we change the url where we requesting the recommendations. Then we can go live.

All_subgroups_(recursively)=All_subgroups_(recursively)

What_is_Mr._Dlib?=What_is_Mr._Dlib?
What_is_Mr._Dlib?=What_is_Mr._DLib?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The english translation must be EXACTLY the same as the key.

Thus, if you wan't to change the casing to DLib you'll have to change the key (in all files) as well.

@koppor

koppor commented Feb 8, 2017

Copy link
Copy Markdown
Member
  • Thus, we have to wait for the final URL. I'd like the URL be final
  • Fix failing test (localization)

@lenhard

lenhard commented Feb 15, 2017

Copy link
Copy Markdown
Member

We are currently sitting together at JabRef and decided to merge this now :-) We will change to the new URL after the merge.

Thanks for your contribution!

@lenhard lenhard merged commit 704aaea into JabRef:master Feb 15, 2017
@koppor koppor changed the title [WIP] Integration Mr. DLib Integration Mr. DLib Feb 16, 2017
@crystalfp

Copy link
Copy Markdown

Thanks for the useful integration! Just a small improvement request. Is it possible to change the font used in the Related article window? The current one is really ugly. There are variations of the line widths (that appears less pronounced in the attached screenshot) and there is no antialiasing. One example is the S. Compare also the P and e of the first "Pedagogy" word.
image
It is just a minor thing, but don't encourage the use of this very useful feature.
Thanks!
mario

@lenhard

lenhard commented Jan 18, 2018

Copy link
Copy Markdown
Member

Hi @crystalfp Thanks for your feedback, but actually JabRef is the wrong place to report this. The content of the related article tab is just HTML that we load from MrDLib. They determine how it looks like. I think it's best if you report this here: https://github.com/Mr-DLib/mdl-server

But maybe @Joeran would like to comment on this?

@crystalfp

Copy link
Copy Markdown

Done, thanks!
mario

@Joeran

Joeran commented Jan 22, 2018

Copy link
Copy Markdown

thx, i commented in BeelGroup/Mr.-DLib-Server#81

@koppor koppor mentioned this pull request Mar 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants