Wednesday, April 30, 2014

Feature of the week: System Tags

In BibSonomy there exist a few special tags, so called system tags, which expand its functionality. Today I'd like to give a short overview. Information on (system) tags can also be found on our help pages.

System tags can be grouped into two categories:

Tags that can be added to a post 
  • for:<groupname> copies a post to a group's collection with the tag replaced by from:YourUserName. The copied post will remain unaltered if you change or delete your own post. You must be a member of the group you forward the post to.
  • myown: adds the post to your CV page.
  • send:<username> sends a post to the inbox of another BibSonomy user. To use this tag, the receiver must have added you to his BibSonomy friends list or you and the receiver must have at least one group in common.
  • sys:hidden:<tag> hides a tag from every user besides yourself. 
  • sys:relevantFor:<groupname> adds a post to the relevantFor-page of the a group. This tag has the same effect as selecting a group in the "relevant for"-box while editing the post.

Tags that can be used as a filter for search queries 
  • sys:author:<authorname> filters the search range by author.
  • sys:bibtexkey:<bibtexkey> filters the search range by bibtexkey.
  • sys:entrytype:<entrytype> filters the search range by entry type.
  • sys:group:<group> filters the search range by group.
  • sys:not:<tag> excludes entries with tag <tag>. Here you can also use wildcards, e.g. sys:not:news_* excludes all posts with tags that start with "news_". See our earlier blog post for more information.
  • sys:title:<title> filters the search range by title.
  • sys:user:<user> filters the search range by user.
  • sys:year:<year> filters the search by year of the publication. Several arguments are possible, e.g.:
    • 2000: all posts of the year 2000
    • 2000-: all posts from the year 2000 or from one of the following years
    • -2000: all posts from the year 2000 or from an earlier year
    • 1990-2000: all posts from the years 1990 to 2000

I hope this overview will help to improve your experience with BibSonomy. 

Happy Tagging!
Lena

Friday, April 25, 2014

Feature of the week: creating concepts via the REST API

As a careful reader of our blog, you will have notived that tag relations, or concepts are a feature of BibSonomy which is important to us but probably not often used. Some previous blog posts where we promoted concepts are
We recently started to better support concepts with BibSonomy's REST API by implementing the creation of new concepts in the Java REST client. In this post I give you an example how you can access this functionality. Since we start from scratch, this post is also a good introduction on how to use the Java REST client in general.

Setting up Maven

Using Maven for build management really simplifies many things, so let's use it. First, create a directory for the project and change to that directory. Everything you do, will now happen there. Then inside that directory, create a directory for the source code:

mkdir -p src/main/java

and then create a file called pom.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"                                                                                                        
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                                                                                               
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <name>Test</name>
  <groupId>com.example</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1</version>
  <repositories>
    <repository>
      <id>dev.bibsonomy.org</id>
      <url>http://dev.bibsonomy.org/maven2/</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>org.bibsonomy</groupId>
      <artifactId>bibsonomy-rest-client</artifactId>
      <version>2.0.43</version>
    </dependency>
    <dependency>
      <groupId>org.bibsonomy</groupId>
      <artifactId>bibsonomy-model</artifactId>
        <version>2.0.43</version>
    </dependency>
  </dependencies>
</project>
You can now already test, if everything is OK by calling mvn install which should print you some lines with one of the last being

[INFO] BUILD SUCCESS

Writing and calling Java code

Now you can start to write the first Java code. Create the file src/main/java/Test.java with the following content:

class Test {

    public static void main(String args[]) {
       System.out.println("Hello World!");
    }
}

You can compile this file into a JAR by calling mvn install again. The resulting JAR file test-0.0.1.jar will be in the target folder. You can run this class with the command

java -cp target/test-0.0.1.jar Test

or alternatively with
mvn exec:java -Dexec.mainClass="Test"

The latter is the preferred choice for the next steps, since you will include some libraries whose dependencies Maven automatically resolves.

Calling the REST API

Change the file Test.java to the following code:

import java.util.*;                                                                                                                                          
import org.bibsonomy.common.enums.*;
import org.bibsonomy.model.*;                                                                                                                                
import org.bibsonomy.model.logic.*;
import org.bibsonomy.model.enums.*;                                                                                                                          
import org.bibsonomy.rest.client.*;

class Test {

