Skip to Content.
Sympa Menu

cc-devel - Re: [cc-devel] Liblicense License Chooser API

cc-devel AT lists.ibiblio.org

Subject: Developer discussion for Creative Commons technology and tools

List archive

Chronological Thread  
  • From: Jon Phillips <jon AT rejon.org>
  • To: Jason Kivlighn <jkivlighn AT gmail.com>
  • Cc: CC Developer Mailing List <cc-devel AT lists.ibiblio.org>
  • Subject: Re: [cc-devel] Liblicense License Chooser API
  • Date: Sat, 28 Jul 2007 12:44:37 -0700

On Fri, 2007-07-27 at 22:26 -0700, Jason Kivlighn wrote:
> Hey all,
>
> I'm currently adding license selection based on
> Permits/Requires/Prohibits flags to liblicense. At the moment, I'm
> ironing out the API, and would appreciate any feedback. Here's some
> working sample code, with inline comments explaining the details:


> char *attributes[] = {
> "http://creativecommons.org/ns#Distribution";, //0
> "http://creativecommons.org/ns#CommercialUse";, //1
> "http://creativecommons.org/ns#DerivativeWorks";, //2
> "http://creativecommons.org/ns#ShareAlike";, //3
> "http://creativecommons.org/ns#Attribution";, //4
> NULL
> };
> //build a structure for fast searching of licenses on the given
> attributes
> ll_license_chooser_t *license_chooser =
> ll_new_license_chooser(attributes);
>
> int permits_flags, requires_flags, prohibits_flags;
>
> //permits Distribution(0) and DerivativeWorks(2)
> permits_flags = (1 << 0) | (1 << 2);
>
> //requires ShareAlike(3)
> requires_flags = (1 << 3);
>
> //doesn't prohibit any particular attribute, but could still
> prohibit an attribute that isn't in the 'attributes' list
> prohibits_flags = 0;
>
> //Attribution(4) and CommercialUse(1) must be unspecified in the
> license RDF.
> //If you don't want this to be the case, leave these two attributes
> out of the list that is
> //passed to ll_new_license_chooser()
>
> //returns GPL and LGPL
>
> ll_get_licenses_from_flags(license_chooser,permits_flags,requires_flags,prohibits_flags);
>
> //another example:
>
> //permits Distribution(0)
> permits_flags = (1 << 0);
>
> //requires ShareAlike(3)
> requires_flags = (1 << 4);
>
> //prohibits CommercialUse(1)
> prohibits_flags = (1 << 1);
>
> //returns all by-nc-nd licenses
>
> ll_get_licenses_from_flags(license_chooser,permits_flags,requires_flags,prohibits_flags);
>
> Doing some quick benchmarking, ll_new_license_chooser() takes .730s
> (which includes a call to ll_get_all_licenses()). After that, calls to
> ll_get_licenses_from_flags() are extremely fast -- it's a constant time
> algorithm (100,000,000 calls ran in less than 7 seconds); this makes it
> highly effective for use in a graphical license chooser where the user
> clicks checkboxs to specify the flags, and the selected license is then
> updated.
>
> The goal is to provide easily integrated license selection in
> applications. For example, a user should be able to say, "I want a
> license that allows sharing, derivative works, and commercial use." A
> simple call to ll_get_licenses_from_flags() with the appropriate flags
> returns what the user wants.
>
> As-is, this code should include the functionality necessary for the
> nautilus license extension (coming out with Liblicense 0.3) and the KDE4
> equivalent that I'm working on (These function like the mock-ups at
> http://wiki.creativecommons.org/Desktop_Integration). Are there use
> cases I'm missing?
>
> Cheers,
> Jason

This sounds good...if we need to add more, we can in the future...man,
that is some massive speedup! The Open Font License, cc-like metadata
has some other attributes, and I'm sure to express others, will need
more attributes, but for our purposes, this sounds wise...excellent!
Commit it!

Jon

> _______________________________________________
> cc-devel mailing list
> cc-devel AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/cc-devel
--
Jon Phillips

San Francisco, CA
USA PH 510.499.0894
jon AT rejon.org
http://www.rejon.org

MSN, AIM, Yahoo Chat: kidproto
Jabber Chat: rejon AT gristle.org
IRC: rejon AT irc.freenode.net





Archive powered by MHonArc 2.6.24.

Top of Page