Wiki

Clone wiki

vapour / api

Vapour exposes exactly the same RDF report through a REST API (currently only RDF/XML is supported). The reports are generated using EARL as the primary vocabulary.

It can be accessed using content negotiation, for instance using curl:

$ curl -H "Accept: application/rdf+xml" "http://validator.linkeddata.org/vapour?uri=http://dbpedia.org/resource/Asturias"

Or forcing the returned format with a query parameter, for instance:

$ curl "http://validator.linkeddata.org/vapour?uri=http://dbpedia.org/resource/Asturias&format=rdf"

Bindings

Although you are free to use the raw RDF version of the report, we are also providing API bindings for some popular programming languages:

Java

This bindings provides a Java-native API to use Vapour, allowing to perform validations and retrieve the details if the test suite executed. Using maven you just need to declare this dependency:

<dependencies>
  (...)
  <dependency>
    <groupId>net.sf.vapour</groupId>
    <artifactId>vapour-api</artifactId>
    <version>1.0</version>
  </dependency>
</dependencies>

If you don't want to install it from the code, the simplest method to get the library is using the following repository:

<repositories>
  (...)
  <repository>
    <id>ctic</id>
    <url>http://repository.fundacionctic.org/artifactory/repo</url>
  </repository>
</repositories>

For those who are not using maven in their projects, a JAR package with dependencies is also provided (vapour-api-1.0-with-dependencies.jar).

Please, be careful using this package in your projects, because the dependencies included could conflict with yours.

Finally, the code you would need to used could be something like:

VapourApi api = VapourApiFactory.createVapourApi();
VapourReport report = api.check("http://dbpedia.org/resource/Asturias");
System.out.println(report);

If you would require more details, this class diagram might be useful.

Javascript

Although it is still in an early development state, the Vapour API can be also used from Javascript (the public service is CORS-enabled). You just need to include something like this in your webpage:

<form id="vapour">
  <label for="uri">
   URI:
    <input type="text" name="uri" id="uri" size="50" value="http://dbpedia.org/resource/Asturias" />
  </label>
  <input type="submit" value="check" />
</form>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://bitbucket.org/fundacionctic/vapour/raw/default/apps/api/js/jquery.rdfquery.core.min-1.0.js"></script>
<script type="text/javascript" src="https://bitbucket.org/fundacionctic/vapour/raw/default/apps/api/js/vapour.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
    $("form#vapour").vapour();
  });
</script>

The file vapour.js provides the basic functionality to work with Vapour, allowing the validation of a URI and embedding the report with the performed tests on any web page. A full demo file is provided at the same source code repository for explain its usage.

This bindings are based on rdfQuery plugin for jQuery.

About

Fundación CTIC

Updated