Difference between revisions of "Liblicense"

From Creative Commons
Jump to: navigation, search
m (Reverted edits by CCID-jeremyhardin (talk) to last revision by Nathan Yergler)
 
(38 intermediate revisions by 9 users not shown)
Line 1: Line 1:
[[Category:Developer]]
+
{{Software Project
[[Category:Metadata]]
+
|Description=Low-level license metadata integration for applications.
[[Category:Desktop]]
+
|Bug tracker=http://code.creativecommons.org/issues/issue?status=-1,1,2,3,4,5,6,7&@sort=-activity&@search_text=&@dispname=liblicense&@filter=status,project&@group=priority&project=4&@columns=id,activity,title,creator,assignedto,status&@pagesize=50&@startwith=0
[[Category:Labs]]
+
|Code repository=http://code.creativecommons.org/viewgit/liblicense.git/
[[Category:Tools]]
+
|Mailing list=http://lists.ibiblio.org/mailman/listinfo/cc-devel
[[Category:Specification]]
+
}}
[[Category:Operating System]]
+
== What is liblicense? ==
[[Category:Technology]]
+
 
[[Category:Integration]]
+
liblicense provides a straight-forward way for developers to build license-aware applications.  liblicense utilizes a pluggable module system for reading and writing metadata from specific file types, allowing extensibility for specific content types.
 +
 
 +
