Maintaining a changelog with DOAP

I’ve just pointed that I used DOAP to represent various information about SIOC Exporter for Dotclear. The DOAP vocabulary is designed to define different properties for a project, as its homepage, repository, different people involved into its development…

There is no direct property for the changelog of a project, yet you can use doap:release to represent information about each release and then add the changelog of a given release using dc:description[1]:

<doap:release>
 <doap:Version>
  <doap:revision>1.4</doap:revision>
  <doap:created>2006-09-09</doap:created>
  <dc:description>
- API updated to use both foaf:maker / sioc:has_creator
- Using object type in URL parameters
- Generating a basic FOAF profile to be used in user export
- French tranlation of the backend
- Adding doap.rdf
  </dc:description>
 </doap:Version>
</doap:release>

Then, just use SPARQL to retrieve and order changes, plus a few lines of code to display the results (eg using Python and librdf):

import string
import RDF  

query = """
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX doap: <http://usefulinc.com/ns/doap#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?revision ?created ?description
WHERE {
  ?_p rdf:type doap:Project .
  ?_p doap:release ?_r .
  ?_r doap:revision ?revision .
  ?_r doap:created ?created .
  ?_r dc:description ?description
} ORDER BY DESC (?created)  """  

url = "http://apassant.net/home/2006/02/dotclear-sioc/doap.rdf"
model = RDF.Model()
RDF.Parser().parse_into_model(model, url)
for r in RDF.Query(query, query_language="sparql").execute(model):
  print "# v%s [%s] %s" %(r['revision'].__str__().strip(), r['created'].__str__().strip(), r['description'].__str__())

And here it is, you’ve got a formatted changelog for your project:

# v1.4 [2006-09-09]
- API updated to use both foaf:maker / sioc:has_creator
- Using object type in URL parameters
- Generating a basic FOAF profile to be used in user export
- French tranlation of the backend
- Adding doap.rdf  

# v1.3 [2006-08-02]
- Update to match API changes  

# v1.2 [2006-05-30]
[...]

This example shows how data can be formalized and mashed-up using Semantic Web technologies, as you can do with your FOAF profile and then create an homepage from it. So, while I first thaught about a FOAF to Homepage script, I’m now into a simple RDF 2 Templated-HTML converter, which will use Jinja as a templating engine, and librdf + SPARQL to get information from any RDF file.

Notes

[1] Yet, adding a changelog property could be more appropriate from a semantic point of view, or maybe some more complex class, I’ve started the discussion here.

Advertisement
Tagged , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.