pyLodStorage 0.2.1__tar.gz → 0.2.2__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.2.1 → pylodstorage-0.2.2}/PKG-INFO +1 -1
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/sql.py +20 -5
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/trulytabular.py +9 -2
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/version.py +2 -2
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/PKG-INFO +1 -1
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/trulytabular.yaml +1 -1
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/LICENSE +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/README.md +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/csv.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/entity.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/jsonable.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/jsonpicklemixin.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/lod.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/plot.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/query.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/querymain.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/sample.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/schema.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/sparql.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/uml.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/lodstorage/yamlablemixin.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/SOURCES.txt +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/entry_points.txt +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/requires.txt +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/pylodstorage.egg-info/top_level.txt +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/__init__.py +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/endpoints.yaml +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/formats.yaml +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/queries.yaml +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/scholia.yaml +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/wf.yaml +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/sampledata/wikidata.yaml +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/setup.cfg +0 -0
- {pylodstorage-0.2.1 → pylodstorage-0.2.2}/setup.py +0 -0
|
@@ -173,9 +173,9 @@ class SQLDB(object):
|
|
|
173
173
|
msg="%s\nfailed:%s%s" % (insertCmd,str(ex),debugInfo)
|
|
174
174
|
raise Exception(msg)
|
|
175
175
|
|
|
176
|
-
def
|
|
176
|
+
def queryGen(self,sqlQuery,params=None):
|
|
177
177
|
'''
|
|
178
|
-
run the given sqlQuery
|
|
178
|
+
run the given sqlQuery a a generator for dicts
|
|
179
179
|
|
|
180
180
|
Args:
|
|
181
181
|
|
|
@@ -183,7 +183,7 @@ class SQLDB(object):
|
|
|
183
183
|
params(tuple): the query params, if any
|
|
184
184
|
|
|
185
185
|
Returns:
|
|
186
|
-
|
|
186
|
+
a generator of dicts
|
|
187
187
|
'''
|
|
188
188
|
if self.debug:
|
|
189
189
|
print(sqlQuery)
|
|
@@ -196,17 +196,32 @@ class SQLDB(object):
|
|
|
196
196
|
else:
|
|
197
197
|
query = cur.execute(sqlQuery)
|
|
198
198
|
colname = [ d[0] for d in query.description ]
|
|
199
|
-
resultList=[]
|
|
200
199
|
try:
|
|
201
200
|
# loop over all rows
|
|
202
201
|
for row in query:
|
|
203
202
|
record=dict(zip(colname, row))
|
|
204
|
-
|
|
203
|
+
yield record
|
|
205
204
|
except Exception as ex:
|
|
206
205
|
msg=str(ex)
|
|
207
206
|
self.logError(msg)
|
|
208
207
|
pass
|
|
209
208
|
cur.close()
|
|
209
|
+
|
|
210
|
+
def query(self,sqlQuery,params=None):
|
|
211
|
+
'''
|
|
212
|
+
run the given sqlQuery and return a list of Dicts
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
|
|
216
|
+
sqlQuery(string): the SQL query to be executed
|
|
217
|
+
params(tuple): the query params, if any
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
list: a list of Dicts
|
|
221
|
+
'''
|
|
222
|
+
resultList=[]
|
|
223
|
+
for record in self.queryGen(sqlQuery, params):
|
|
224
|
+
resultList.append(record)
|
|
210
225
|
return resultList
|
|
211
226
|
|
|
212
227
|
def queryAll(self,entityInfo,fixDates=True):
|
|
@@ -323,13 +323,20 @@ WHERE
|
|
|
323
323
|
return qm
|
|
324
324
|
return None
|
|
325
325
|
|
|
326
|
-
def mostFrequentPropertiesQuery(self):
|
|
326
|
+
def mostFrequentPropertiesQuery(self,whereClause:str=None):
|
|
327
327
|
'''
|
|
328
328
|
get the most frequently used properties
|
|
329
|
+
|
|
330
|
+
Args:
|
|
331
|
+
whereClause(str): an extra WhereClause to use
|
|
329
332
|
'''
|
|
330
333
|
query=self.queryManager.queriesByName["mostFrequentProperties"]
|
|
334
|
+
if whereClause is None:
|
|
335
|
+
whereClause=f"?item wdt:P31 wd:{self.itemQid};";
|
|
336
|
+
else:
|
|
337
|
+
whereClause+=";"
|
|
331
338
|
query.title=f"most frequently used properties for {self.asText(long=True)}"
|
|
332
|
-
query.query=query.query % (self.item.asText(long=True),
|
|
339
|
+
query.query=query.query % (self.item.asText(long=True),whereClause,self.lang)
|
|
333
340
|
return query
|
|
334
341
|
|
|
335
342
|
def noneTabularQuery(self,wdProperty:WikidataProperty,asFrequency:bool=True):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|