Commit 517160ab authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[profile gen] Consider keyword type in SEDA 1.0 / 0.2 export

Related to #16269136
parent 1dff1e214a1c
......@@ -165,6 +165,11 @@ class SEDAKeyword(generated.SEDAKeyword):
return (self.reverse_seda_keyword_reference_from[0]
if self.reverse_seda_keyword_reference_from else None)
@property
def type(self):
return (self.reverse_seda_keyword_type_from[0]
if self.reverse_seda_keyword_type_from else None)
class SEDAKeywordReference(generated.SEDAKeywordReference):
......@@ -178,6 +183,13 @@ class SEDAKeywordReference(generated.SEDAKeywordReference):
return self.seda_keyword_reference_to[0] if self.seda_keyword_reference_to else None
class SEDAKeywordType(generated.SEDAKeywordType):
@property
def concept(self):
return self.seda_keyword_type_to[0] if self.seda_keyword_type_to else None
class RuleMixIn(object):
@property
......
......@@ -1066,7 +1066,13 @@ class SEDA1XSDExport(SEDA2XSDExport):
documentation=keyword.reference.user_annotation,
fixed_value=url,
xsd_attributes=self.xsd_attributes_scheme(scheme))
# XXX keyword type
if keyword.type:
self.element_schema(kw_node, 'KeywordType', 'qdt:CodeKeywordType',
cardinality=keyword.type.user_cardinality,
documentation=keyword.type.user_annotation,
fixed_value=_concept_value(keyword.type.concept,
self.concepts_language),
xsd_attributes=[LIST_VERSION_ID_2009])
def xsd_children(self, parent, entity):
"""Iter on archive/archive object children, which may be either
......
......@@ -89,6 +89,14 @@
<rng:value type="string">%(concept-uri)s</rng:value>
</rng:element>
</rng:optional>
<rng:optional>
<rng:element name="KeywordType">
<rng:attribute name="listVersionID">
<rng:value type="token">edition 2009</rng:value>
</rng:attribute>
<rng:data type="string"/>
</rng:element>
</rng:optional>
</rng:element>
</rng:zeroOrMore>
</rng:element>
......
......@@ -151,6 +151,15 @@
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" name="KeywordType">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="qdt:CodeKeywordType">
<xsd:attribute fixed="edition 2009" name="listVersionID" type="xsd:token" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:ID" use="prohibited"/>
</xsd:complexType>
......
......@@ -98,6 +98,14 @@
<rng:value type="string">%(concept-uri)s</rng:value>
</rng:element>
</rng:optional>
<rng:optional>
<rng:element name="KeywordType">
<rng:attribute name="listVersionID">
<rng:value type="token">edition 2009</rng:value>
</rng:attribute>
<rng:data type="string"/>
</rng:element>
</rng:optional>
</rng:element>
</rng:zeroOrMore>
</rng:element>
......
......@@ -152,6 +152,15 @@
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" name="KeywordType">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="qdt:CodeKeywordType">
<xsd:attribute fixed="edition 2009" name="listVersionID" type="xsd:token" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:ID" use="prohibited"/>
</xsd:complexType>
......
......@@ -723,6 +723,9 @@ class OldSEDAExportMixin(object):
seda_keyword_reference_from=kw,
seda_keyword_reference_to=concepts['file'],
seda_keyword_reference_to_scheme=concepts['file'].scheme)
create('SEDAKeywordType',
seda_keyword_type_from=kw,
user_cardinality=u'0..1')
cnx.create_entity('SEDAType', seda_type_from=content,
seda_type_to=concepts['CDO'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment