Python/Redland Powered RDF Validator

After some thinking this morning, I converted the current PHP-based templating system to a Cheetah Python template. This means that some more of my tools can move to being Python powered, rather than PHP powered.

“So what?”

Currently, the interface to Redland that I have available in PHP is significantly less good than Python. It’s coded by yours truly, and it’s basically only designed for my use cases, so every time I want to use something new, I have to go and code it, or use a closer-to-native C-style interface translated into PHP. Neither of those are particularly enjoyable.

Python is a much more comfortable language for me to use. It is more intuitive for me. It feels more natural, not to mention the fact that I keep forgetting semicolons in my PHP code. It has an awesome binding for Redland, which is one of the things that I’ve been working with most over the past while.

In the past, all my scripts had been either 1. PHP or 2. Python with no site theming. Hopefully the new Cheetah template will help make me create some more tools in Python, which is the language I feel most comfortable in.

With that in mind, I’ve created a new web service: an RDF Validator. A number of times, I have found that the official RDF validator will puke, but won’t give much of a reason why. This tool uses Redland, which has a tendancy to return what I consider better error messages on worse RDF. It’s designed as a one-off example of the new templating system, and should not be considered indicitive of most of the expected output of such scripts. Just a first attempt at getting myself into more code.

2 Responses to “Python/Redland Powered RDF Validator”

  1. Jimmy Cerra Says:

    Nice! Too bad there isn’t a form to upload RDF fragments (like the W3C’s validator) but still cool. Does it pass all of the conformance tests linked from the W3C at <>?

  2. Christopher Schmidt Says:

    I sure hope those aren’t conformance tests, because if so, they did a piss poor job of them. A couple things I noticed right off the bat:

    RDF Model Syntax: Tar file is only symlinks. Completely useless, as I don’t have the files there, otherwise I wouldn’t’ve downloaded the tarball! Several of the files include HTML: ms_7.7 seem to exhibit this. I’m not sure if these are supposed to be some kind of RDF-in-HTML example though, so I’m not sure if this is by design.

    Seems much more likely you were thinking of the test cases linked from (an unlinked subdirectory from the one you gave, as far as I can see). There’s a lot of tests there though, and I’m not the kind of guy that runs a test suite very often.

    The real person to ask that question to would be dajobe: the “validator” is just running the RDF/XML parser over the given URI. I’m pretty sure that his parser conforms to all the test cases, but he’d really be the one to ask, although I’m not completely sure the question isn’t already answered on Redland’s Home Page somewhere.