Service Web revendeur/Schéma pour les métadonnées à destination des revendeurs (format Relax NG, version compacte)

Un article de DocuWiki.

############################################################
# Metadata for resellers of digital offers from publishers #
############################################################

#default namespace = "http://revendeurs.immateriel.fr/metadata"
start = response
response = element response { result+ }
result = element result { result_type, result_content+ }
result_type = attribute type { result_type.datatype } 
result_content = element book { product_id, book_content }

product_id = attribute isbn { ean.datatype }
book_content = title & edition & publisher & avail & pubdate & lang? & collection? 
 & summary? & description? & categories? & previews? & contributors & offres

avail = element available { boolean.datatype } | attribute available { boolean.datatype }
title = element title { text }
edition = element edition { xsd:positiveInteger? }
publisher = element publisher {publisher_id, text}
publisher_id = attribute id { publisher_id.datatype }
pubdate = element published_at { xsd:date }
lang = element language { lang.datatype }
collection = element collection { text }
summary = element summary { text }
description = element description { text }

categories = keywords? & subjects?
keywords = element keywords { keyword+ }
keyword = element keyword { text }
subjects = bisac_code
bisac_code = element bisac_subject { bisac_code.datatype }

previews = element previews { preview+ }
preview = element preview { (\start & end), link }
\start = attribute start_page { xsd:positiveInteger }
end = attribute end_page { xsd:positiveInteger }
link = xsd:anyURI

contributors = authors & author_obsolete+
authors = element authors { author+ }
author = element author { author_id, (author_name & author_bio?) }
author_id = attribute id { author_id.datatype }
author_name = element name { text }
author_bio = element biography { text }
# simple variant provided for early adopters
author_obsolete = element author { text }

offres = products & obsolete_product
products = element products { product+ }
product = element product { (price & avail & product_id & label), resources }

# monoproduct variant provided for early adopters 
obsolete_product = label & price & resources
label = element label { text } | attribute label { text }
price = element price { price.datatype} | attribute price { price.datatype }
resources = element resources { resource+ }
resource = element resource { mime & support & protection? & name & format & dim? & empty }
mime = attribute mimetype { mime.datatype }
support = attribute support { support.datatype }
protection = attribute protection { protection.datatype }
name = attribute name { text }
format = attribute format_key { format.datatype }
dim = height? & width?
height = attribute height {dim.datatype}
width = attribute width {dim.datatype} 

###
# Data types
boolean.datatype = "true" | "false"
ean.datatype = xsd:token { length="17" pattern="978-[\-0-9]{13}" } 
 | xsd:token { length="13" pattern="978[0-9]{10}" } 
lang.datatype = xsd:token { length="2" pattern="[a-zA-Z]{2}"}
price.datatype =  xsd:decimal { minInclusive="0" fractionDigits="2" }
bisac_code.datatype = xsd:token { length="9" pattern="[a-zA-Z]{3}[0-9]{6}" }
mime.datatype = "audio/mpeg3" | "application/pdf" | "text/html" | "application/zip" | "application/x-mobipocket" 
 | "application/x-rar-compressed" | "application/epub+zip"
support.datatype = "immateriel" | "physical"
result_type.datatype = "Books"
format.datatype = "mp3" | "pdf" | "imr" | "prc" | "epub" | "html" | "rar" | "zip"
# format.datatype = text
protection.datatype = "none" | "watermark" | "streaming" | "drm"
publisher_id.datatype = text
author_id.datatype = text
dim.datatype = xsd:positiveInteger
Outils personnels