pyLodStorage 0.1.32__tar.gz → 0.2.0__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.1.32 → pylodstorage-0.2.0}/PKG-INFO +1 -1
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/trulytabular.py +51 -22
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/version.py +3 -3
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/PKG-INFO +1 -1
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/requires.txt +1 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/setup.py +2 -1
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/LICENSE +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/README.md +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/csv.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/entity.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/jsonable.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/jsonpicklemixin.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/lod.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/plot.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/query.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/querymain.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/sample.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/schema.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/sparql.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/sql.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/uml.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/yamlablemixin.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/SOURCES.txt +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/entry_points.txt +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/top_level.txt +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/__init__.py +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/endpoints.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/formats.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/queries.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/scholia.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/trulytabular.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/wf.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/wikidata.yaml +0 -0
- {pylodstorage-0.1.32 → pylodstorage-0.2.0}/setup.cfg +0 -0
|
@@ -8,7 +8,6 @@ from lodstorage.query import Query,QueryManager,YamlPath
|
|
|
8
8
|
import os
|
|
9
9
|
import re
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
class WikidataProperty():
|
|
13
12
|
'''
|
|
14
13
|
a WikidataProperty
|
|
@@ -393,9 +392,57 @@ ORDER BY DESC(?count)"""
|
|
|
393
392
|
add a statistics Column
|
|
394
393
|
'''
|
|
395
394
|
m[col]=value
|
|
396
|
-
m[f"{col}%"]=float(f"{value/total*100:.1f}")
|
|
395
|
+
m[f"{col}%"]=float(f"{value/total*100:.1f}")
|
|
396
|
+
|
|
397
|
+
def genWdPropertyStatistic(self,wdProperty:WikidataProperty,itemCount:int,withQuery=True)->dict:
|
|
398
|
+
'''
|
|
399
|
+
generate a property Statistics Row for the given wikidata Property
|
|
400
|
+
|
|
401
|
+
Args:
|
|
402
|
+
wdProperty(WikidataProperty): the property to get the statistics for
|
|
403
|
+
itemCount(int): the total number of items to check
|
|
404
|
+
withQuery(bool): if true include the sparql query
|
|
405
|
+
|
|
406
|
+
Returns:
|
|
407
|
+
dict: a statistics row
|
|
408
|
+
'''
|
|
409
|
+
ntlod=self.noneTabular(wdProperty)
|
|
410
|
+
statsRow={"property":wdProperty.pLabel}
|
|
411
|
+
total=0
|
|
412
|
+
nttotal=0
|
|
413
|
+
maxCount=0
|
|
414
|
+
for record in ntlod:
|
|
415
|
+
f=record["frequency"]
|
|
416
|
+
count=record["count"]
|
|
417
|
+
#statsRow[f"f{count}"]=f
|
|
418
|
+
if count>1:
|
|
419
|
+
nttotal+=f
|
|
420
|
+
else:
|
|
421
|
+
statsRow["1"]=f
|
|
422
|
+
if count>maxCount:
|
|
423
|
+
maxCount=count
|
|
424
|
+
total+=f
|
|
425
|
+
statsRow["max"]=maxCount
|
|
426
|
+
if withQuery:
|
|
427
|
+
statsRow["queryf"]=self.noneTabularQuery(wdProperty).query
|
|
428
|
+
statsRow["queryex"]=self.noneTabularQuery(wdProperty,asFrequency=False).query
|
|
429
|
+
self.addStatsColWithPercent(statsRow,"total",total,itemCount)
|
|
430
|
+
self.addStatsColWithPercent(statsRow,"non tabular",nttotal,total)
|
|
431
|
+
return statsRow
|
|
432
|
+
|
|
433
|
+
def genPropertyStatistics(self):
|
|
434
|
+
'''
|
|
435
|
+
generate the property Statistics
|
|
436
|
+
|
|
437
|
+
Returns:
|
|
438
|
+
generator: a generator of statistic dict rows
|
|
439
|
+
'''
|
|
440
|
+
itemCount=self.count()
|
|
441
|
+
for wdProperty in self.properties.values():
|
|
442
|
+
statsRow=self.genWdPropertyStatistic(wdProperty, itemCount)
|
|
443
|
+
yield statsRow
|
|
397
444
|
|
|
398
|
-
def
|
|
445
|
+
def getPropertyStatistics(self):
|
|
399
446
|
'''
|
|
400
447
|
get the property Statistics
|
|
401
448
|
'''
|
|
@@ -406,25 +453,7 @@ ORDER BY DESC(?count)"""
|
|
|
406
453
|
"total%": 100.0
|
|
407
454
|
}]
|
|
408
455
|
for wdProperty in self.properties.values():
|
|
409
|
-
|
|
410
|
-
statsRow={"property":wdProperty.pLabel}
|
|
411
|
-
total=0
|
|
412
|
-
nttotal=0
|
|
413
|
-
maxCount=0
|
|
414
|
-
for record in ntlod:
|
|
415
|
-
f=record["frequency"]
|
|
416
|
-
count=record["count"]
|
|
417
|
-
#statsRow[f"f{count}"]=f
|
|
418
|
-
if count>1:
|
|
419
|
-
nttotal+=f
|
|
420
|
-
else:
|
|
421
|
-
statsRow["1"]=f
|
|
422
|
-
if count>maxCount:
|
|
423
|
-
maxCount=count
|
|
424
|
-
total+=f
|
|
425
|
-
statsRow["max"]=maxCount
|
|
426
|
-
self.addStatsColWithPercent(statsRow,"total",total,itemCount)
|
|
427
|
-
self.addStatsColWithPercent(statsRow,"non tabular",nttotal,total)
|
|
456
|
+
statsRow=self.genWdPropertyStatistic(wdProperty, itemCount)
|
|
428
457
|
lod.append(statsRow)
|
|
429
458
|
return lod
|
|
430
459
|
|
|
@@ -11,7 +11,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
|
|
|
11
11
|
long_description = f.read()
|
|
12
12
|
|
|
13
13
|
setup(
|
|
14
|
-
name=
|
|
14
|
+
name=Version.name,
|
|
15
15
|
version=Version.version,
|
|
16
16
|
|
|
17
17
|
packages=['lodstorage','sampledata'],
|
|
@@ -37,6 +37,7 @@ setup(
|
|
|
37
37
|
'pandas',
|
|
38
38
|
'jsonpickle',
|
|
39
39
|
'tabulate',
|
|
40
|
+
'pygments',
|
|
40
41
|
'pylatexenc~=2.10'
|
|
41
42
|
],
|
|
42
43
|
classifiers=[
|
|
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
|