- def __repr__(self):
- return 'XMLNamespace(%r)' % self.uri
-
- def __str__(self):
- return '%s' % self.uri
-
-
-class BookInfo(object):
- RDF = XMLNamespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
- DC = XMLNamespace('http://purl.org/dc/elements/1.1/')
-
- mapping = {
- DC('creator') : ('author', str_to_person),
- DC('title') : ('title', str_to_unicode),
- DC('subject.period') : ('epoch', str_to_unicode),
- DC('subject.type') : ('kind', str_to_unicode),
- DC('subject.genre') : ('genre', str_to_unicode),
- DC('date') : ('created_at', str_to_date),
- DC('date.pd') : ('released_to_public_domain_at', str_to_date),
- DC('contributor.translator') : ('translator', str_to_person),
- DC('contributor.technical_editor') : ('technical_editor', str_to_person),
- DC('publisher') : ('publisher', str_to_unicode),
- DC('source') : ('source_name', str_to_unicode),
- DC('source.URL') : ('source_url', str_to_unicode),
- DC('identifier.url') : ('url', str_to_unicode),
- DC('relation.hasPart') : ('parts', str_to_unicode_list),
- DC('rights.license') : ('license', str_to_unicode),
- DC('rights') : ('license_description', str_to_unicode),
- }
+
+class WorkInfo(object):
+ __metaclass__ = DCInfo
+
+ FIELDS = (
+ Field( DCNS('creator.expert'), 'authors_expert', as_person, salias='author', required=False, multiple=True),
+ Field( DCNS('creator.scenario'), 'authors_scenario', as_person, salias='author', required=False, multiple=True),
+ Field( DCNS('creator.textbook'), 'authors_textbook', as_person, salias='author', required=False, multiple=True),
+ Field( DCNS('title'), 'title'),
+ Field( DCNS('type'), 'type', required=False),
+
+ Field( DCNS('contributor.editor'), 'editors', \
+ as_person, salias='editor', multiple=True, default=[]),
+ Field( DCNS('contributor.technical_editor'), 'technical_editors',
+ as_person, salias='technical_editor', multiple=True, default=[]),
+
+ Field( DCNS('date'), 'created_at', as_date),
+ Field( DCNS('date.pd'), 'released_to_public_domain_at', as_date, required=False),
+ Field( DCNS('publisher'), 'publisher'),
+
+ Field( DCNS('subject.competence'), 'competences', multiple=True, required=False),
+ Field( DCNS('subject.curriculum'), 'curriculum', multiple=True, required=False),
+
+ Field( DCNS('language'), 'language'),
+ Field( DCNS('description'), 'description', required=False),
+
+ Field( DCNS('source'), 'source_name', required=False),
+ Field( DCNS('source.URL'), 'source_url', required=False),
+ Field( DCNS('identifier.url'), 'url', WLURI, strict=as_wluri_strict),
+ Field( DCNS('rights.license'), 'license', required=False),
+ Field( DCNS('rights'), 'license_description'),
+ )