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.
Files changed (38) hide show
  1. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/PKG-INFO +1 -1
  2. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/trulytabular.py +51 -22
  3. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/version.py +3 -3
  4. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/PKG-INFO +1 -1
  5. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/requires.txt +1 -0
  6. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/setup.py +2 -1
  7. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/LICENSE +0 -0
  8. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/README.md +0 -0
  9. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/csv.py +0 -0
  10. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/entity.py +0 -0
  11. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/jsonable.py +0 -0
  12. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/jsonpicklemixin.py +0 -0
  13. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/lod.py +0 -0
  14. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/mwTable.py +0 -0
  15. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/plot.py +0 -0
  16. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/query.py +0 -0
  17. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/querymain.py +0 -0
  18. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/sample.py +0 -0
  19. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/schema.py +0 -0
  20. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/sparql.py +0 -0
  21. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/sql.py +0 -0
  22. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/storageconfig.py +0 -0
  23. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/tabulateCounter.py +0 -0
  24. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/uml.py +0 -0
  25. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/lodstorage/yamlablemixin.py +0 -0
  26. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/SOURCES.txt +0 -0
  27. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/dependency_links.txt +0 -0
  28. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/entry_points.txt +0 -0
  29. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/pylodstorage.egg-info/top_level.txt +0 -0
  30. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/__init__.py +0 -0
  31. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/endpoints.yaml +0 -0
  32. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/formats.yaml +0 -0
  33. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/queries.yaml +0 -0
  34. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/scholia.yaml +0 -0
  35. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/trulytabular.yaml +0 -0
  36. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/wf.yaml +0 -0
  37. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/sampledata/wikidata.yaml +0 -0
  38. {pylodstorage-0.1.32 → pylodstorage-0.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.1.32
3
+ Version: 0.2.0
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -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 getPropertyStatics(self):
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
- 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
- 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
 
@@ -8,7 +8,7 @@ class Version(object):
8
8
  '''
9
9
  Version handling for pyLoDStorage
10
10
  '''
11
- name="pyLodStorage"
12
- version='0.1.32'
11
+ name="pylodstorage"
12
+ version='0.2.0'
13
13
  date = '2020-09-10'
14
- updated = '2022-03-23'
14
+ updated = '2022-03-24'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.1.32
3
+ Version: 0.2.0
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -3,4 +3,5 @@ PyYAML
3
3
  pandas
4
4
  jsonpickle
5
5
  tabulate
6
+ pygments
6
7
  pylatexenc~=2.10
@@ -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='pylodstorage',
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