pyLodStorage 0.3.9__tar.gz → 0.3.11__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 (41) hide show
  1. {pylodstorage-0.3.9/pylodstorage.egg-info → pylodstorage-0.3.11}/PKG-INFO +1 -1
  2. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/trulytabular.py +46 -16
  3. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/version.py +2 -2
  4. {pylodstorage-0.3.9 → pylodstorage-0.3.11/pylodstorage.egg-info}/PKG-INFO +1 -1
  5. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/endpoints.yaml +1 -39
  6. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/LICENSE +0 -0
  7. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/README.md +0 -0
  8. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/__init__.py +0 -0
  9. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/csv.py +0 -0
  10. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/entity.py +0 -0
  11. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/jsonable.py +0 -0
  12. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/jsonpicklemixin.py +0 -0
  13. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/lod.py +0 -0
  14. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/mwTable.py +0 -0
  15. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/plot.py +0 -0
  16. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/query.py +0 -0
  17. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/querymain.py +0 -0
  18. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/sample.py +0 -0
  19. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/schema.py +0 -0
  20. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/sparql.py +0 -0
  21. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/sql.py +0 -0
  22. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/storageconfig.py +0 -0
  23. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/tabulateCounter.py +0 -0
  24. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/uml.py +0 -0
  25. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/xml.py +0 -0
  26. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/lodstorage/yamlablemixin.py +0 -0
  27. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/pylodstorage.egg-info/SOURCES.txt +0 -0
  28. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/pylodstorage.egg-info/dependency_links.txt +0 -0
  29. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/pylodstorage.egg-info/entry_points.txt +0 -0
  30. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/pylodstorage.egg-info/requires.txt +0 -0
  31. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/pylodstorage.egg-info/top_level.txt +0 -0
  32. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/__init__.py +0 -0
  33. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/formats.yaml +0 -0
  34. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/got.yaml +0 -0
  35. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/queries.yaml +0 -0
  36. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/scholia.yaml +0 -0
  37. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/trulytabular.yaml +0 -0
  38. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/wf.yaml +0 -0
  39. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/sampledata/wikidata.yaml +0 -0
  40. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/setup.cfg +0 -0
  41. {pylodstorage-0.3.9 → pylodstorage-0.3.11}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.3.9
3
+ Version: 0.3.11
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -79,7 +79,7 @@ class WikidataProperty():
79
79
  for propertyLabel in propertyLabels:
80
80
  valuesClause+=f' "{propertyLabel}"@{lang}\n'
81
81
  query=f"""# get the properties for the given labels
82
- {WikidataItem.getPrefixes()}
82
+ {WikidataItem.getPrefixes(["rdf","rdfs","wikibase"])}
83
83
  SELECT ?property ?propertyLabel WHERE {{
84
84
  VALUES ?propertyLabel {{
85
85
  {valuesClause}
@@ -108,7 +108,7 @@ SELECT ?property ?propertyLabel WHERE {{
108
108
  valuesClause+=f' wd:{propertyId}\n'
109
109
  query=f"""
110
110
  # get the property for the given property Ids
