-->

How can I access the API of OntoRefine?

2019-08-21 01:50发布

问题:

In our current project we have a lot of data in table form that we want to transform to RDF. OpenRefine offers the possibility to create projects or update data via an API (see: https://github.com/OpenRefine/OpenRefine/wiki/OpenRefine-API).

Is it possible to use this API with OntoRefine and if so, how do I do it? Or are we better advised to use OpenRefine?

This question was similarly asked a little over a year ago but had not received an answer. (How to integrate tabular data into GraphDB automatically?)

回答1:

OntoRefine is an extension and improvement on top of OpenRefine. The functionality offered by OpenRefine, including the API, should all be present in the GraphDB version. In terms of implementation, you shouldn't need much more than a simple HTTP client.

Here's a sample using a previously created OntoRefine project.

public static void main(String[] args) throws URISyntaxException, IOException {
    CloseableHttpClient client = HttpClientBuilder.create().build();
    HttpGet post = new HttpGet(new URI("http://localhost:7200/orefine/command/core/get-models?project=1987845723285"));
    HttpEntity entity = client.execute(post).getEntity();
    System.out.println(EntityUtils.toString(entity));
}

Of course, you can also use the OpenRefine libraries, such as refine-java, for example.