Skip to content
Lorenz Bühmann edited this page Nov 10, 2016 · 16 revisions

About

Triple2NL allows for converting triples into natural language.

Example

Suppose we have the following triples about a famous theoretical physicist, below shown in Turtle syntax

@prefix : <http://dbpedia.org/resource/>
@prefix dbo: <http://dbpedia.org/ontology/>
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>

:Albert_Einstein a dbo:Scientist;
                 dbo:birthPlace :Ulm;
                 dbo:birthDate "1879-03-14"^^xsd:date.

Triple2NL will convert the first triple into

Albert Einstein is a scientist.

the second one into

Albert Einstein's birth place is Ulm.

and the last one into

Albert Einstein's birth date is March 14, 1879.

There is also the (very preliminary) option to convert all triples at once, which results in

Albert Einstein is a scientist, whose's birth place is Ulm and whose's birth date is March 14, 1879.

Setup

From Source

To install Triple2NL you need to download it via Git and install it via Maven.

git clone https://github.com/AKSW/SemWeb2NL.git
cd SemWeb2NL
mvn clean install

Afterwards, you have to add the dependency to your pom.xml

<dependency>
  <groupId>org.aksw.semweb2nl</groupId>
  <artifactId>triple2nl</artifactId>
  <version>0.1-SNAPSHOT</version>
</dependency>

Using Maven Release

1. Add AKSW Maven repository to your pom.xml

<repository>
  <id>maven.aksw.internal</id>
  <name>University Leipzig, AKSW Maven2 Repository</name>
  <url>http://maven.aksw.org/archiva/repository/snapshots</url>
</repository>

<repository>
  <id>maven.aksw.internal</id>
  <name>University Leipzig, AKSW Maven2 Internal Repository</name>
  <url>http://maven.aksw.org/archiva/repository/internal</url>
</repository>

2. Add dependency to your pom.xml

<dependency>
  <groupId>org.aksw.semweb2nl</groupId>
  <artifactId>triple2nl</artifactId>
  <version>0.1-SNAPSHOT</version>
</dependency>

Usage

// create the triple we want to convert by using JENA API
Triple t = Triple.create(
			 NodeFactory.createURI("http://dbpedia.org/resource/Albert_Einstein"),
			 NodeFactory.createURI("http://dbpedia.org/ontology/birthPlace"),
			 NodeFactory.createURI("http://dbpedia.org/resource/Ulm"));

// Optionally, we can declare a knowledge base that contains the triple.
// This can be useful during the verbalization process, e.g. the KB could contain labels for entities.
// Here, we use the DBpedia SPARQL endpoint.
SparqlEndpoint endpoint = SparqlEndpoint.getEndpointDBpedia();

// create the triple converter
TripleConverter converter = new TripleConverter(endpoint);

// convert the triple into natural language
String text = converter.convert(t);

About the project

Team

Modules

Licenses

Clone this wiki locally