Tuesday, September 18, 2007

KnitML

A few posts ago, I jokingly made reference to what I thought was a made-up language called KnitML. The geeks out there will probably know that this is short for Knitting Markup Language(or perhaps Knitting Modeling Language). On a whim I googled for KnitML and found that Laura Porter has already begun development on the concept. This quickly went from being a joke to being something that has been consuming most of my free time.

And why did Laura develop the first draft of KnitML?
Initially, I developed the basic schema as a way to teach myself XMLSchema. I work for a software house developing XML data structures and XSLT / XSL-FO stylesheets to style them with, and wanted to learn XMLSchema. Creating a small, trial schema concerning data I'm familiar with seemed a good way.

I have been knitting for about 14 months and have noticed over that time how similar knitting can be to programming. I also noticed how knitting patterns tend to be written using non-standard styles and abbreviations etc. So developing a standard markup for knitting patterns seemed like a logical idea.
Well, sure. Standardization is great and all of that, but this alone isn't going to push the buttons of most knitters. She doesn't point out (or possibly realize) the huge potential benefits that a comprehensive knitting metamodel can have. Like what, you ask? Well, let me tell you.

Assume for a minute that KnitML is a universally accepted standard. It would not be unreasonable to assume that many knitting patterns would, in addition to the printed version, be made available in KnitML, and that many types of knitting software would be written to interpret KnitML. Take these two points together and you have a whole lot of potential. Consider for a moment that from a KnitML pattern, software could be written that would:
  • Render a pattern in either written directions or a chart, depending entirely on your preference
  • Render a pattern in any language, using conventions familiar to that language and dialect
  • Automatically convert English measurements to metric
  • Size a pattern up or down to any size, not just the sizes that come with the pattern
  • Recalculate a pattern for your gauge rather than the one that came with the pattern
  • Explicitly write out highly annoying directions (e.g., "increase 34 stitches evenly over 171 stiches")
  • Alter the pattern using an easy-to-use graphical editor (or create new KnitML-based pattern from scratch)
  • Preview the result of the pattern with pretty graphics
  • Digitally sign the pattern to guarantee an author's authenticity
I'm sure there are more possibilities out there. The beauty of this is that all of this software could take in a KnitML pattern and produce an altered KnitML pattern. So you could run your pattern through any and all pieces of software that understood KnitML.

I've already tried getting in touch with Laura, but I haven't heard back from her. I don't know if the original effort has stalled, but I would definitely like to get this project going. I'm not waiting to hear back, though. I've already started developing the most comprehensive KnitML schema that I can using a basic sock pattern. Socks have a lot of combinations of strange repeats, short rows, areas of potential charting, etc. that makes them ideal for some comprehension. Hopefully we can get many people on board with this project so that we can make the schema truly comprehensive.

Once we settle on a schema, a prototype piece of software needs to be developed to demonstrate and popularize the standard. I've already thought about how a simple renderer would work if it were implemented with a state machine in Java. Getting good tooling out there is critical, as it would widely facilitate adoption by the masses.

Once people start realizing the benefits of KnitML, we can hopefully get the buy-in from independent pattern authors to publish their patterns in KnitML (as well as the traditional format.) From there, larger publishers would probably eventually feel pressure to make their patterns available in KnitML as well. And once that happens, you have an adopted standard. Ultimately the standard would move to a standards organization (such as the W3C).

They say you need to think big, after all.

UPDATE: KnitML now has its own website with an easy-to-remember name: knitml.com.

17 comments:

Sarah said...

I like this idea! Although I like the idea of sweater wizard too, this seems like it has a lot of potential.

KC said...

Go for it!!!
Look what happened with Ravelry, anything is possible.

(Check out the latest Stash and Burn podcast episode for an interview with the ravelry creators)

I would love to be able to put in some numbers and come out with perfect shaping for a sweater, any sweater!!

jill said...

I think Brenda Dayne was noodling with this idea in a couple of episodes of Cast-On as well. It's a very, very appealing idea.

SarahA said...

I've always appreciated the connections I've imagined between the technical and knitting worlds. I would love to help, but alas my programming skills are lacking greatly....unless it will be in KornShell?

LaurieM said...

Oh my! This is just awesome. I'm a techincal writer and we're currently converting to XML based documentation so I find this just fascinating. The potential is HUGE!

Kathy in KS said...

Umm, ok, no offense, but I'm thinking maybe some grapes got stuck somewhere. Bless your heart.

the fiddlin' fool said...

Sarah A,

I don't necessarily need technical people for this. Coming up with a technical specification is very different from writing software to that specification.

What I really need are experienced knitters that can help me make KnitML a complete expression language for knitting patterns. What I mean by this is, if you can express the content in a knitting pattern, there should be a way to do it in KnitML.

Obviously, if there are other folks who would like to code some prototype software, that would be awesome, too. But that's really more for demo purposes (at least at this point.)

Matt said...

Awesome, I can certainly help you out on this. I could put a webservice up on my test server to serve out knitml in the payload of a signed soap message.

meg said...

I hope that's wool wash and not just plain soap.

the fiddlin' fool said...

Of course it's wool wash! We want all of our code to smell nice.

Kristin said...

This is awesome. I'm so glad you have picked this up, because I don't have the motivation to take this anywhere, but love the idea so much. You should make a post on Ravelry (if you've an account there...if not I could) to broach the discussion. There are a lot of tech savvy and tech interested people there that I'm sure would love to participate. These sorts of things need lots of people to get the ball rolling.

Stephenson! said...

Wow... As interested in this as Matt is, I wonder if it'll get him to actually KNIT SOMETHING. *sigh*

just jon said...

"I have been knitting for about 14 months and have noticed over that time how similar knitting can be to programming."

Where does she think the idea of punch cards came from?

Ru Temple said...

knitML is a great idea whose time is come, go you!

jon, punch cards in computing came directly from jaquard looms, which are a fiber-arts toy certainly, but for weaving, not knitting.

I'm wistful for weaving to be included in Ravelry or something very much like it, but don't have the technical chops to jump up and do it.

This is a good time for fiber arts, it would seem.

-Ruth Temple
Redwood City, CA

Rebecca said...

I've been searching online for recent info on knitml. I downloaded a file that was from Sept 08 but only half the manual was written. It is something that I'd like to use if it is available. Rebecca

the fiddlin' fool said...

Rebecca,

I'm almost done with the 0.4 release, and I strongly encourage you to wait another week or so until I have that out the door. There are some API changes that will render previous KnitML documents incompatible, and I don't want you to get caught up in that.

The documentation is going to be a work in progress for awhile yet, but I hope that primarily through the samples and the tutorial in the user's guide, that many things will be self explanatory. The newest user's guide will have a reference for all of the Knitting Expression Language functions, so that should make people's lives easier. I'm also going to ensure that the XML Schema documentation is up-to-date, though I suspect that most people won't be studying that in-depth. :>)

the fiddlin' fool said...

Also, the KnitML website was down for a week or so as our webmaster had some issues with his provider that have since been resolved. Sign up on the KnitML blog's RSS feed, and you'll get the latest information about the project.

And don't forget that there is a KnitML group on Ravelry.