Archive for the 'RDF' Category

MeNow and MusicBrainz

Posted in MeNow, RDF, Semantic Web on March 28th, 2005 at 16:05:09

So, I had a few minutes of free time earlier today, and I decided to play a bit with MusicBrainz. On my Mac right now, the only music I have is tagged by Musicbrainz, and I finally have redlandbot/julie back online after some extended DSL line problems.

So, I figured “hey, my music is tagged by musicbrainz, and they do some nifty RDF stuff, right?” So I started exploring.

I’m listening to Lou Bega’s Mambo #5, from Mastermix 160 (disc 1), according to iTunes. As I said before, all these titles are pulled from MusicBrainz. So, I go to Musicbrainz, and type in “Mastermix 160” to the Albums list, click on the correct response. I arrive at http://www.musicbrainz.org/showalbum.html?albumid=145830 , and from there, move on to Mambo #5. I’m given two RDF links: One for the Track, one for the artist.

I add these to my local RDF store via IRC:

15:43:43 < crschmidt> ^add
http://mm.musicbrainz.org/mm-2.1/track/5c29f67b-5014-40a7-a443-0de7636b26ac
15:43:44 < julie> Adding
http://mm.musicbrainz.org/mm-2.1/track/5c29f67b-5014-40a7-a443-0de7636b26ac to my database…
15:43:45 < julie> Added 14 statements from
http://mm.musicbrainz.org/mm-2.1/track/5c29f67b-5014-40a7-a443-0de7636b26ac. Model size is 2125954.
15:43:51 < crschmidt> ^add
http://mm.musicbrainz.org/mm-2.1/artist/64f9c914-74a0-4f6b-8589-6261851b0ab9
15:43:52 < julie> Adding
http://mm.musicbrainz.org/mm-2.1/artist/64f9c914-74a0-4f6b-8589-6261851b0ab9 to my database…
15:43:53 < julie> Added 8 statements from
http://mm.musicbrainz.org/mm-2.1/artist/64f9c914-74a0-4f6b-8589-6261851b0ab9. Model size is 2125962.

So, now the bot knows about the song that I’m listening to – how to tell her I’m listening to it? The MeNow schema is designed for just that. A turtle serialization stating “crschmidt, whose homepage is http://crschmidt.net, is, at time 2005-03-28T20:47Z listening to the track identified by http://musicbrainz.org/track/5c29f67b-5014-40a7-a443-0de7636b26ac” would go something like this:

