web/views/startup.py
author Laure Bourgois <Laure.Bourgois@logilab.fr>
Wed, 21 Jan 2009 14:40:52 +0100
changeset 453 d1b72b31e315
parent 452 8dd71540902f
child 460 5cd2b27d5435
permissions -rw-r--r--
ontology comment
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
"""Set of HTML startup views. A startup view is global, e.g. doesn't
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
apply to a result set.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     4
:organization: Logilab
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
__docformat__ = "restructuredtext en"
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     9
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    10
from logilab.mtconverter import html_escape
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    11
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    12
from cubicweb.common.uilib import ureport_as_html, unormalize, ajax_replace_url
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    13
from cubicweb.common.view import StartupView
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    14
from cubicweb.web.httpcache import EtagHTTPCacheManager
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    15
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    16
_ = unicode
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
452
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    18
OWL_CARD_MAP = {'1': '''<owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    19
                        <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>''',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    20
                '?': '<owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality>',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    21
                '+': '<owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:minCardinality>',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    22
                '*': '<owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">n</owl:cardinality>'
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    23
                }
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    24
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    25
OWL_CARD_MAP_DATA = {'String': 'xsd:string',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    26
                     'Datetime': 'xsd:dateTime',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    27
                     'Bytes': 'xsd:byte',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    28
                     'Float': 'xsd:float',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    29
                     'Boolean': 'xsd:boolean',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    30
                     'Int': 'xsd:int',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    31
                     'Date':'xsd:date',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    32
                     'Time': 'xsd:time',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    33
                     'Password': 'xsd:byte',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    34
                     'Decimal' : 'xsd:decimal',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    35
                     'Interval': 'xsd:duration'
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
    36
                     }
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    37
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    38
class ManageView(StartupView):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    39
    id = 'manage'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    40
    title = _('manage')    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    41
    http_cache_manager = EtagHTTPCacheManager
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    42
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    43
    def display_folders(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    44
        return False
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    45
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    46
    def call(self, **kwargs):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    47
        """The default view representing the application's management"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    48
        self.w(u'<div>\n')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    49
        if not self.display_folders():
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    50
            self._main_index()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    51
        else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    52
            self.w(u'<table><tr>\n')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    53
            self.w(u'<td style="width:40%">')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    54
            self._main_index()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    55
            self.w(u'</td><td style="width:60%">')            
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    56
            self.folders()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    57
            self.w(u'</td>')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    58
            self.w(u'</tr></table>\n')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    59
        self.w(u'</div>\n')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    60
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    61
    def _main_index(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    62
        req = self.req
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    63
        manager = req.user.matching_groups('managers')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    64
        if not manager and 'Card' in self.schema:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    65
            rset = self.req.execute('Card X WHERE X wikiid "index"')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    66
        else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    67
            rset = None
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    68
        if rset:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    69
            self.wview('inlined', rset, row=0)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    70
        else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    71
            self.entities()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    72
            self.w(u'<div class="hr">&nbsp;</div>')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    73
            self.startup_views()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    74
        if manager and 'Card' in self.schema:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    75
            self.w(u'<div class="hr">&nbsp;</div>')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    76
            if rset:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    77
                href = rset.get_entity(0, 0).absolute_url(vid='edition')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    78
                label = self.req._('edit the index page')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    79
            else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    80
                href = req.build_url('view', vid='creation', etype='Card', wikiid='index')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    81
                label = self.req._('create an index page')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    82
            self.w(u'<br/><a href="%s">%s</a>\n' % (html_escape(href), label))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    83
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    84
    def folders(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    85
        self.w(u'<h4>%s</h4>\n' % self.req._('Browse by category'))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    86
        self.vreg.select_view('tree', self.req, None).dispatch(w=self.w)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    87
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    88
    def startup_views(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    89
        self.w(u'<h4>%s</h4>\n' % self.req._('Startup views'))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    90
        self.startupviews_table()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    91
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    92
    def startupviews_table(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    93
        for v in self.vreg.possible_views(self.req, None):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    94
            if v.category != 'startupview' or v.id in ('index', 'tree', 'manage'):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    95
                continue
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    96
            self.w('<p><a href="%s">%s</a></p>' % (
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    97
                html_escape(v.url()), html_escape(self.req._(v.title).capitalize())))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    98
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    99
    def entities(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   100
        schema = self.schema
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   101
        self.w(u'<h4>%s</h4>\n' % self.req._('The repository holds the following entities'))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   102
        manager = self.req.user.matching_groups('managers')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   103
        self.w(u'<table class="startup">')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   104
        if manager:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   105
            self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self.req._('application entities'))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   106
        self.entity_types_table(eschema for eschema in schema.entities()
178
b5478a96da3d only hide strict suboject in default view
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents: 0
diff changeset
   107
                                if not eschema.meta and not eschema.is_subobject(strict=True))
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   108
        if manager: 
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   109
            self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self.req._('system entities'))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   110
            self.entity_types_table(eschema for eschema in schema.entities()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   111
                                    if eschema.meta and not eschema.schema_entity())
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   112
            if 'EFRDef' in schema: # check schema support
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   113
                self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self.req._('schema entities'))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   114
                self.entity_types_table(schema.eschema(etype)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   115
                                        for etype in schema.schema_entity_types())
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   116
        self.w(u'</table>')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   117
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   118
    def entity_types_table(self, eschemas):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   119
        newline = 0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   120
        infos = sorted(self.entity_types(eschemas),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   121
                       key=lambda (l,a,e):unormalize(l))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   122
        q, r = divmod(len(infos), 2)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   123
        if r:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   124
            infos.append( (None, '&nbsp;', '&nbsp;') )
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   125
        infos = zip(infos[:q+r], infos[q+r:])
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   126
        for (_, etypelink, addlink), (_, etypelink2, addlink2) in infos:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   127
            self.w(u'<tr>\n')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   128
            self.w(u'<td class="addcol">%s</td><td>%s</td>\n' % (addlink,  etypelink))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   129
            self.w(u'<td class="addcol">%s</td><td>%s</td>\n' % (addlink2, etypelink2))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   130
            self.w(u'</tr>\n')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   131
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   132
        
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   133
    def entity_types(self, eschemas):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   134
        """return a list of formatted links to get a list of entities of
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   135
        a each entity's types
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   136
        """
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   137
        req = self.req
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   138
        for eschema in eschemas:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   139
            if eschema.is_final() or (not eschema.has_perm(req, 'read') and
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   140
                                      not eschema.has_local_role('read')):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   141
                continue
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   142
            etype = eschema.type
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   143
            label = display_name(req, etype, 'plural')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   144
            nb = req.execute('Any COUNT(X) WHERE X is %s' % etype)[0][0]
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   145
            if nb > 1:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   146
                view = self.vreg.select_view('list', req, req.etype_rset(etype))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   147
                url = view.url()
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   148
            else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   149
                url = self.build_url('view', rql='%s X' % etype)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   150
            etypelink = u'&nbsp;<a href="%s">%s</a> (%d)' % (
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   151
                html_escape(url), label, nb)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   152
            yield (label, etypelink, self.add_entity_link(eschema, req))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   153
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   154
    def add_entity_link(self, eschema, req):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   155
        """creates a [+] link for adding an entity if user has permission to do so"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   156
        if not eschema.has_perm(req, 'add'):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   157
            return u''
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   158
        return u'[<a href="%s" title="%s">+</a>]' % (
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   159
            html_escape(self.create_url(eschema.type)),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   160
            self.req.__('add a %s' % eschema))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   161
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   162
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   163
class IndexView(ManageView):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   164
    id = 'index'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   165
    title = _('index')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   166
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   167
    def display_folders(self):
329
903eb8c4ebd6 don't show folder section on index page when there is now folder yet
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents: 178
diff changeset
   168
        return 'Folder' in self.schema and self.req.execute('Any COUNT(X) WHERE X is Folder')[0][0]
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   169
    
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   170
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   171
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   172
class SchemaView(StartupView):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   173
    id = 'schema'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   174
    title = _('application schema')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   175
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   176
    def call(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   177
        """display schema information"""
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   178
        self.req.add_js('cubicweb.ajax.js')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   179
        self.req.add_css('cubicweb.schema.css')
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   180
        withmeta = int(self.req.form.get('withmeta', 0))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   181
        self.w(u'<img src="%s" alt="%s"/>\n' % (
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   182
            html_escape(self.req.build_url('view', vid='schemagraph', withmeta=withmeta)),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   183
            self.req._("graphical representation of the application'schema")))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   184
        if withmeta:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   185
            self.w(u'<div><a href="%s">%s</a></div>' % (
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   186
                self.build_url('schema', withmeta=0),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   187
                self.req._('hide meta-data')))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   188
        else:
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   189
            self.w(u'<div><a href="%s">%s</a></div>' % (
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   190
                self.build_url('schema', withmeta=1),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   191
                self.req._('show meta-data')))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   192
        self.w(u'<div id="detailed_schema"><a href="%s">%s</a></div>' %
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   193
               (html_escape(ajax_replace_url('detailed_schema', '', 'schematext',
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   194
                                             skipmeta=int(not withmeta))),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   195
                self.req._('detailed schema view')))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   196
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   197
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   198
class SchemaUreportsView(StartupView):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   199
    id = 'schematext'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   200
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   201
    def call(self):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   202
        from cubicweb.schemaviewer import SchemaViewer
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   203
        skipmeta = int(self.req.form.get('skipmeta', True))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   204
        schema = self.schema
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   205
        viewer = SchemaViewer(self.req)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   206
        layout = viewer.visit_schema(schema, display_relations=True,
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   207
                                     skiprels=('is', 'is_instance_of', 'identity',
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   208
                                               'owned_by', 'created_by'),
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   209
                                     skipmeta=skipmeta)
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   210
        self.w(ureport_as_html(layout))
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
   211
452
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   212
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   213
class OWLView(StartupView):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   214
    id = 'owl'
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   215
    title = _('owl')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   216
    templatable =False
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   217
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   218
    def call(self):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   219
        skipmeta = int(self.req.form.get('skipmeta', True))
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   220
        self.visit_schemaOWL(display_relations=True,
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   221
                             skiprels=('is', 'is_instance_of', 'identity',
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   222
                                       'owned_by', 'created_by'),
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   223
                             skipmeta=skipmeta)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   224
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   225
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   226
    def visit_schemaOWL(self, display_relations=0,
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   227
                     skiprels=(), skipmeta=True):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   228
        """get a layout for a whole schema"""
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   229
        self.w(u'''<?xml version="1.0" encoding="UTF-8"?>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   230
        <!DOCTYPE rdf:RDF [
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   231
        <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   232
        <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   233
        <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   234
        <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   235
        <!ENTITY %s "http://logilab.org/owl/ontologies/%s#" >
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   236
        
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   237
        ]>        
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   238
        <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   239
            xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   240
            xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   241
            xmlns:owl="http://www.w3.org/2002/07/owl#"
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   242
            xmlns="http://logilab.org/owl/ontologies/%s#"
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   243
            xmlns:%s="http://logilab.org/owl/ontologies/%s#"
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   244
            xml:base="http://logilab.org/owl/ontologies/%s#">
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   245
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   246
    <owl:Ontology rdf:about="">
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   247
        <rdfs:comment>
453
d1b72b31e315 ontology comment
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 452
diff changeset
   248
        %s Cubicweb OWL Ontology                           
d1b72b31e315 ontology comment
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 452
diff changeset
   249
                                        
452
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   250
        </rdfs:comment>
453
d1b72b31e315 ontology comment
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 452
diff changeset
   251
        ''' % (self.schema.name, self.schema.name, self.schema.name, self.schema.name, self.schema.name, self.schema.name, self.schema.name))
452
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   252
        entities = [eschema for eschema in self.schema.entities()
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   253
                    if not eschema.is_final()]
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   254
        if skipmeta:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   255
            entities = [eschema for eschema in entities
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   256
                        if not eschema.meta]
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   257
        keys = [(eschema.type, eschema) for eschema in entities]
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   258
        self.w(u'<!-- classes definition -->')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   259
        for key, eschema in sorted(keys):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   260
            self.visit_entityschemaOWL(eschema, skiprels)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   261
        self.w(u'<!-- property definition -->')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   262
        self.w(u'<!-- object property -->')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   263
        for key, eschema in sorted(keys):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   264
             self.visit_property_schemaOWL(eschema, skiprels)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   265
        self.w(u'<!-- datatype property -->')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   266
        for key, eschema in sorted(keys):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   267
            self.visit_property_object_schemaOWL(eschema, skiprels)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   268
        self.w(u' </owl:Ontology></rdf:RDF>')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   269
           
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   270
    def eschema_link_url(self, eschema):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   271
        return self.req.build_url('eetype/%s?vid=eschema' % eschema)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   272
    
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   273
    def rschema_link_url(self, rschema):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   274
        return self.req.build_url('ertype/%s?vid=eschema' % rschema)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   275
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   276
    def possible_views(self, etype):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   277
        rset = self.req.etype_rset(etype)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   278
        return [v for v in self._possible_views(self.req, rset)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   279
                if v.category != 'startupview']
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   280
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   281
    def stereotype(self, name):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   282
        return Span((' <<%s>>' % name,), klass='stereotype')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   283
                       
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   284
    def visit_entityschemaOWL(self, eschema, skiprels=()):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   285
        """get a layout for an entity OWL schema"""
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   286
        etype = eschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   287
        
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   288
        if eschema.meta:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   289
            self.stereotype('meta')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   290
            self.w(u'''<owl:Class rdf:ID="%s"><rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   291
                                '''%eschema, stereotype)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   292
        else:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   293
             self.w(u'''<owl:Class rdf:ID="%s"><rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   294
                                '''% eschema)         
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   295
       
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   296
        self.w(u'<!-- relations -->')    
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   297
        for rschema, targetschemas, role in eschema.relation_definitions():
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   298
            if rschema.type in skiprels:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   299
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   300
            if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   301
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   302
            for oeschema in targetschemas:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   303
                label = rschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   304
                if role == 'subject':
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   305
                    card = rschema.rproperty(eschema, oeschema, 'cardinality')[0]
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   306
                else:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   307
                    card = rschema.rproperty(oeschema, eschema, 'cardinality')[1]
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   308
                self.w(u'''<rdfs:subClassOf>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   309
                              <owl:Restriction>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   310
                              <owl:onProperty rdf:resource="#%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   311
                                %s
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   312
                              </owl:Restriction>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   313
                           </rdfs:subClassOf>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   314
                                ''' % (label, OWL_CARD_MAP[card]))
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   315
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   316
        self.w(u'<!-- attributes -->')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   317
              
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   318
        for rschema, aschema in eschema.attribute_definitions():
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   319
            if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   320
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   321
            aname = rschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   322
            if aname == 'eid':
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   323
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   324
            card_data = aschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   325
            self.w(u'''<rdfs:subClassOf>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   326
                              <owl:Restriction>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   327
                                  <owl:onProperty rdf:resource="#%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   328
                                  <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   329
                              </owl:Restriction>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   330
                        </rdfs:subClassOf>'''
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   331
                          
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   332
                   % aname)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   333
        self.w(u'</owl:Class>')
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   334
      
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   335
    def visit_property_schemaOWL(self, eschema, skiprels=()):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   336
        """get a layout for property entity OWL schema"""
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   337
        etype = eschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   338
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   339
        for rschema, targetschemas, role in eschema.relation_definitions():
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   340
            if rschema.type in skiprels:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   341
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   342
            if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   343
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   344
            rschemaurl = self.rschema_link_url(rschema)
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   345
            for oeschema in targetschemas:
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   346
                label = rschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   347
                self.w(u'''<owl:ObjectProperty rdf:ID="%s">
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   348
                              <rdfs:domain rdf:resource="#%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   349
                              <rdfs:range rdf:resource="#%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   350
                           </owl:ObjectProperty>                   
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   351
                             
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   352
                                ''' % (label, eschema, oeschema.type ))
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   353
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   354
    def visit_property_object_schemaOWL(self, eschema, skiprels=()):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   355
               
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   356
        for rschema, aschema in eschema.attribute_definitions():
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   357
            if not (rschema.has_local_role('read') or rschema.has_perm(self.req, 'read')):
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   358
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   359
            aname = rschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   360
            if aname == 'eid':
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   361
                continue
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   362
            card_data = aschema.type
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   363
            self.w(u'''<owl:DatatypeProperty rdf:ID="%s">
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   364
                          <rdfs:domain rdf:resource="#%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   365
                          <rdfs:range rdf:resource="%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   366
                       </owl:DatatypeProperty>'''
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   367
                   % (aname, eschema, OWL_CARD_MAP_DATA[card_data]))
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   368
# <owl:DatatypeProperty rdf:ID="%s"/>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   369
# </owl:DatatypeProperty>
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   370
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   371
        
8dd71540902f OwlView generated a owl layout from schema application. It can be registered with an owl extension.
Laure Bourgois <Laure.Bourgois@logilab.fr>
parents: 329
diff changeset
   372