Building an MGrammar-based application for Famulus

At the 2008 Microsoft eScience Workshop, Alex Wade and I presented a tutorial on Famulus. The video recording is not yet online but you can download the slides. The tutorial was mostly filled with demos so you should check out the recording when it becomes available.

Alex and I showed how Famulus could be used with the ecosystem of Microsoft technologies in order to easily create tools and services for repository-related solutions. Visual Studio, ASP.NET, Silverlight, WPF, ADO.NET Data Services... the tutorial had everything 🙂 We even showed how one could create a Web page with a data grid control in order to display resources in the repository (the main point was that we didn't have to write a single line of code). Everything was built on top of the Beta 1 release of Famulus.

One demo in particular was built using Oslo's MGrammar since I wanted to experiment with some of the Oslo suite of technologies. The rest of the post is about this sample, the "Famulus Console".

The Famulus Console is a textual, interactive application over the Famulus store. It's not going to be part of the final Famulus release. It's just a toy application built on top of the Famulus platform API.

The idea is simple... issue statements interactively through the console and immediately see the results. Some of the statements get transformed to tuples which are stored in Famulus while others get translated into queries. The collection of tuples allow us to realize a data graph of entities in the repository, which it can then be queried/analyzed. MGrammar (only few lines long) was used to describe the domain-specific language used by the console. Here's how part of the experience looks like.

 image

The Famulus Scholarly Communications data model is loaded so that entities like Person, JournalArticle, etc. and their properties are recognized. The input is parsed using the Famulus Console MGrammar and gets converted into a data graph. The data graph is evaluated and converted into calls against the Famulus API.

In the example above you can see how I defined three Person and a Journal Article entities. I then associated them through the "author" predicate. If the console encounters a predicate that it doesn't know about, it automatically adds it to the store. Finally, I query the repository for the entities that are related with the article through the "author" predicate.

Earlier today, I thought of extending this example to support queries that make use of transitive relationships.

Let's say that we have few people in the store: savas, don, pinky, chris. We can now start issuing statements to create relationships between them and then issue queries. Initially, the evaluator returns only the entities that are directly related with the subject of the query. However, the behavior of the evaluator changes once we state that "knows" is a transitive predicate. Now, the evaluator traverses the directed graph in the Famulus store, following the "knows" predicate, in order to find more results (yes... the evaluator can handle cycles :-).

 image

I know, I know... it's simple inference stuff but it's great to see that Famulus can easily be used for things like this.

As you can tell, I'm having lots of fun playing with Famulus and M.

One response to “Building an MGrammar-based application for Famulus”

  1. Any chance you could share your source? This is fascinating!