diff -r 672acc730ce5 -r d628defebc17 web/views/owl.py --- a/web/views/owl.py Thu May 14 10:24:56 2009 +0200 +++ b/web/views/owl.py Thu May 14 11:38:40 2009 +0200 @@ -14,7 +14,7 @@ _ = unicode -OWL_CARD_MAP = {'1': '', +OWL_CARD_MAP = {'1': '', '?': '1', '+': '1', '*': '' @@ -37,7 +37,7 @@ -]> +]> - %(appid)s Cubicweb OWL Ontology + %(appid)s Cubicweb OWL Ontology ''' @@ -71,7 +71,7 @@ self.visit_schema(skipmeta=skipmeta) if writeprefix: self.w(OWL_CLOSING_ROOT) - + def visit_schema(self, skiprels=DEFAULT_SKIP_RELS, skipmeta=True): """get a layout for a whole schema""" entities = sorted([eschema for eschema in self.schema.entities() @@ -89,8 +89,8 @@ def visit_entityschema(self, eschema, skiprels=()): """get a layout for an entity OWL schema""" - self.w(u''% eschema) - self.w(u'') + self.w(u''% eschema) + self.w(u'') for rschema, targetschemas, role in eschema.relation_definitions(): if rschema.type in skiprels: continue @@ -113,7 +113,7 @@ ''' % (label, cardtag)) self.w(u'') - + for rschema, aschema in eschema.attribute_definitions(): if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')): continue @@ -125,10 +125,10 @@ -''' +''' % aname) self.w(u'') - + def visit_property_schema(self, eschema, skiprels=()): """get a layout for property entity OWL schema""" for rschema, targetschemas, role in eschema.relation_definitions(): @@ -141,7 +141,7 @@ self.w(u''' - + ''' % (label, eschema, oeschema.type)) def visit_property_object_schema(self, eschema): @@ -157,15 +157,15 @@ ''' % (aname, eschema, OWL_TYPE_MAP[aschema.type])) - + class OWLABOXView(EntityView): '''This view represents a part of the ABOX for a given entity.''' - + id = 'owlabox' title = _('owlabox') templatable = False content_type = 'application/xml' # 'text/xml' - + def call(self): self.w(OWL_OPENING_ROOT % {'appid': self.schema.name}) for i in xrange(self.rset.rowcount): @@ -175,9 +175,9 @@ def cell_call(self, row, col, skiprels=DEFAULT_SKIP_RELS): self.wview('owlaboxitem', self.rset, row=row, col=col, skiprels=skiprels) - + class OWLABOXItemView(EntityView): - '''This view represents a part of the ABOX for a given entity.''' + '''This view represents a part of the ABOX for a given entity.''' id = 'owlaboxitem' templatable = False content_type = 'application/xml' # 'text/xml' @@ -208,9 +208,9 @@ if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')): continue if role == 'object': - attr = 'reverse_%s' % rschema.type + attr = 'reverse_%s' % rschema.type else: - attr = rschema.type + attr = rschema.type for x in getattr(entity, attr): self.w(u'<%s>%s %s' % (attr, x.id, x.eid, attr)) self.w(u''% eschema) @@ -219,10 +219,9 @@ class DownloadOWLSchemaAction(Action): id = 'download_as_owl' __select__ = none_rset() & match_view('schema') - + category = 'mainactions' title = _('download schema as owl') - + def url(self): return self.build_url('view', vid='owl') -