pyLodStorage 0.4.1__tar.gz → 0.4.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.4.1/pylodstorage.egg-info → pylodstorage-0.4.3}/PKG-INFO +1 -1
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/query.py +1 -1
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/trulytabular.py +16 -3
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/version.py +1 -1
- {pylodstorage-0.4.1 → pylodstorage-0.4.3/pylodstorage.egg-info}/PKG-INFO +1 -1
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/LICENSE +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/README.md +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/__init__.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/csv.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/entity.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/jsonable.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/jsonpicklemixin.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/lod.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/plot.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/querymain.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/sample.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/schema.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/sparql.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/sql.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/uml.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/xml.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/lodstorage/yamlablemixin.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/pylodstorage.egg-info/SOURCES.txt +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/pylodstorage.egg-info/entry_points.txt +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/pylodstorage.egg-info/requires.txt +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/pylodstorage.egg-info/top_level.txt +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/__init__.py +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/endpoints.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/formats.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/got.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/queries.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/scholia.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/trulytabular.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/wf.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/sampledata/wikidata.yaml +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/setup.cfg +0 -0
- {pylodstorage-0.4.1 → pylodstorage-0.4.3}/setup.py +0 -0
|
@@ -530,7 +530,7 @@ class QueryManager(object):
|
|
|
530
530
|
@staticmethod
|
|
531
531
|
def getQueries(queriesPath=None):
|
|
532
532
|
'''
|
|
533
|
-
get the queries for
|
|
533
|
+
get the queries for the given queries Path
|
|
534
534
|
'''
|
|
535
535
|
queriesPaths=YamlPath.getPaths("queries.yaml", queriesPath)
|
|
536
536
|
queries={}
|
|
@@ -4,6 +4,8 @@ Created on 2022-04-14
|
|
|
4
4
|
@author: wf
|
|
5
5
|
'''
|
|
6
6
|
import datetime
|
|
7
|
+
from typing import Union
|
|
8
|
+
|
|
7
9
|
from lodstorage.sparql import SPARQL
|
|
8
10
|
from lodstorage.query import Query,QueryManager,YamlPath,Endpoint
|
|
9
11
|
from lodstorage.version import Version
|
|
@@ -459,6 +461,8 @@ SELECT ?{item.varname} ?{item.varname}Label"""
|
|
|
459
461
|
sparqlQuery+=f"\n ({aggregateFunc} ({distinct}?{wdProp.varname}{aggregateParam}) AS ?{wdProp.varname}_{aggregate})"
|
|
460
462
|
elif aggregate=="label":
|
|
461
463
|
sparqlQuery+=f"\n ?{wdProp.varname}Label"
|
|
464
|
+
elif aggregate=="ignore" and not "label" in genList:
|
|
465
|
+
sparqlQuery+=f"\n ?{wdProp.varname}"
|
|
462
466
|
sparqlQuery+=f"""
|
|
463
467
|
WHERE {{
|
|
464
468
|
# instanceof {item.qid}:{item.qlabel}
|
|
@@ -525,7 +529,7 @@ WHERE {{
|
|
|
525
529
|
sparqlQuery=f"""# get the most frequently used properties for
|
|
526
530
|
# {itemText}
|
|
527
531
|
{WikidataItem.getPrefixes()}
|
|
528
|
-
SELECT ?prop ?propLabel ?count WHERE {{
|
|
532
|
+
SELECT ?prop ?propLabel ?wbType ?count WHERE {{
|
|
529
533
|
{{"""
|
|
530
534
|
if self.endpointConf.database=="qlever":
|
|
531
535
|
sparqlQuery+=f"""
|
|
@@ -552,6 +556,7 @@ SELECT ?prop ?propLabel ?count WHERE {{
|
|
|
552
556
|
}}"""
|
|
553
557
|
sparqlQuery+=f"""
|
|
554
558
|
?prop rdfs:label ?propLabel.
|
|
559
|
+
?prop wikibase:propertyType ?wbType.
|
|
555
560
|
FILTER(LANG(?propLabel) = "{self.lang}").{minCountFilter}
|
|
556
561
|
}}
|
|
557
562
|
ORDER BY DESC (?count)
|
|
@@ -619,12 +624,20 @@ ORDER BY DESC(?count)"""
|
|
|
619
624
|
qlod=self.sparql.queryAsListOfDicts(query.query)
|
|
620
625
|
return qlod
|
|
621
626
|
|
|
622
|
-
def addStatsColWithPercent(self,m,col,value,total):
|
|
627
|
+
def addStatsColWithPercent(self, m:dict, col:str, value:Union[int, float], total:Union[int, float]):
|
|
623
628
|
'''
|
|
624
629
|
add a statistics Column
|
|
630
|
+
Args:
|
|
631
|
+
m(dict):
|
|
632
|
+
col(str): name of the column
|
|
633
|
+
value: value
|
|
634
|
+
total: total value
|
|
625
635
|
'''
|
|
626
636
|
m[col]=value
|
|
627
|
-
|
|
637
|
+
if total > 0:
|
|
638
|
+
m[f"{col}%"]=float(f"{value/total*100:.1f}")
|
|
639
|
+
else:
|
|
640
|
+
m[f"{col}%"] = None
|
|
628
641
|
|
|
629
642
|
def genWdPropertyStatistic(self,wdProperty:WikidataProperty,itemCount:int,withQuery=True)->dict:
|
|
630
643
|
'''
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|