    public static void main(String args[]) {
        RestLogicFactory rlf = new RestLogicFactory("http://www.bibsonomy.org/api");

        LogicInterface logic = rlf.getLogicAccess("jaeschke", "YOUR-API-KEY-HERE");

        List<Post<BibTex>> posts = logic.getPosts(BibTex.class, GroupingEntity.USER, "jaeschke", null, null, null, null, Order.ADDED, null, null, 0, 1);

        for (Post<BibTex> post: posts) {
        BibTex publication = post.getResource();
            System.out.println(publication.getTitle());
        }
    }
}
 
Note that you have to change the line

LogicInterface logic = rlf.getLogicAccess("jaeschke", "YOUR-API-KEY-HERE");

to use your BibSonomy user name instead of "jaeschke". You also must insert your API key which you can get from BibSonomy's settings page. When you compile (mvn install) and then run (mvn exec:java -Dexec.mainClass="Test") this class, it should print the title of my last publication post. You now change that code again, to finally create a concept.

Creating a concept with the REST API

import java.util.*;
import org.bibsonomy.common.enums.*;
import org.bibsonomy.model.*;
import org.bibsonomy.model.logic.*;
import org.bibsonomy.model.enums.*;
import org.bibsonomy.model.util.*;
import org.bibsonomy.rest.client.*;

class Test {

    public static void main(String args[]) {
        LogicInterface logic = new RestLogicFactory().getLogicAccess("jaeschke", "YOUR-API-KEY-HERE");

        Tag concept = new Tag("science");
        concept.addSubTag(new Tag("physics"));
        concept.addSubTag(new Tag("chemistry"));
        concept.addSubTag(new Tag("biology"));

        logic.createConcept(concept, GroupingEntity.USER, "jaeschke");
    }
}

Again, you have to change your credentials in the call to getLogicAccess().

What does the code do? First, it creates an object for the concept "science"

Tag concept = new Tag("science");

and then adds the subconcepts "physics", "chemistry", and "biology":

concept.addSubTag(new Tag("physics"));
concept.addSubTag(new Tag("chemistry"));
concept.addSubTag(new Tag("biology"));
Finally, the concept is stored on the server:

logic.createConcept(concept, GroupingEntity.USER, "jaeschke");

Note that you have to exchange "jaeschke" here by your user name, since one can only create concepts for one's own account. You can then find the concept in your sidebar:


That's it! :-)


Happy programming & tagging!

Thursday, April 17, 2014

API functionality: Get related tags to a tag

Hello, dear BibSonomy users,

some while ago, we added a new useful functionality to our REST API. Until now, we offered an overview of some details for a given tag if you called the following URL:
http://www.bibsonomy.org/api/tags/[tag]
Now, we added a parameter so you can specifically get all supported kinds of correlated tags like related and (semantically) similar tags.
http://www.bibsonomy.org/api/tags/[tag]?relation=<relation>
Instead of <relation>, you'd have to fill in one of the following briefly explained options:
  • related: Related tags are all those tags which ever appeared together with the requested tag on any resource in the system. On a side note: You can even use several tags for this relation. This works with http://www.bibsonomy.org/api/tags/[tag](+tag)*?relation=related
  • similar: By requesting similar tags to a tag, you'll receive those tags which are highly related in a semantical way, i.e. the more similar a tag tag1 is to a tag2, the easier can you replace tag1 with a tag2 without a major change of meaning.
This is only one of many possible operations that we offer by our REST API. For a quick overview, take a look at our Wikipage. Keep in mind that you need an API key to access these commands. You can get it on your user settings page in BibSonomy.

Happy Easter :)
Thomas

Wednesday, April 9, 2014

Feature of the week: View the date of your posts

In BibSonomy there exist two dates for each publication or bookmark:

  • the date on which it was first created and 
  • the date on which it was changed last. 
Those dates are displayed on our website in different ways. Most of the time you get information about how long ago a post was created as in "22 days ago by <user>". The reason is that we determine dates in the CEST time zone so the exact dates would be confusing for most of our users.

Nonetheless you can view the exact dates of a post by hoovering above the date field:



As this week's feature you can now also have a look at the update and creation date of a publication on its details page:


Happy Tagging!

Friday, April 4, 2014

Feature of the week: CVWiki: Presenting the Homepage Tag!

Dear BibSonomy users,

a few weeks ago, we introduced the CVWiki, which allows you to modify your CV page on BibSonomy. Inside the CVWiki, you can use custom tags like the ones described on our help page. We now introduced a new tag to show your homepage on the CV page. It is pretty easy to use:
If you have defined a homepage on your settings page, you can enter
<homepage />
at the position where you want to insert a link to your defined page. That's it! You're done :)

Happy tagging!

Popular Posts