111
- {WikidataItem.getPrefixes()}
111
+ {WikidataItem.getPrefixes(["rdf","rdfs","wd","wikibase"])}
112
112
  SELECT ?property ?propertyLabel WHERE {{
113
113
  VALUES ?property {{
114
114
  {valuesClause}
@@ -191,16 +191,46 @@ class WikidataItem:
191
191
  return text
192
192
 
193
193
  @classmethod
194
- def getPrefixes(cls):
194
+ def getPrefixes(cls,prefixes=["rdf","rdfs","schema","wd","wdt","wikibase","xsd"]):
195
+ prefixMap={
196
+ "bd":"<http://www.bigdata.com/rdf#>",
197
+ "cc":"<http://creativecommons.org/ns#>",
198
+ "dct":"<http://purl.org/dc/terms/>",
199
+ "geo":"<http://www.opengis.net/ont/geosparql#>",
200
+ "ontolex":"<http://www.w3.org/ns/lemon/ontolex#>",
201
+ "owl":"<http://www.w3.org/2002/07/owl#>",
202
+ "p":"<http://www.wikidata.org/prop/>",
203
+ "pq":"<http://www.wikidata.org/prop/qualifier/>",
204
+ "pqn":"<http://www.wikidata.org/prop/qualifier/value-normalized/>",
205
+ "pqv":"<http://www.wikidata.org/prop/qualifier/value/>",
206
+ "pr":"<http://www.wikidata.org/prop/reference/>",
207
+ "prn":"<http://www.wikidata.org/prop/reference/value-normalized/>",
208
+ "prov":"<http://www.w3.org/ns/prov#>",
209
+ "prv":"<http://www.wikidata.org/prop/reference/value/>",
210
+ "ps":"<http://www.wikidata.org/prop/statement/>",
211
+ "psn":"<http://www.wikidata.org/prop/statement/value-normalized/>",
212
+ "psv":"<http://www.wikidata.org/prop/statement/value/>",
213
+ "rdf":"<http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
214
+ "rdfs":"<http://www.w3.org/2000/01/rdf-schema#>",
215
+ "schema":"<http://schema.org/>",
216
+ "skos":"<http://www.w3.org/2004/02/skos/core#>",
217
+ "wd":"<http://www.wikidata.org/entity/>",
218
+ "wdata":"<http://www.wikidata.org/wiki/Special:EntityData/>",
219
+ "wdno":"<http://www.wikidata.org/prop/novalue/>",
220
+ "wdref":"<http://www.wikidata.org/reference/>",
221
+ "wds":"<http://www.wikidata.org/entity/statement/>",
222
+ "wdt":"<http://www.wikidata.org/prop/direct/>",
223
+ "wdtn":"<http://www.wikidata.org/prop/direct-normalized/>",
224
+ "wdv":"<http://www.wikidata.org/value/>",
225
+ "wikibase":"<http://wikiba.se/ontology#>",
226
+ "xsd":"<http://www.w3.org/2001/XMLSchema#>"
227
+ }
195
228
  # see also https://www.wikidata.org/wiki/EntitySchema:E49
196
- prefixes="""PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
197
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
198
- PREFIX schema: <http://schema.org/>
199
- PREFIX wd: <http://www.wikidata.org/entity/>
200
- PREFIX wdt: <http://www.wikidata.org/prop/direct/>
201
- PREFIX wikibase: <http://wikiba.se/ontology#>
202
- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>"""
203
- return prefixes
229
+ sparql=""
230
+ for prefix in prefixes:
231
+ if prefix in prefixMap:
232
+ sparql+=f"PREFIX {prefix}: {prefixMap[prefix]}\n"
233
+ return sparql
204
234
 
205
235
  @classmethod
206
236
  def getLabelAndDescription(cls,sparql:SPARQL, itemId:str,lang:str="en"):
@@ -215,7 +245,7 @@ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>"""
215
245
  (str,str): the label and description as a tuple
216
246
  '''
217
247
  query=f"""# get the label for the given item
218
- {cls.getPrefixes()}
248
+ {cls.getPrefixes(["rdfs","wd","schema"])}
219
249
  SELECT ?itemLabel ?itemDescription
220
250
  WHERE
221
251
  {{
@@ -246,7 +276,7 @@ WHERE
246
276
  query=f"""# get the items that have the given label in the given language
247
277
  # e.g. we'll find human=Q5 as the oldest type for the label "human" first
248
278
  # and then the newer ones such as "race in Warcraft"
249
- {cls.getPrefixes()}
279
+ {cls.getPrefixes(["rdfs","schema","xsd"])}
250
280
  SELECT
251
281
  #?itemId
252
282
  ?item
@@ -339,7 +369,7 @@ WHERE
339
369
  self.error=ex
340
370
  count=None
341
371
 
342
- return count
372
+ return count,query
343
373
 
344
374
  def asText(self,long:bool=True):
345
375
  '''
@@ -632,7 +662,7 @@ ORDER BY DESC(?count)"""
632
662
  Returns:
633
663
  generator: a generator of statistic dict rows
634
664
  '''
635
- itemCount=self.count()
665
+ itemCount,_itemCountQuery=self.count()
636
666
  for wdProperty in self.properties.values():
637
667
  statsRow=self.genWdPropertyStatistic(wdProperty, itemCount)
638
668
  yield statsRow
@@ -641,7 +671,7 @@ ORDER BY DESC(?count)"""
641
671
  '''
642
672
  get the property Statistics
643
673
  '''
644
- itemCount=self.count()
674
+ itemCount,_itemCountQuery=self.count()
645
675
  lod=[{
646
676
  "property": "∑",
647
677
  "total": itemCount,
@@ -9,7 +9,7 @@ class Version(object):
9
9
  Version handling for pyLoDStorage
10
10
  '''
11
11
  name="pylodstorage"
12
- version='0.3.9'
12
+ version='0.3.11'
13
13
  date = '2020-09-10'
14
- updated = '2022-08-01'
14
+ updated = '2022-08-02'
15
15
  description='python List of Dict (Table) Storage library'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.3.9
3
+ Version: 0.3.11
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -40,7 +40,7 @@
40
40
  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
41
41
  'qlever-wikidata':
42
42
  lang: sparql
43
- method: GET
43
+ method: POST
44
44
  database: qlever
45
45
  endpoint: https://qlever.cs.uni-freiburg.de/api/wikidata
46
46
  website: https://qlever.cs.uni-freiburg.de/wikidata
@@ -76,44 +76,6 @@
76
76
  PREFIX wdv: <http://www.wikidata.org/value/>
77
77
  PREFIX wikibase: <http://wikiba.se/ontology#>
78
78
  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
79
- 'qlever-wikidata-proxy':
80
- lang: sparql
81
- method: GET
82
- database: qlever
83
- endpoint: https://qlever.cs.uni-freiburg.de/api/wikidata-proxy
84
- website: https://qlever.cs.uni-freiburg.de/wikidata
85
- prefixes: |
86
- PREFIX bd: <http://www.bigdata.com/rdf#>
87
- PREFIX cc: <http://creativecommons.org/ns#>
88
- PREFIX dct: <http://purl.org/dc/terms/>
89
- PREFIX geo: <http://www.opengis.net/ont/geosparql#>
90
- PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
91
- PREFIX owl: <http://www.w3.org/2002/07/owl#>
92
- PREFIX p: <http://www.wikidata.org/prop/>
93
- PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
94
- PREFIX pqn: <http://www.wikidata.org/prop/qualifier/value-normalized/>
95
- PREFIX pqv: <http://www.wikidata.org/prop/qualifier/value/>
96
- PREFIX pr: <http://www.wikidata.org/prop/reference/>
97
- PREFIX prn: <http://www.wikidata.org/prop/reference/value-normalized/>
98
- PREFIX prov: <http://www.w3.org/ns/prov#>
99
- PREFIX prv: <http://www.wikidata.org/prop/reference/value/>
100
- PREFIX ps: <http://www.wikidata.org/prop/statement/>
101
- PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
102
- PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
103
- PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
104
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
105
- PREFIX schema: <http://schema.org/>
106
- PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
107
- PREFIX wd: <http://www.wikidata.org/entity/>
108
- PREFIX wdata: <http://www.wikidata.org/wiki/Special:EntityData/>
109
- PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
110
- PREFIX wdref: <http://www.wikidata.org/reference/>
111
- PREFIX wds: <http://www.wikidata.org/entity/statement/>
112
- PREFIX wdt: <http://www.wikidata.org/prop/direct/>
113
- PREFIX wdtn: <http://www.wikidata.org/prop/direct-normalized/>
114
- PREFIX wdv: <http://www.wikidata.org/value/>
115
- PREFIX wikibase: <http://wikiba.se/ontology#>
116
- PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
117
79
  'wikidata-openlinksw':
118
80
  lang: sparql
119
81
  endpoint: https://wikidata.demo.openlinksw.com/sparql
File without changes
File without changes
File without changes
File without changes