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-- |
0 | 1 |
"""Set of HTML startup views. A startup view is global, e.g. doesn't |
2 |
apply to a result set. |
|
3 |
||
4 |
:organization: Logilab |
|
5 |
:copyright: 2001-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
|
6 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
7 |
""" |
|
8 |
__docformat__ = "restructuredtext en" |
|
9 |
||
10 |
from logilab.mtconverter import html_escape |
|
11 |
||
12 |
from cubicweb.common.uilib import ureport_as_html, unormalize, ajax_replace_url |
|
13 |
from cubicweb.common.view import StartupView |
|
14 |
from cubicweb.web.httpcache import EtagHTTPCacheManager |
|
15 |
||
16 |
_ = unicode |
|
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 | 37 |
|
38 |
class ManageView(StartupView): |
|
39 |
id = 'manage' |
|
40 |
title = _('manage') |
|
41 |
http_cache_manager = EtagHTTPCacheManager |
|
42 |
||
43 |
def display_folders(self): |
|
44 |
return False |
|
45 |
||
46 |
def call(self, **kwargs): |
|
47 |
"""The default view representing the application's management""" |
|
48 |
self.w(u'<div>\n') |
|
49 |
if not self.display_folders(): |
|
50 |
self._main_index() |
|
51 |
else: |
|
52 |
self.w(u'<table><tr>\n') |
|
53 |
self.w(u'<td style="width:40%">') |
|
54 |
self._main_index() |
|
55 |
self.w(u'</td><td style="width:60%">') |
|
56 |
self.folders() |
|
57 |
self.w(u'</td>') |
|
58 |
self.w(u'</tr></table>\n') |
|
59 |
self.w(u'</div>\n') |
|
60 |
||
61 |
def _main_index(self): |
|
62 |
req = self.req |
|
63 |
manager = req.user.matching_groups('managers') |
|
64 |
if not manager and 'Card' in self.schema: |
|
65 |
rset = self.req.execute('Card X WHERE X wikiid "index"') |
|
66 |
else: |
|
67 |
rset = None |
|
68 |
if rset: |
|
69 |
self.wview('inlined', rset, row=0) |
|
70 |
else: |
|
71 |
self.entities() |
|
72 |
self.w(u'<div class="hr"> </div>') |
|
73 |
self.startup_views() |
|
74 |
if manager and 'Card' in self.schema: |
|
75 |
self.w(u'<div class="hr"> </div>') |
|
76 |
if rset: |
|
77 |
href = rset.get_entity(0, 0).absolute_url(vid='edition') |
|
78 |
label = self.req._('edit the index page') |
|
79 |
else: |
|
80 |
href = req.build_url('view', vid='creation', etype='Card', wikiid='index') |
|
81 |
label = self.req._('create an index page') |
|
82 |
self.w(u'<br/><a href="%s">%s</a>\n' % (html_escape(href), label)) |
|
83 |
||
84 |
def folders(self): |
|
85 |
self.w(u'<h4>%s</h4>\n' % self.req._('Browse by category')) |
|
86 |
self.vreg.select_view('tree', self.req, None).dispatch(w=self.w) |
|
87 |
||
88 |
def startup_views(self): |
|
89 |
self.w(u'<h4>%s</h4>\n' % self.req._('Startup views')) |
|
90 |
self.startupviews_table() |
|
91 |
||
92 |
def startupviews_table(self): |
|
93 |
for v in self.vreg.possible_views(self.req, None): |
|
94 |
if v.category != 'startupview' or v.id in ('index', 'tree', 'manage'): |
|
95 |
continue |
|
96 |
self.w('<p><a href="%s">%s</a></p>' % ( |
|
97 |
html_escape(v.url()), html_escape(self.req._(v.title).capitalize()))) |
|
98 |
||
99 |
def entities(self): |
|
100 |
schema = self.schema |
|
101 |
self.w(u'<h4>%s</h4>\n' % self.req._('The repository holds the following entities')) |
|
102 |
manager = self.req.user.matching_groups('managers') |
|
103 |
self.w(u'<table class="startup">') |
|
104 |
if manager: |
|
105 |
self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self.req._('application entities')) |
|
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 | 108 |
if manager: |
109 |
self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self.req._('system entities')) |
|
110 |
self.entity_types_table(eschema for eschema in schema.entities() |
|
111 |
if eschema.meta and not eschema.schema_entity()) |
|
112 |
if 'EFRDef' in schema: # check schema support |
|
113 |
self.w(u'<tr><th colspan="4">%s</th></tr>\n' % self.req._('schema entities')) |
|
114 |
self.entity_types_table(schema.eschema(etype) |
|
115 |
for etype in schema.schema_entity_types()) |
|
116 |
self.w(u'</table>') |
|
117 |
||
118 |
def entity_types_table(self, eschemas): |
|
119 |
newline = 0 |
|
120 |
infos = sorted(self.entity_types(eschemas), |
|
121 |
key=lambda (l,a,e):unormalize(l)) |
|
122 |
q, r = divmod(len(infos), 2) |
|
123 |
if r: |
|
124 |
infos.append( (None, ' ', ' ') ) |
|
125 |
infos = zip(infos[:q+r], infos[q+r:]) |
|
126 |
for (_, etypelink, addlink), (_, etypelink2, addlink2) in infos: |
|
127 |
self.w(u'<tr>\n') |
|
128 |
self.w(u'<td class="addcol">%s</td><td>%s</td>\n' % (addlink, etypelink)) |
|
129 |
self.w(u'<td class="addcol">%s</td><td>%s</td>\n' % (addlink2, etypelink2)) |
|
130 |
self.w(u'</tr>\n') |
|
131 |
||
132 |
||
133 |
def entity_types(self, eschemas): |
|
134 |
"""return a list of formatted links to get a list of entities of |
|
135 |
a each entity's types |
|
136 |
""" |
|
137 |
req = self.req |
|
138 |
for eschema in eschemas: |
|
139 |
if eschema.is_final() or (not eschema.has_perm(req, 'read') and |
|
140 |
not eschema.has_local_role('read')): |
|
141 |
continue |
|
142 |
etype = eschema.type |
|
143 |
label = display_name(req, etype, 'plural') |
|
144 |
nb = req.execute('Any COUNT(X) WHERE X is %s' % etype)[0][0] |
|
145 |
if nb > 1: |
|
146 |
view = self.vreg.select_view('list', req, req.etype_rset(etype)) |
|
147 |
url = view.url() |
|
148 |
else: |
|
149 |
url = self.build_url('view', rql='%s X' % etype) |
|
150 |
etypelink = u' <a href="%s">%s</a> (%d)' % ( |
|
151 |
html_escape(url), label, nb) |
|
152 |
yield (label, etypelink, self.add_entity_link(eschema, req)) |
|
153 |
||
154 |
def add_entity_link(self, eschema, req): |
|
155 |
"""creates a [+] link for adding an entity if user has permission to do so""" |
|
156 |
if not eschema.has_perm(req, 'add'): |
|
157 |
return u'' |
|
158 |
return u'[<a href="%s" title="%s">+</a>]' % ( |
|
159 |
html_escape(self.create_url(eschema.type)), |
|
160 |
self.req.__('add a %s' % eschema)) |
|
161 |
||
162 |
||
163 |
class IndexView(ManageView): |
|
164 |
id = 'index' |
|
165 |
title = _('index') |
|
166 |
||
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 | 169 |
|
170 |
||
171 |
||
172 |
class SchemaView(StartupView): |
|
173 |
id = 'schema' |
|
174 |
title = _('application schema') |
|
175 |
||
176 |
def call(self): |
|
177 |
"""display schema information""" |
|
178 |
self.req.add_js('cubicweb.ajax.js') |
|
179 |
self.req.add_css('cubicweb.schema.css') |
|
180 |
withmeta = int(self.req.form.get('withmeta', 0)) |
|
181 |
self.w(u'<img src="%s" alt="%s"/>\n' % ( |
|
182 |
html_escape(self.req.build_url('view', vid='schemagraph', withmeta=withmeta)), |
|
183 |
self.req._("graphical representation of the application'schema"))) |
|
184 |
if withmeta: |
|
185 |
self.w(u'<div><a href="%s">%s</a></div>' % ( |
|
186 |
self.build_url('schema', withmeta=0), |
|
187 |
self.req._('hide meta-data'))) |
|
188 |
else: |
|
189 |
self.w(u'<div><a href="%s">%s</a></div>' % ( |
|
190 |
self.build_url('schema', withmeta=1), |
|
191 |
self.req._('show meta-data'))) |
|
192 |
self.w(u'<div id="detailed_schema"><a href="%s">%s</a></div>' % |
|
193 |
(html_escape(ajax_replace_url('detailed_schema', '', 'schematext', |
|
194 |
skipmeta=int(not withmeta))), |
|
195 |
self.req._('detailed schema view'))) |
|
196 |
||
197 |
||
198 |
class SchemaUreportsView(StartupView): |
|
199 |
id = 'schematext' |
|
200 |
||
201 |
def call(self): |
|
202 |
from cubicweb.schemaviewer import SchemaViewer |
|
203 |
skipmeta = int(self.req.form.get('skipmeta', True)) |
|
204 |
schema = self.schema |
|
205 |
viewer = SchemaViewer(self.req) |
|
206 |
layout = viewer.visit_schema(schema, display_relations=True, |
|
207 |
skiprels=('is', 'is_instance_of', 'identity', |
|
208 |
'owned_by', 'created_by'), |
|
209 |
skipmeta=skipmeta) |
|
210 |
self.w(ureport_as_html(layout)) |
|
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 |