TripleT: an RDF database engine
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
TripleT.Examples
TripleT
.gitattributes
.gitignore
README.md
TripleT.sln

README.md

TripleT

This is the source code of the implementation of the TripleT RDF database engine that I have developed at Eindhoven University of Technology as part of my master's thesis. Development took place over the course of roughly 6 months, from August 2012 to January 2013.

More information, including my thesis, can be found over at my personal website.

For additional reading relevant to TripleT, you can visit my advisor's website. TripleT was originally proposed in Scalable indexing of RDF graphs for efficient join processing, George Fletcher and Peter W. Beck, CIKM 2009.

What's in the box?

This repository contains a .NET class library which implements the TripleT engine. An example project is included to give you a quick overview of how to use it.

Dependencies

TripleT is implemented on top of version 4.0.30319 SP1Rel of the Microsoft .NET Framework. Aside from that, TripleT has a dependency on Berkeley DB, version 5.3.21. Berkeley DB itself is not included in this repository. It should be acquired from the official Oracle website. TripleT requires that the correct Berkeley DB libraries (libdb_csharp53.dll, libdb_dotnet53.dll, and libdb53.dll) can be located, either through the operating system’s PATH variable or because they are in the same directory as the executable using TripleT.

Programming API

There is no explicitly defined programming API in our implementation of TripleT, though all functionality for interacting with a TripleT data store is contained in the TripleT.Database class. In this section we show how to perform basic operations on a TripleT database

Inserting data

Inserting data into a TripleT store can occur though multiple channels. We support insertion of single triples:

using (var db = new Database("my_database")) {
    db.Open();
    
    // inserting a triple
    db.Insert("Bart Wolff", "wrote", "TripleT");
    
    // inserting another triple as a System.Tuple
    var t = Tuple.Create("TripleT", "is", "quite nice");
    db.Insert(t);
    
    db.Close();
}

When inserting multiple triples, batch insertion is often quicker:

using (var db = new Database("my_database")) {
    db.Open();
    
    // inserting many triples
    db.BeginBatchInsert();
    foreach (var t in myTriplesSet) {
        db.Insert(t);
    }
    db.EndBatchInsert();
    
    db.Close();
}

Inserting triples using one of TripleT's triple readers (found in TripleT.Compatibility is also directly supported:

using (var db = new Database("my_database")) {
    db.Open();
    
    // inserting triples from an external source
    db.BeginBatchInsert();
    using (var tr = new Notation3TripleReader(File.OpenRead("triples.n3"))) {
        db.InsertAll(tr);
    }
    db.EndBatchInsert();
    
    db.Close();
}

Building the index

After inserting all triples into the TripleT store, the index can be built. Doing so should only occur after all triples that should be in the store have been inserted; there is no support for inserting, mutating, or deleting triples on an existing TripleT store after the index has been built. Building the index sorts the buckets, indexes them, and builds the statistics database. A single line of code does the job:

using (var db = new Database("my_database")) {
    db.Open();
    
    // [...] assume all triples have been inserted at this point
    
    // build the index and compute dataset statistics
    db.BuildIndex();
    
    db.Close();
}

Querying

Executing queries on a TripleT store is done by feeding it Basic Graph Patterns. Querying can only be done after data has been inserted into the store and the index has been built. Consider the following example BGP:

("Bart Wolff", "wrote", ?x)
(?x, "is" ?y)

Querying a TripleT store with this BGP is done as follows:

using (var db = new Database("my_database")) {
    db.Open();
    
    // create the query pattern
    var pattern = new Pattern[]
        {
            new Pattern("Bart Wolff", "wrote", 1),
            new Pattern(1, "is", 2)
        };
    
    // compute the query plan for this BGP
    var plan = db.GetQueryPlan(pattern);
    
    // execute the query, and enumerate the results
    foreach (var bindingSet in db.Query(plan)) {
        // do something with it
    }
    
    db.Close();
}

Licence

TripleT is Copyright (C) 2012-2013 Eindhoven University of Technology; Copyright (C) 2012-2013 Bart Wolff. It is licenced under the GNU General Public License, version 3.