* For a brief introduction video, check [http://blip.tv/file/1142312/ Asheesh Laroia talking about liblicense]
 +
* To see '''liblicense in action''' take a look at [[License tagger]], the cross platform file metadata editor.
  
__TOC__
+
== Features ==
  
'''''I'm currently mucking around with this page; please don't edit until I remove this.'''
+
* Extract and write license information for files
 +
* Supports enumeration of available licenses
 +
* Wraps internationalized license information for Creative Commons licenses
 +
* Bindings for dynamic languages (currently Python and Ruby)
 +
* Extensible support for file types using module system
 +
* No specific GUI library dependency allows applications to build the graphical chooser most appropriate for their platform.
  
A library for managing license metadata, in particular CC licensing information.
+
== Future Improvements ==
  
The idea of this library started out on the [[IRC]] channel, in a discussion on how to best help boost the community of software
+
* Supports [[WebStatement|verification]] URLs for metadata verification
developers working with things related to CC - mostly the metadata format.
 
  
Basically, the idea is to write a portable C library that manages metadata for CC licenses, and a bunch of other licenses of interest to the community.
+
== Architecture ==
 +
[[Image:System_architecture.png]]
  
The library will produce licensing information based on the specifications of calling libraries and programs. In addition to generating text for specific licenses, it will also allow an application to enumerate which licenses are currently available and provide descriptive text for each license, and for license features. It should also provide an easy way to specify "verify at" URLs.
+
[[:Image:System_architecture.svg|Liblicense Architecture - SVG]]
  
The benefit of this library is that applications linking to it can correctly offer licensing choices, and these choices can be transparently updated through package managers as license versions are updated. Human readable descriptions will also be internationalized, preferably using the same .po files used by the CC web site. Hence liblicense will take advantage of package updating and i18n systems to allow applications to always provide c
+
== Bindings ==
current and correct licensing choices and license text.
 
  
Part of the project is also to provide wrappers for the library for other languages, and to help external developers add metadata support to their projects. A good start will probably be to wrap the library for Python, and use it for ccpublisher.
+
* [[Liblicense/Python|Python]]
 +
* [[Liblicense/Ruby|Ruby]]
  
We will also integrate a module system so that libraries can be used to embed and extract metadata in/from common formats.
+
== Media ==
  
As liblicense itself deals only with text strings, we can also make GUI libraries to provide dialogs which present these strings to the user in desktop or web applications. This layering ensures that such dialogs present consistent licensing choices.
+
See [[Operating System Mockups]] for ideas on how '''liblicense''' could be integrated into various platforms.
  
 
== Download ==
 
== Download ==
  
* [https://sourceforge.net/project/showfiles.php?group_id=80503&package_id=238700 Latest Release from Sourceforge.net]
+
* [http://mirrors.creativecommons.org/software/liblicense/liblicense-0.8.1.tar.gz Latest Release tar.gz]
* Checkout liblicense module from [[SVN]]
 
 
* Debian and Ubuntu [http://mirrors.creativecommons.org/packages/ repositories].
 
* Debian and Ubuntu [http://mirrors.creativecommons.org/packages/ repositories].
 
* Read the [[Liblicense tutorial| tutorial]].
 
* Read the [[Liblicense tutorial| tutorial]].
  
=== Screenshots ===
+
=== Developers: Using git ===
<gallery perrow="3">
 
Image:Ll nautilus emblem.png|Nautilus emblem support.
 
Image:Ll nautilus.png|Nautilus file properties.
 
Image:Ll default 2.png|GTK default system license.
 
Image:Ll dolphin.png|KDE4 dolphin file properties.
 
Image:Ll kde default license.png|KDE4 default system license.
 
Image:Journal_start.png |Sugar (OLPC)
 
Image:Journal_entry.png |Sugar (OLPC)
 
Image:Journal_default.png |Sugar (OLPC)
 
</gallery>
 
  
== System Overview ==
+
If you want to check out the source code and develop on it, use this command:
  
=== Purpose ===
+
git clone git://code.creativecommons.org/liblicense.git
To provide a simple way for developers to make their applications license aware. Additionally, supplemental modules aim to provide a method for users to track licenses of files on their system. This project complements [[Companion File metadata specification]] and [[Tracker CC Indexing]].
+
  git submodule init
 +
  git submodule update
  
=== Architecture ===
+
That should give you a working copy you can commit to.  In case you wonder: the latter two commandsfill the directories
[[Image:System_architecture.png]]
+
* icons/jurisdictions
 +
* license.rdf
 +
* licenses
 +
with content from external repositories similar to ''svn:externals'' for Subversion.
  
=== Implementation ===
+
== More Information ==
This library is implemented in C to allow for maximum portability.
 
  
=== Interface ===
+
* [[Liblicense/Releases|Release History]] and [[Liblicense/Roadmap|Roadmap]]
Note: All functions prepended with ll_ in C.  The header file is liblicense.h .
+
* [[Liblicense/Desktop_Integration|Desktop Integration]]
* get_config_modules() - ''returns a null terminates list of available config modules.''
+
* [[Liblicense/Screenshots|Screenshots]]
* get_io_modules() - ''returns a null terminates list of available io modules.''
+
* [[License RDF|RDF Reference]]
* get_module_symbol(module,symbol) - ''returns the requested symbol.''
+
* [[Liblicense/Metadata_Table|File Metadata Information]]
* module_init(module) - ''Loads the module and calls its init function.''
+
* [http://code.creativecommons.org/doc/liblicense/ Library Documentation] (generated from source)
* module_shutdown(module) - ''Calls the shutdown method of the module and unloads it.''
+
* [[Buildbot]] helps test out liblicense on various platforms.
* io_module_mime_types(module0 - ''returns a null-terminated list of the supported mime-types.''
 
* read(filename) - ''returns the uri of the license of the given file.''
 
* module_read(filename,module) - ''returns the uri of the license of the given file while using the given module.''
 
* write(filename,uri) - ''writes the given license to the given file using all applicable modules.''
 
* module_write(filename,module,uri) - ''writes the given license to the given file using the given module.''
 
* set_default(uri)
 
* get_default()
 
* get_jurisdiction(uri) - ''returns the jurisdiction for the given license.''
 
* get_name(uri) – ''returns the name of the license.''
 
* get_version(uri) – ''returns the version of the license.''
 
* get_prohibits(uri)
 
* get_permits(uri)
 
* get_requires(uri)
 
* verify_uri(uri) - ''returns whether or not the given uri is recognized by the system.''
 
* get_all_licenses() - ''returns a list of all general license uris available for new works.''
 
* get_licenses(juris_t) - ''returns alist of all general licenses in a family.''
 
* get_jurisdictions() - ''returns a list of all jurisdictions.''
 
* jurisdiction_name(juris_t) - ''returns the name of the given jurisdiction.''
 
* new_license_chooser(juris_t,char**attributes) - ''creates a structure for searching for licenses based on the given attributes''
 
* get_licenses_from_flags(ll_license_chooser_t*,int permits, int requires, int prohibits) - ''returns a linked-list of matching licenses. The flags given should be OR'ed together and come from the result of ll_attribute_flag()''
 
  
Note: Before using the library in C you must call ll_init() and when done call ll_stop().
+
== See Also ==
==== C List helpers ====
 
Liblicense lists are arrays ended with NULL.
 
* char** ll_new_list(int length) - ''returns a new list of the given size.''
 
* void ll_free_list(char** list) - ''frees the list and its char*s.''
 
* int ll_list_contains(char** haystack,char* needle) - ''returns 1 if the needle is found in the haystack and 0 otherwise.''
 
* int ll_list_index(char** haystack,char* needle) - ''returns the index of the needle in the haystack and -1 otherwise.''
 
* int ll_list_length(char** list) - ''returns the length of the list.''
 
* char* ll_list_mode(char** list,char* ignore) - ''returns a reference to the first occurance of the most abundant char* (by value not pointer) in the list besides the ignore char*.''
 
* void ll_list_print(char** list) - ''prints the list to stdout.''
 
  
=== Config Modules ===
+
* [[Companion File metadata specification]]
* '''init'''() - starts the module
+
* [[Tracker CC Indexing]] - also there is a great chart showing progress on reading/writing different filetypes (copied above).
* '''shutdown'''() - shuts the module down
 
* '''get'''() - returns the current default license uri
 
* '''set'''(uri) - sets the default license uri and returns 0 upon success (non-zero for errors)
 
  
=== I/O Modules ===
+
{{Challenge Enabled}}
I/O modules are shared objects that call LL_MODULE_DEFINE(name,description,version,features,mime_types,init_func,read_func,write_func).
 
  
* '''name'''
+
[[Category:Developer]]
* '''description'''
+
[[Category:Metadata]]
* '''version'''
+
[[Category:Desktop]]
* '''features''' - If the module embeds the license within the file, pass LL_FEATURES_EMBED
+
[[Category:Labs]]
* '''mime_types''' - A space-separated string of supported mime-types, or NULL if mime-type agnostic (i.e. XMP sidecar)
+
[[Category:Tools]]
* '''init_func''' - This function will be called once before the module is used
+
[[Category:Specification]]
* '''read_func''' - Function to be called when requested to read a license from a file.  It takes a filename and returns the license URI, or NULL if no license is present.  Should return an 'int' indicating success or failure.
+
[[Category:Operating System]]
* '''write_func''' - Function to be called when requested to write a license to a file.  The first parameter is the filename and the second is the license URI to write.  Should return an 'int' indicating success or failure.
+
[[Category:Technology]]
 
+
[[Category:Integration]]
=== Bindings ===
 
*Python
 
*Ruby
 
 
 
== License Files (.rdf) ==
 
=== Attributes ===
 
  
* cc:license
+
__NOTOC__
** about
+
{{lowercase}}
** permits
 
** requires
 
** prohibits
 
* dc:title - The human readable name of the license.
 
* dc:description - Description of the license.
 
* dc:coverage - The jurisdiction of the license. (country code from [http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html ISO3166])
 
* dc:relation
 
** hasVersion - version number
 
** isReplacedBy - indicates retired license ([http://www.ietf.org/rfc/rfc2396.txt URI])
 
** isBasedOn - indicates ported version ([http://www.ietf.org/rfc/rfc2396.txt URI])
 
* dc:type - always "License"
 
* dc:creator
 
* dc:publisher
 
* dc:identifier - URI of license ([http://www.ietf.org/rfc/rfc2396.txt URI])
 
 
 
=== Example ===
 
<pre><rdf:RDF
 
  xmlns="http://creativecommons.org/ns#"
 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
 
  xmlns:dcq="http://purl.org/dc/terms/"
 
>
 
  <rdf:Description rdf:about="http://creativecommons.org/licenses/by-nd/2.0/za/">
 
    <dc:title>Creative Commons Attribution No Derivatives</dc:title>
 
    <dc:description>This license allows for redistribution, commercial and non-commercial,
 
as long as it is passed along unchanged and in whole, with credit to you.</dc:description>
 
    <dc:coverage>
 
        <dcq:ISO3166>
 
            <rdf:value>za</rdf:value>
 
        </dcq:ISO3166>
 
    </dc:coverage>
 
    <dc:hasVersion>2.0</dc:hasVersion>
 
    <dc:isReplacedBy>
 
        <dcq:URI>
 
            <rdf:value>http://creativecommons.org/licenses/by-nd/2.5/za/</rdf:value>
 
        </dcq:URI>
 
    </dc:isReplacedBy>
 
    <dc:isBasedOn>
 
        <dcq:URI>
 
            <rdf:value>http://creativecommons.org/licenses/by-nd/2.5/</rdf:value>
 
        </dcq:URI>
 
    </dc:isBasedOn>
 
    <dc:type>License</dc:type>
 
    <dc:creator>iCommons</dc:creator>
 
    <dc:publisher>Creative Commons</dc:publisher>
 
    <dc:identifier>http://creativecommons.org/licenses/by-nd/2.0/za/</dc:identifier>
 
 
 
    <rdf:type rdf:resource="http://creativecommons.org/ns#License"/>
 
    <permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
 
    <permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
 
    <requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
 
    <requires rdf:resource="http://creativecommons.org/ns#Notice"/>
 
  </rdf:Description>
 
</rdf:RDF></pre>
 
 
 
=== Example (i18n) ===
 
<pre><rdf:RDF
 
  xmlns="http://creativecommons.org/ns#"
 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
 
  xmlns:dcq="http://purl.org/dc/terms/"
 
>
 
  <rdf:Description rdf:about="http://creativecommons.org/licenses/by-nd/2.0/">
 
    <dc:title>
 
        <rdf:Alt>
 
            <rdf:li xml:lang="x-default">Creative Commons Attribution No Derivatives</rdf:li>
 
            <rdf:li xml:lang="es-cl">Creative Commons Atribución-SinDerivadas</rdf:li>
 
        </rdf:Alt>
 
    </dc:title>
 
    <dc:description>
 
        <rdf:Alt>
 
            <rdf:li xml:lang="x-default">This license allows for redistribution, commercial and non-commercial,
 
as long as it is passed along unchanged and in whole, with credit to you.</rdf:li>
 
        </rdf:Alt>
 
    </dc:description>
 
    <dc:coverage>
 
        <dcq:ISO3166>
 
            <rdf:value>us</rdf:value>
 
        </dcq:ISO3166>
 
    </dc:coverage>
 
    <dc:hasVersion>2.0</dc:hasVersion>
 
    <dc:isReplacedBy>
 
        <dcq:URI>
 
            <rdf:value>http://creativecommons.org/licenses/by-nd/2.5/</rdf:value>
 
        </dcq:URI>
 
    </dc:isReplacedBy>
 
    <dc:type>License</dc:type>
 
    <dc:creator>Creative Commons</dc:creator>
 
    <dc:publisher>Creative Commons</dc:publisher>
 
    <dc:identifier>http://creativecommons.org/licenses/by-nd/2.0/</dc:identifier>
 
 
 
    <rdf:type rdf:resource="http://creativecommons.org/ns#License"/>
 
    <permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
 
    <permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
 
    <requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
 
    <requires rdf:resource="http://creativecommons.org/ns#Notice"/>
 
  </rdf:Description>
 
</rdf:RDF></pre>
 
 
 
 
 
== More Information ==
 
 
 
* [[Liblicense/Roadmap|Release History and Roadmap]]
 
* [[Liblicense/Desktop_Integration|Desktop Integration]]
 
* RDF Reference
 

Latest revision as of 20:53, 23 September 2015

Description of Software Low-level license metadata integration for applications.
Bug Tracker Link to Bug Tracker
Code Repository Link to Code repository
Mailing List Link to Mailing list

What is liblicense?

liblicense provides a straight-forward way for developers to build license-aware applications. liblicense utilizes a pluggable module system for reading and writing metadata from specific file types, allowing extensibility for specific content types.

Features

  • Extract and write license information for files
  • Supports enumeration of available licenses
  • Wraps internationalized license information for Creative Commons licenses
  • Bindings for dynamic languages (currently Python and Ruby)
  • Extensible support for file types using module system
  • No specific GUI library dependency allows applications to build the graphical chooser most appropriate for their platform.

Future Improvements

Architecture

System architecture.png

Liblicense Architecture - SVG

Bindings

Media

See Operating System Mockups for ideas on how liblicense could be integrated into various platforms.

Download

Developers: Using git

If you want to check out the source code and develop on it, use this command:

git clone git://code.creativecommons.org/liblicense.git
git submodule init
git submodule update

That should give you a working copy you can commit to. In case you wonder: the latter two commandsfill the directories

  • icons/jurisdictions
  • license.rdf
  • licenses

with content from external repositories similar to svn:externals for Subversion.

More Information

See Also


Liblicense
Have an idea about this page? Want to help build the CC ecosystem? Check out the challenges related to Liblicense, or add one of your own below.
Open Challenges
{{#ask: Is Complete::no

Related To::Liblicense|format=table}}

Completed Challenges
{{#ask: Is Complete::yes

Related To::Liblicense|format=table}}

{{#forminput:Challenge|35 Challenge[related_to]=Liblicense }}