Hiển thị các bài đăng có nhãn concepts. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn concepts. Hiển thị tất cả bài đăng

Thứ Bảy, 23 tháng 11, 2013

Feature of the week: Retrieve resources by disjunction of tags

A very common way to browse through your own or other people's repository on BibSonomy is via one or more tags, e.g.

http://www.bibsonomy.org/tag/semantic+web.

Hereby, the tag-based retrieval is done in a conjunctive manner, i.e., the result of this query will comprise all bookmarks and publications tagged with semantic AND web. We are often asked if we offer any other possibiliby of combined tag queries, e.g. by disjunction - one might e.g. be interested in all resources tagged with semanticweb OR ontologies.

This behaviour is not accessible via a specific URL scheme, but can be achieved by invoking an old BibSonomy buddy - namely concepts! As you will know, BibSonomy allows you to define relations between tags in the form:

SUPERTAG <- SUBTAG

(see also http://www.bibsonomy.org/relations). A supertag along with all its subtags is denoted a concept in BibSonomy, which can be used to retrieve resources like this:

http://www.bibsonomy.org/concept/tag/ontology

The characteristics of this retrieval method is now that all resources are returned which are tagged with ontology OR one of its subtags. This constitutes, in fact, a retrieval of resources by a disjunction of tags. We are aware that this has some limitations, as a concept has to be defined before this type of query is possible - but facing a tradeoff between efficient query processing and freedom of query formulation has led us to this decision, with the ultimate goal to keep our service highly responsive for all of you as our users.

Thứ Hai, 4 tháng 11, 2013

Feature of the Week: Optimize your Firefox Browser for BibSonomy

How often do you use the search box of BibSonomy?


You can speed up searching in BibSonomy considerably by creating some
smart keywords in your Firefox webbrowser.
Afterwards, you can access all your posts with a certain tag with just some keystrokes. This blog post explains how to do this.

First try: Speed up fulltext search

  1. Navigate to www.bibsonomy.org.
  2. Right-click on the BibSonomy search box that says fulltext search here. Select Add a Keyword for this Search...
  3. In the dialog that appears, enter a short keyword, e.g., bs (like BibSonomy search).
  4. Fill the remaining fields and click Save.

Now you can search in BibSonomy by entering into your browser's location bar (reach it quickly with CTRL + L) the string bs SEARCHTERM, e.g., bs firefox and pressing ENTER. Firefox will then search for the term SEARCHTERM in BibSonomy, e.g., bs firefox opens www.bibsonomy.org/search/firefox.

Next steps: Add more keywords

Adding smart keywords for other search options in BibSonomy is now easy: just select the corresponding option in the dropdown box

and repeat the steps above with a new keyword. Here are some suggestions:
bt
search for a tag (e.g., /tag/firefox)
ba
search for an author (e.g., /author/Stumme)
bm
search for one of your tags (e.g. /user/jaeschke/myown). This is explained in the next step.

Finally: Quickly access your own posts

Adding a smart keyword to access your posts having a certain tag is now straightforward: go to your BibSonomy page and right-click into the enter tag(s) here field at the top. Again, select Add a Keyword for this Search...

and enter an appropriate keyword (e.g., bm for my tags).

Here I describe a more advanced method that searches for concepts instead of tags. Note that this works even if you don't have relations defined, yet!
  1. Go to www.bibsonomy.org/concept/user/jaeschke/arbitrary_tag and exchange the user name in the URL by your user name, e.g., replace "jaeschke" by your user name. Press ENTER.
  2. Right-Click in the input box containing the string arbitrary_tag and select Add a Keyword for this Search...:

  3. Again, enter a smart keyword (I would suggest to use bm as described above.).
  4. Search for your posts by entering bm TAGNAME into the location bar of your browser (remember CTRL-C).
Nothing new so far, except for the somehow difficult to access concept search field. But what are the benefits of /concept/user/jaeschke/programming compared to /user/jaeschke/programming? Well, I have created some relations using the tag editor of BibSonomy. One of them says that the tags ada, c, fortran, java, lisp, perl, python, and ruby are sub-tags of the tag (or better concept) programming:


Now, whenever I search for /concept/user/jaeschke/programming, I get all posts having the tag programming or one of its sub-tags, i.e., ada, c, fortran, java, lisp, perl, python, or ruby.

This way I can structure my tag space - and more important - use a logical OR in my queries.

More information about concepts and relations can be found here:

Thứ Ba, 8 tháng 10, 2013

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!