Using the Idyl SDK with Maven

The Idyl API is described on the api page. The Idyl interface is just a set of REST webservices. To reduce the time necessary to develop for Idyl we have created wrappers for in both Java and .NET. Here’s a quick look at how to use the Java SDK with Maven.

First, add our repository to your pom.xml:

<name>Mountain Fog Repository</name>

Next, add the Idyl SaaS SDK dependency:


Now with that done you can move on to the fun stuff. Here’s a snippet of using the SDK for extracting entities:

// Set your Idyl API key.
final String apiKey = "HFPL37MZAP03JFXS";

// Set the text to be sent to Idyl.
final String sentence = "John Smith is a person.";

IdylClient idylClient = new IdylClient(apiKey);

ExtractEntitiesRequest request = new ExtractEntitiesRequest(sentence);

// If you want to correlate entities set the context and optionally the doc id:
// request.setContext("contextA");
// request.setDocId("document1");

ExtractEntitiesResponse response = idylClient.extractEntities(request);

// Show the http status code.
System.out.println("Http status code: " + response.getHttpResponseCode());

// Check the extracted entities.
System.out.println("Extracted entities: " + response.getEntities().size());

// Loop over the entities.
for(Entity entity : response.getEntities()) {

System.out.println("Entity: " + entity.getEntity() + ", Type: " + entity.getType());


All you need to do is replace the example API key with your Idyl API key and set your sentence value. And that is all. The request will be sent to Idyl and the extracted entities will be printed.

If you want to store the extracted entities to query over them later uncomment the two lines that set the context and document ID and set your values. Think of the context as the name for a collection of documents and the document ID as the name for a single document. For example, if you were extracting entities from books the context could be the type of book (fiction, nonfiction) or the author and the document ID could be each book’s title. Now with stored entities you can use the SDK to query those entities. The code follows the same pattern as above:

final String apiKey = "HFPL37MZAP03JFXS";
final String query = "SELECT ?entity WHERE { <> <> ?entity . }";

IdylClient idylClient = new IdylClient(apiKey);

QueryRequest request = new QueryRequest(query);

QueryResponse response = idylClient.query(request);

// Show the http status code.
System.out.println("Http status code: " + response.getHttpResponseCode());

// The result of the query with be a RDF/XML string.

This code executes a  SPARQL query on your entities that simply returns all entity names under the testcontext and document ID doc1. The query will be sent to Idyl and the returned entities will be printed.

The use of the .NET SDK is very similar but we will describe it soon!

Leave a Reply