On 09/10/2007, Matthieu Riou <[EMAIL PROTECTED]> wrote:
> I've finally had some time to tweak my license serialization, here is what
> comes out:
>
> <rdf:RDF xmlns:doap='http://usefulinc.com/ns/doap#' xmlns:dsc='
> http://apache.org/ns/2007/discordia#' xmlns:rdf='
> http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
>  <doap:Project rdf:about='mvn://org.jconfig/jconfig/2.9'>
>    <doap:name>JConfig</doap:name>
>    <dis:has_license rdf:about='
> http://www.opensource.org/licenses/bsd-license.php'>
>      <dis:source>
> http://jconfig.cvs.sourceforge.net/*checkout*/jconfig/jConfig/jConfig/BSD_license.txt?revision=1.1
> </dis:source>
>    </dis:has_license>
>  </doap:Project>
> </rdf:RDF>
>
> As you can see the rdf:about attribute of has_license points to the license
> normative url, whereas dis:source points to the effective license. This is
> necessary for license families. I've also used the mvn:// URL scheme instead
> of the "real" URL as I'm somewhat uncomfortable relying on a server name or
> even mirror that could change at anytime. The central Maven repo is at a
> "well known" location so if some tool wants to construct an http URL, it's
> very easy.
>
> To recognize the normative license I apply a few regexps on the license
> name. I haven't found any real normative list of URLs for license so I've
> tried to point to the license author or opensource.org when there's no
> definitive one. Although if someone can give me authoritative URLs I'd be
> happy to use those. Here is what it looks like:
>
>      [/Apache.*2/, "http://www.apache.org/licenses/LICENSE-2.0.txt";],
>      [/Apache.*1\.1/, "http://www.apache.org/licenses/LICENSE-1.1";],
>      [/Apache/, "http://www.apache.org/licenses/LICENSE-1.0";],
>      [/BSD/, "http://www.opensource.org/licenses/bsd-license.php";],
>      [/Public Domain/, "http://creativecommons.org/licenses/publicdomain/
> "],
>      [/(LGPL)|(GNU (Library|Lesser)).*3/, "
> http://www.gnu.org/licenses/lgpl-3.0.txt";],
>      [/(LGPL)|(GNU (Library|Lesser))/, "
> http://opensource.org/licenses/lgpl-license.php";],
>      [/(GPL)|(GNU (General)? Public License).*3/, "

See next comment.

> http://www.gnu.org/licenses/gpl-3.0.txt";],
>      [/(GPL)|(GNU (General)? Public License)/, "

I think you've forced an extra space here; should probably be:

[/(GPL)|(GNU\s+(General\s+)?Public License)/, "

> http://opensource.org/licenses/gpl-license.php";],
>      [/(MIT)|(Massachusetts)/, "
> http://opensource.org/licenses/mit-license.php";],
>      [/.*/, "Unknown"]
>
> Those are applied in the provided order.
>
> Looks good?

Minor point: depending on what you are matching against, you might
need to tighten the regexes somewhat. ".*" is greedy (and relatively
expensive). Using something like [^\d]* is cheaper than .*\d. The last
RE should be /./

Also, it might perhaps be an idea to include the original licence
string (which you match against) in the RDF. This would be useful for
debugging, if nothing else..

S///.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to