License discovery service for RDF documents

This post describes a service to discover the license in a RDF file (ontology, dataset, etc.).

The service is available by providing the URI (see Service #1 at but it is also provided as a RESTful service, very easy to be invoked:

The name of the service is as follows:

The only parameter is the parameter "content", with the URI duely encoded. You can for example type this in your web browser:

If your prefer to invoke the service from java, you can simply type this:

public static void main(String[] args) {
	String license=getLicense("");

 * Invokes the getLicense method of the Licensius service, so that
 * the license in a RDF resource is found.
 * @param uriToScan URI to scan, for example
public static String getLicense(String uriToScan) {
	String output="unknown";
	try {
		String uri="";
		String encodedData = URLEncoder.encode(uriToScan);
		URL url = new URL(uri);
		HttpURLConnection conn = (HttpURLConnection) url.openConnection();
		conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");            
		conn.setRequestProperty("Content-Length", String.valueOf(encodedData.length()));
		if (conn.getResponseCode() != 200) {
		 throw new RuntimeException("HTTP error code : "+ conn.getResponseCode());
		BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
		String linea = "";
		while ((linea = br.readLine()) != null) {
	} catch (Exception e) {
	return output;

The biggest concern is how to distinguish whether a detected licensing triple is qualifying the whole document (ontology / dataset) or not.
This is a problem for non-obvious cases (VoID described resources), but the problem is not exclusive of the licensing metadata information...

Late hint: if you want to know the title and a RDF version of the license, just declare that you want JSON

conn.setRequestProperty("Accept", "application/json");

and then you will get an structured answer...

{"title":"Creative Commons CC-BY 3.0","rdf":"","uri":""}