equal
deleted
inserted
replaced
7 __docformat__ = "restructuredtext en" |
7 __docformat__ = "restructuredtext en" |
8 |
8 |
9 from logilab.mtconverter import TransformError, xml_escape |
9 from logilab.mtconverter import TransformError, xml_escape |
10 |
10 |
11 from cubicweb.view import StartupView, EntityView |
11 from cubicweb.view import StartupView, EntityView |
|
12 from cubicweb.web.action import Action |
|
13 from cubicweb.selectors import none_rset, match_view |
12 |
14 |
13 _ = unicode |
15 _ = unicode |
14 |
16 |
15 OWL_CARD_MAP = {'1': '<rdf:type rdf:resource="&owl;FunctionalProperty"/>', |
17 OWL_CARD_MAP = {'1': '<rdf:type rdf:resource="&owl;FunctionalProperty"/>', |
16 '?': '<owl:maxCardinality rdf:datatype="&xsd;int">1</owl:maxCardinality>', |
18 '?': '<owl:maxCardinality rdf:datatype="&xsd;int">1</owl:maxCardinality>', |
211 attr = rschema.type |
213 attr = rschema.type |
212 for x in getattr(entity, attr): |
214 for x in getattr(entity, attr): |
213 self.w(u'<%s>%s %s</%s>' % (attr, x.id, x.eid, attr)) |
215 self.w(u'<%s>%s %s</%s>' % (attr, x.id, x.eid, attr)) |
214 self.w(u'</%s>'% eschema) |
216 self.w(u'</%s>'% eschema) |
215 |
217 |
|
218 |
|
219 class DownloadOWLSchemaAction(Action): |
|
220 id = 'download_as_owl' |
|
221 __select__ = none_rset() & match_view('schema') |
|
222 |
|
223 category = 'mainactions' |
|
224 title = _('download schema as owl') |
|
225 |
|
226 def url(self): |
|
227 return self.build_url('view', vid='owl') |
|
228 |