[a foaf:Person; foaf:nick “crschmidt”; foaf:homepage <http://crschmidt.net>; menow:hasStatus [ a menow:Status; menow:listeningTo <http://musicbrainz.org/track/5c29f67b-5014-40a7-a443-0de7636b26ac>; dc:date “2005-03-28T20:47Z”]].

Just my luck, my IRC bot also understands Turtle, so I add some triples:

15:49:07 < crschmidt> ^addturtle [a foaf:Person; foaf:nick “crschmidt”; foaf:homepage <http://crschmidt.net>; menow:hasStatus [ a menow:Status; menow:listeningTo
<http://musicbrainz.org/track/5c29f67b-5014-40a7-a443-0de7636b26ac>; dc:date “2005-03-28T20:47Z”]].
15:49:08 < julie> Model size increased by 7 to 2125969 via turtle statements.

So, now julie knows what I’m listening to, but how do I tell other people? Using RDQL queries (I haven’t added SPARQL support yet), I can show off what I’m listening to:

15:53:16 < crschmidt> ^q select ?t, ?n, ?d where (?p foaf:nick “crschmidt”) (?p menow:hasStatus ?s) (?s dc:date ?d) (?s menow:listeningTo ?o) (?o dc:title ?t) (?o dc:creator ?a) (?a dc:title ?n)
15:53:17 < julie> 2005-03-28T20:47Z Mambo No. 5 Lou Bega, 2005-03-28T16:59Z Can’t Get Enough of You Baby Smash Mouth, 2005-03-28T16:39:08Z Electric Sleep (Original Version) sHeavy, 2005-03-28T16:47:08Z Dead Already Thomas Newman

As you can see, this shows off all the songs I’ve been listening to recently. If I want to limit them, I can add a regex onto ?d: ?d =~ /20:47/. This gives me the result I want: 2005-03-28T20:47Z Mambo No. 5 Lou Bega

Okay, so it’s the most ass backwards way of sharing what you’re listening to ever. That doesn’t mean it doesn’t have 0 merit however: one of the benefits of RDF is its extensibility. This means that I can do a lot more than just say what I’m listening to. I could, for example, offer a rating, using the review vocabulary. I could find out what license a work is under, using information from the Creative Commons Metadata project. I could find out what songs someone else is listening to, and then find out their contact information via FOAF, check their availability via MeNow information and Jabber Pub/Sub tech, and drop them a message if they’re around.

I’m stretching it, but this is why I want all this stuff which MeNow can work with. RDF is powerful, and an application people might actually use would be a cool way to share this data. Then again, for the most part, I’m preaching to the choir here. But I wanted to write about it anyway. “Now Playing information stored in RDF: Wave of the future! You heard it here first!”

SVG

Posted in RDF, SVG on March 28th, 2005 at 00:19:23

Lately, I’ve been playing with SVG, since I finally got it to work decently well on two of the computers I regularly use. I was able to get it working on a Static FOAFNaut even, which is motivating me to actually write a few more tools in Redland to get FOAFnaut working better. I never realized that much of the speed problem with FOAFNaut before was that it was dynamically parsing RDF in Javascript, which is not fast, rather than something related to the actual SVG rendering, which is actually pretty quick.

With help from #svg on freenode, I’ve got SVG running with a prerelease version of an Adobe plugin on my Linux box, and I’ve had it for a while on Firefox on the mac. I’m really looking forward to the release of Firefox 1.1 now though: having built in SVG support will lead me to be able to try out some pretty neat stuff, and maybe pull a few more people over to Firefox in the fray (if the engine isn’t crap, at least).

SVG is, all and all, pretty cool. I’m probably going to add support for parsing RDF out of SVG files to julie once I get my DSL line problems fixed and start running her again. Yet another source of data… such nifty stuff to be done.

For those who don’t know: SVG is kind of like a standards-compliant version of Flash. It stands for Scalable Vector Graphics, and it lets you describe how to draw things in terms of curves and lines, rather than by specifying the pixels. This means that you don’t get blurriness at any size you look at it, unlike rasterized formats. It’s kind of like comparing Adobe Illustrator files to flattened Photoshop files, for those of you who are familiar with such things: one can be stretched at will and not look odd, whereas the other is just not going to react so well to that. There’s still some issues I’m having with them in the “embedded in web pages” way, but that may just me not knowing how to deal with stuff.

For Linux and Windows SVG authoring, there’s Inkscape, which seems to be a simply fantastic piece of work. Illustrator can also export to SVG, and I’m sure there are other tools which the lazyweb can share.

All in all: SVG is cool, and I hope to do some work with it in the near future. I’m happy to hear anything about success stories you may have had so far.

Sweet RDF Nothings…

Posted in RDF, Semantic Web on January 17th, 2005 at 18:18:18

Many of you who know me on IRC and other similar places will know that I have a wonderful partner-in-crime, Jessica. Together, we are rel:parentOf to Alicia and Julie. Julie, unfortunately, has a bad ear infection today, and is therefore getting ice cream for dinner, per doctor’s orders.

Julie decided that she wanted to come with on this trip, despite having a fever of 103. She said “I’m four, I can come!” Of course, this request was denied, at which point she repeated her assertion.

Repeated assertions reminded me, naturally, of RDF, so I expressed her statement in RDF: :Julie foaf:age “4”. (Which, verbally, is “Julie foaf:age 4”.) Our roomate looked askance at Jess and said “Ya know, he’s going to express your wedding anniversary in FOAF so he can’t forget.” Jess’s joking reply was “One of these days, I’m going to break up with him because he can’t stop whispering sweet RDF nothings into my ear.”

My response, naturally, was :ChrisAndJessBreakup log:implies “sad”.

(All terms, RDF and otherwise, in this entry are considered non-normative and non-validating. Do not use data from this entry for the basis of forming real RDF documents. I don’t understand rules, and I have no idea what log:implies does, so I probably used it wrong. But it was funny.)

Flickr and RDF

Posted in Flickr, Image Description, RDF on January 6th, 2005 at 23:25:30

I’m an open minded kind of guy. There are a lot of services out there, and even though some of them aren’t open source, it’s possible that they may do what I want them to do. One of those services is Flickr, a photo sharing service.

Flicker does a lot of very nifty things: updates from anywhere, advanced annotations, including an extremely easy to use Javascript interface for annotating regions of images, and posting to blogs directly from the service. However, that’s not the coolest aspect of the service, in my opinion.

Flickr provides a relatively advanced, full featured, well documented API – a way to get pretty much any information you might want out of the site without screenscraping. (LiveJournal, in comparison, strongly discourages screenscraping, preferring that you use services listed on their bot-friendly services list. However, the data afforded through these interfaces is extremely limited to the point where it’s unusable for most advanced tasks.) Through this API, you can retrieve all the information you want about the people and photos available through the service.

This is especially interesting to me as an RDF nut because it means that I can use Flickr’s nice interface and handy annotation tools – and at the same time, I can convert the data, via the API, to an RDF format that I can use for all the things I’ve been describing in my Image Description posts.

The limits a free Flickr account places on you are kinda strict: relatively small upload limit, given that I prefer to store full size images in the photos I already have in my personal gallery. I’d immediately set Flickr aside months ago because there was no way I could use it to store all my images. However, upon review tonight I discovered that an annual Flickr account during their beta period is only about 45 USD. Included in this is:

  • 1 GB monthly upload limit
  • Unlimited Storage
  • Unlimited Bandwidth

In addition to a few others, listed at their upgrade page.

It’s a case where I can build lots of tools and do lots of work myself, and get exactly what I want… or I can use flickr, pay a pretty minimal fee, and get 90% of everything I want with no effort, plus an additional bit of work to get that last 10%. I’ll probably still keep things locally (if for no other reason as a backup should flickr ever go poof), but move my primary photo gathering to be flickr based.

I think I know which way I’m going to go. Once I do, I’ll keep you all updated on the progress I have with RDF.

RDF From LiveJournal

Posted in Image Description, RDF on January 5th, 2005 at 02:19:11

Typepad exports RSS 1.0, as well as FOAF. LiveJournal exports limited FOAF information because that’s really all I could squeeze out of it the first time around, when bandwidth and load time was a major concern. I wonder if with the possible buy out of LiveJournal by SixApart, some of the LiveJournal specific XML formats will change to RDF…

For example, the Latest Images from LiveJournal is an XML format… it might be interesting to see this as an RSS feed, especially RSS 1.0. Perhaps the creation of feeds for the LiveJournal photo gallery option…

I can see a lot of room to expand the semantic content that LiveJournal emits, and I wonder if Six Apart might be in the right place to do it. As far as I’ve seen, they’ve seemed interested in doing so with Typepad. Does anyone know if something similar runs through more of their work? I’d love to see more RDF coming out of LJ. It’s a large data source and so much of it goes untapped because getting anything into the development process is very difficult.

Mm, LiveJournal sized image annotation stores… advanced semantic web development at its finest. Now that’s something I’d love to see. Imagine being allowed to check which LiveJournal users were in a photo, and then having that data emitted as RDF… allowing searches over it, finding photos with more than a certain number of people, photos of places. Geolocation. The UI isn’t hard, it would just be a bit of hackwork to get it together.

If there’s one thing I hope for, it’s that this leads to quicker turnaround on LiveJournal development time. Whether it’s with volunteers or not, I’d be willing to double my annual cost if it meant I got to see new features within a year, rather than three. That kind of interface would bring such a boost to the semantic web…

Now I’m tempted to build an external tool myself, just to demo how cool it would be.

Symbian Python RDF Hacking

Posted in RDF, Semantic Web, Symbian Python on December 22nd, 2004 at 22:59:42

Today, Nokia released Python for Series 60 based phones. I’d been hearing about this stuff for months, but it had been in closed beta, so I hadn’t paid much attention to it. In addition, when this stuff was being discussed originally, back in April, I’d never had a hand in any Python coding: I was a Perl and PHP hacker only.

However, when mattb asked today who would be the first to write an RDF parser that would run on the phone, I asked what he was talking about, and received a pointer to Nokia’s announcement. I immediately started playing. (A bad thing, given that I had work today.)

So, in 5-10 minute increments, plus hacking after the kids went to bed, some help from sbp in the form of an ntriples parser written in Python, some help from Dave Beckett and Redland in the form of an easy RDF/XML->ntriples conversion, I now have a working (although clunky) FOAF application for the Series 60 phone running Python.

So, without further ado, I explain to you the steps behind the process:

First, the user runs Python. This is installed the way any other application is. Once Python is installed, the user must send two files to their phone: an ntriples parser and the actual FOAF Service script. The ntriples script is installed as a “library”: this means that it is installed on the include path, so that it can be imported as a module. The FOAF script is installed as a script.

The user opens Python, and chooses to run a script. They choose the script that they installed, and run it. A standard query box opens, and asks the user for a URL. Here, they enter the URL of a FOAF file. Once they do, the file is passed through an rdf/xml->ntriples web service: this converts most FOAF files to a format the phone can understand. An example URL for this webservice is http://crschmidt.net/semweb/xml2nt.cgi?uri=http://crschmidt.net/foaf.rdf : It is created using Redland, and source is available at http://crschmidt.net/semweb/xml2nt.cgis . It uses the Redland Python bindings. You can feel free to use this web service: however, if you’re going to be exceeding 10 hits/minute, please let me know so I can find someplace better to host it.

Much of the time for the script to run is simply fetching this content: my FOAF file generates 70k of ntriples, which is then parsed into a simple list of triples. Some post processing sorts the data, and looks for a personal profile document to whom the document can be attributed. If it is found, then the script prints out a list of contact information for that person, including email and contact IDs.

Many thanks to mattb for pointing out the Python release, sbp for his invaluable ntriples parser and his help getting it working, and to other people who muttered encouragement throughout the day.

The source is available at my Symbian Semantic Web Page. More images are available in my Symbian Hacking gallery.