pyLodStorage 0.0.1__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/PKG-INFO +15 -1
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/README.md +14 -0
- {pylodstorage-0.0.1/storage → pylodstorage-0.0.3/lodstorage}/uml.py +62 -10
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/pylodstorage.egg-info/PKG-INFO +15 -1
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/pylodstorage.egg-info/SOURCES.txt +5 -5
- pylodstorage-0.0.3/pylodstorage.egg-info/top_level.txt +1 -0
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/setup.py +2 -2
- pylodstorage-0.0.1/pylodstorage.egg-info/top_level.txt +0 -1
- {pylodstorage-0.0.1/storage → pylodstorage-0.0.3/lodstorage}/__init__.py +0 -0
- {pylodstorage-0.0.1/storage → pylodstorage-0.0.3/lodstorage}/sample.py +0 -0
- {pylodstorage-0.0.1/storage → pylodstorage-0.0.3/lodstorage}/sql.py +0 -0
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.0.1 → pylodstorage-0.0.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pylodstorage
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: python List of Dict (Table) Storage library
|
|
5
5
|
Home-page: https://github.com/WolfgangFahl/pyLodStorage
|
|
6
6
|
Author: Wolfgang Fahl
|
|
@@ -26,6 +26,20 @@ Description: # pyLoDStorage
|
|
|
26
26
|
pip install pylodstorage
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
Get Sources
|
|
30
|
+
===========
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/WolfgangFahl/pyLoDStorage
|
|
33
|
+
cd pyLodStorage
|
|
34
|
+
scripts/install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Testing
|
|
38
|
+
=======
|
|
39
|
+
```bash
|
|
40
|
+
scripts/test
|
|
41
|
+
```
|
|
42
|
+
|
|
29
43
|
Usage
|
|
30
44
|
=====
|
|
31
45
|
see [test cases](https://github.com/WolfgangFahl/pyLoDStorage/tests)
|
|
@@ -17,6 +17,20 @@ Installation
|
|
|
17
17
|
pip install pylodstorage
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
+
Get Sources
|
|
21
|
+
===========
|
|
22
|
+
```bash
|
|
23
|
+
git clone https://github.com/WolfgangFahl/pyLoDStorage
|
|
24
|
+
cd pyLodStorage
|
|
25
|
+
scripts/install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Testing
|
|
29
|
+
=======
|
|
30
|
+
```bash
|
|
31
|
+
scripts/test
|
|
32
|
+
```
|
|
33
|
+
|
|
20
34
|
Usage
|
|
21
35
|
=====
|
|
22
36
|
see [test cases](https://github.com/WolfgangFahl/pyLoDStorage/tests)
|
|
@@ -4,7 +4,6 @@ Created on 2020-09-04
|
|
|
4
4
|
@author: wf
|
|
5
5
|
'''
|
|
6
6
|
from collections import Counter
|
|
7
|
-
|
|
8
7
|
class UML(object):
|
|
9
8
|
'''
|
|
10
9
|
UML diagrams via plantuml
|
|
@@ -114,10 +113,15 @@ hide Circle
|
|
|
114
113
|
'''
|
|
115
114
|
gCol=None
|
|
116
115
|
for table in tableList:
|
|
117
|
-
for col in table['columns']:
|
|
116
|
+
for col in table['columns']:
|
|
118
117
|
if col['name']==colName:
|
|
119
|
-
gCol=col
|
|
120
|
-
|
|
118
|
+
gCol=col.copy()
|
|
119
|
+
# no linking yet @FIXME - will need this later
|
|
120
|
+
if 'link' in gCol:
|
|
121
|
+
gCol.pop('link')
|
|
122
|
+
# is generalization protected for this column?
|
|
123
|
+
if not 'special' in col or not col['special']:
|
|
124
|
+
table['columns'].remove(col)
|
|
121
125
|
return gCol
|
|
122
126
|
|
|
123
127
|
def getGeneral(self,tableList,name):
|
|
@@ -145,12 +149,13 @@ hide Circle
|
|
|
145
149
|
general['columns'].append(generalCol)
|
|
146
150
|
return general
|
|
147
151
|
|
|
148
|
-
def tableListToPlantUml(self,tableList,
|
|
152
|
+
def tableListToPlantUml(self,tableList,title=None,packageName=None,generalizeTo=None,withSkin=True):
|
|
149
153
|
'''
|
|
150
154
|
convert tableList to PlantUml notation
|
|
151
155
|
|
|
152
156
|
Args:
|
|
153
157
|
tableList(list): the tableList list of Dicts from getTableList() to convert
|
|
158
|
+
title(string): optional title to be added
|
|
154
159
|
packageName(string): optional packageName to be added
|
|
155
160
|
generalizeTo(string): optional name of a general table to be derived
|
|
156
161
|
withSkin(boolean): if True add default BITPlan skin parameters
|
|
@@ -161,6 +166,8 @@ hide Circle
|
|
|
161
166
|
uml=""
|
|
162
167
|
indent=""
|
|
163
168
|
inherit=""
|
|
169
|
+
if title is not None:
|
|
170
|
+
uml+="title\n%s\nend title\n" % title
|
|
164
171
|
if packageName is not None:
|
|
165
172
|
uml+="package %s {\n" % packageName
|
|
166
173
|
indent=" "
|
|
@@ -171,11 +178,19 @@ hide Circle
|
|
|
171
178
|
tableList.insert(0,generalTable)
|
|
172
179
|
for table in tableList:
|
|
173
180
|
colUml=""
|
|
174
|
-
|
|
181
|
+
sortedColumns=sorted(table['columns'],key=lambda col:col['name'])
|
|
182
|
+
for col in sortedColumns:
|
|
175
183
|
mandatory="*" if col['notnull']==1 else ""
|
|
176
184
|
pk="<<PK>>" if col['pk']==1 else ""
|
|
177
|
-
|
|
178
|
-
|
|
185
|
+
colName=col['name']
|
|
186
|
+
colType=col['type']
|
|
187
|
+
if 'link' in col:
|
|
188
|
+
colName=col['link']
|
|
189
|
+
colUml+="%s %s%s : %s %s\n" % (indent,mandatory,colName,colType,pk)
|
|
190
|
+
tableName=table['name']
|
|
191
|
+
if 'notes' in table:
|
|
192
|
+
uml+="Note top of %s\n%s\nEnd note\n" % (tableName,table['notes'])
|
|
193
|
+
uml+="%sclass %s << Entity >> {\n%s%s}\n" % (indent,tableName,colUml,indent)
|
|
179
194
|
uml+=inherit
|
|
180
195
|
if packageName is not None:
|
|
181
196
|
uml+="}\n"
|
|
@@ -183,5 +198,42 @@ hide Circle
|
|
|
183
198
|
uml+=UML.skinparams
|
|
184
199
|
return uml
|
|
185
200
|
|
|
186
|
-
|
|
187
|
-
|
|
201
|
+
def mergeSchema(self,schemaManager,tableList, title=None,packageName=None,generalizeTo=None,withSkin=True):
|
|
202
|
+
'''
|
|
203
|
+
merge Schema and tableList to PlantUml notation
|
|
204
|
+
|
|
205
|
+
Args:
|
|
206
|
+
schemaManager(SchemaManager): a schema manager to be used
|
|
207
|
+
tableList(list): the tableList list of Dicts from getTableList() to convert
|
|
208
|
+
title(string): optional title to be added
|
|
209
|
+
packageName(string): optional packageName to be added
|
|
210
|
+
generalizeTo(string): optional name of a general table to be derived
|
|
211
|
+
withSkin(boolean): if True add default BITPlan skin parameters
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
string: the Plantuml notation for the entities in columns of the given tablelist
|
|
215
|
+
|
|
216
|
+
'''
|
|
217
|
+
if schemaManager is not None:
|
|
218
|
+
for table in tableList:
|
|
219
|
+
if 'schema' in table:
|
|
220
|
+
schema=schemaManager.schemasByName[table['schema']]
|
|
221
|
+
url="%s/%s" % (schemaManager.baseUrl,schema.name)
|
|
222
|
+
url=url.replace(" ", "_") # mediawiki
|
|
223
|
+
instanceNote=""
|
|
224
|
+
if 'instances' in table:
|
|
225
|
+
instanceNote="\n%d instances " % (table['instances'])
|
|
226
|
+
table['notes']="""[[%s %s]]%s""" % (url,schema.name,instanceNote)
|
|
227
|
+
for col in table['columns']:
|
|
228
|
+
colName=col['name']
|
|
229
|
+
if colName in schema.propsByName:
|
|
230
|
+
prop=schema.propsByName[colName]
|
|
231
|
+
if prop.iri is not None:
|
|
232
|
+
tooltip=""
|
|
233
|
+
if prop.definition is not None:
|
|
234
|
+
tooltip="{%s}" % prop.definition
|
|
235
|
+
col['link']="[[%s%s %s]]" % (prop.iri,tooltip,colName)
|
|
236
|
+
col['special']=True # keep column even if generalized
|
|
237
|
+
pass
|
|
238
|
+
plantuml=self.tableListToPlantUml(tableList, title=title,packageName=packageName, generalizeTo=generalizeTo, withSkin=withSkin)
|
|
239
|
+
return plantuml
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pylodstorage
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: python List of Dict (Table) Storage library
|
|
5
5
|
Home-page: https://github.com/WolfgangFahl/pyLodStorage
|
|
6
6
|
Author: Wolfgang Fahl
|
|
@@ -26,6 +26,20 @@ Description: # pyLoDStorage
|
|
|
26
26
|
pip install pylodstorage
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
Get Sources
|
|
30
|
+
===========
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/WolfgangFahl/pyLoDStorage
|
|
33
|
+
cd pyLodStorage
|
|
34
|
+
scripts/install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Testing
|
|
38
|
+
=======
|
|
39
|
+
```bash
|
|
40
|
+
scripts/test
|
|
41
|
+
```
|
|
42
|
+
|
|
29
43
|
Usage
|
|
30
44
|
=====
|
|
31
45
|
see [test cases](https://github.com/WolfgangFahl/pyLoDStorage/tests)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
README.md
|
|
2
2
|
setup.py
|
|
3
|
+
lodstorage/__init__.py
|
|
4
|
+
lodstorage/sample.py
|
|
5
|
+
lodstorage/sql.py
|
|
6
|
+
lodstorage/uml.py
|
|
3
7
|
pylodstorage.egg-info/PKG-INFO
|
|
4
8
|
pylodstorage.egg-info/SOURCES.txt
|
|
5
9
|
pylodstorage.egg-info/dependency_links.txt
|
|
6
|
-
pylodstorage.egg-info/top_level.txt
|
|
7
|
-
storage/__init__.py
|
|
8
|
-
storage/sample.py
|
|
9
|
-
storage/sql.py
|
|
10
|
-
storage/uml.py
|
|
10
|
+
pylodstorage.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lodstorage
|
|
@@ -10,9 +10,9 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
|
|
10
10
|
|
|
11
11
|
setup(
|
|
12
12
|
name='pylodstorage',
|
|
13
|
-
version='0.0.
|
|
13
|
+
version='0.0.3',
|
|
14
14
|
|
|
15
|
-
packages=['
|
|
15
|
+
packages=['lodstorage',],
|
|
16
16
|
author='Wolfgang Fahl',
|
|
17
17
|
author_email='wf@bitplan.com',
|
|
18
18
|
maintainer='Wolfgang Fahl',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
storage
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|