pyLodStorage 0.2.13__tar.gz → 0.2.14__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.13/pylodstorage.egg-info → pylodstorage-0.2.14}/PKG-INFO +1 -1
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/query.py +1 -1
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/trulytabular.py +13 -7
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/version.py +1 -1
- {pylodstorage-0.2.13 → pylodstorage-0.2.14/pylodstorage.egg-info}/PKG-INFO +1 -1
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/LICENSE +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/README.md +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/__init__.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/csv.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/entity.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/jsonable.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/jsonpicklemixin.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/lod.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/plot.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/querymain.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/sample.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/schema.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/sparql.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/sql.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/uml.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/xml.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/lodstorage/yamlablemixin.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/pylodstorage.egg-info/SOURCES.txt +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/pylodstorage.egg-info/entry_points.txt +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/pylodstorage.egg-info/requires.txt +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/pylodstorage.egg-info/top_level.txt +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/__init__.py +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/endpoints.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/formats.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/queries.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/scholia.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/trulytabular.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/wf.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/sampledata/wikidata.yaml +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/setup.cfg +0 -0
- {pylodstorage-0.2.13 → pylodstorage-0.2.14}/setup.py +0 -0
|
@@ -336,7 +336,7 @@ class Query(object):
|
|
|
336
336
|
str: the "try it!" url for the given query
|
|
337
337
|
'''
|
|
338
338
|
# https://stackoverflow.com/a/9345102/1497139
|
|
339
|
-
quoted=urllib.parse.quote(self.query)
|
|
339
|
+
quoted=urllib.parse.quote(str(self.query))
|
|
340
340
|
quoted=f"#{quoted}"
|
|
341
341
|
url=f"{baseurl}/{quoted}"
|
|
342
342
|
return url
|
|
@@ -21,6 +21,8 @@ class Variable:
|
|
|
21
21
|
convert the given potential variable name string to a valid
|
|
22
22
|
variable name
|
|
23
23
|
|
|
24
|
+
see https://stackoverflow.com/a/3305731/1497139
|
|
25
|
+
|
|
24
26
|
Args:
|
|
25
27
|
varStr(str): the string to convert
|
|
26
28
|
|
|
@@ -367,15 +369,14 @@ WHERE
|
|
|
367
369
|
return None
|
|
368
370
|
|
|
369
371
|
|
|
370
|
-
|
|
371
372
|
def generateSparqlQuery(self,lang:str='en',naive:bool=True)->str:
|
|
372
373
|
'''
|
|
373
374
|
generate a SPARQL Query
|
|
374
375
|
'''
|
|
375
376
|
item=self.item
|
|
376
377
|
script=Path(__file__).name
|
|
377
|
-
|
|
378
|
-
# truly tabular query for
|
|
378
|
+
naiveText="naive" if naive else "aggregate"
|
|
379
|
+
sparqlQuery=f"""# truly tabular {naiveText} query for
|
|
379
380
|
# {item.qid}:{item.qlabel}
|
|
380
381
|
# generated by {script} on {self.isodate}
|
|
381
382
|
PREFIX wd: <http://www.wikidata.org/entity/>
|
|
@@ -383,7 +384,10 @@ PREFIX wdt: <http://www.wikidata.org/prop/direct/>
|
|
|
383
384
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
384
385
|
SELECT ?{item.varname} ?{item.varname}Label"""
|
|
385
386
|
for wdProp in self.properties.values():
|
|
386
|
-
|
|
387
|
+
if naive:
|
|
388
|
+
sparqlQuery+=f"\n ?{wdProp.varname}"
|
|
389
|
+
else:
|
|
390
|
+
sparqlQuery+=f"\n (SAMPLE (?{wdProp.varname}) AS ?{wdProp.varname})"
|
|
387
391
|
sparqlQuery+=f"""
|
|
388
392
|
WHERE {{
|
|
389
393
|
# instanceof {item.qid}:{item.qlabel}
|
|
@@ -392,13 +396,15 @@ WHERE {{
|
|
|
392
396
|
?{item.varname} rdfs:label ?{item.varname}Label
|
|
393
397
|
FILTER (LANG(?{item.varname}Label) = "{lang}").
|
|
394
398
|
"""
|
|
395
|
-
|
|
396
|
-
for wdProp in self.properties.values():
|
|
399
|
+
for wdProp in self.properties.values():
|
|
397
400
|
sparqlQuery+=f""" # {wdProp}
|
|
398
401
|
OPTIONAL {{ ?{item.varname} wdt:{wdProp.pid} ?{wdProp.varname}. }}
|
|
399
402
|
"""
|
|
400
|
-
|
|
403
|
+
# close where Clause
|
|
401
404
|
sparqlQuery+="""}\n"""
|
|
405
|
+
# optionally add Aggregate
|
|
406
|
+
if not naive:
|
|
407
|
+
sparqlQuery+=f"GROUP BY ?{item.varname} ?{item.varname}Label"
|
|
402
408
|
return sparqlQuery
|
|
403
409
|
|
|
404
410
|
def mostFrequentPropertiesQuery(self,whereClause:str=None):
|
|
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
|