RDF the groovy way - Domain-specific language for building RDF with Groovy

Hi all!

I just released a Groovy library for building RDF data in a "groovy way".

Example:

RdfData rdfData = rdfBuilder {
  "http://example.com/resource/alice" {
     a "http://example.com/vocab/Person"
    "http://example.com/vocab/name" "Alice"
  }
}

is equivalent to the following RDF in TURTLE syntax:

<http://example.com/resource/alice>
  a <http://example.com/vocab/Person>;
  <http://example.com/vocab/name> "Alice".

The benefit is, that you can use all the features of the groovy language
to build your RDF dynamically. Imagine something like the following:

def person = new Person (...)

RdfData rdfData = rdfBuilder {
  "http://example.com/resource/${person.nick}" {
     a "http://example.com/vocab/Person"
    "http://example.com/vocab/name" person.name
    "http://example.com/vocab/knows" {
      person.friends.each { friend ->
        "http://example.com/resource/${friend.nick}" {}
      }
    }
  }
}

More examples & explanation can be found in the user guide:
http://datenwissen.de/projekte/groovyrdf/userguide/

The sourcecode is available at GitHub (participation welcome):
https://github.com/angelo-v/groovyrdf

I am awaiting your feedback!

Kind regards,
Angelo Veltens

Received on Monday, 29 August 2011 18:28:52 UTC