pyLodStorage 0.4.6__tar.gz → 0.4.8__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.4.6/pylodstorage.egg-info → pylodstorage-0.4.8}/PKG-INFO +1 -4
  2. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/sparql.py +14 -2
  3. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/sql.py +10 -5
  4. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/version.py +2 -2
  5. {pylodstorage-0.4.6 → pylodstorage-0.4.8/pylodstorage.egg-info}/PKG-INFO +1 -4
  6. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/pylodstorage.egg-info/entry_points.txt +0 -1
  7. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/queries.yaml +16 -0
  8. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/LICENSE +0 -0
  9. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/README.md +0 -0
  10. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/__init__.py +0 -0
  11. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/csv.py +0 -0
  12. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/entity.py +0 -0
  13. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/jsonable.py +0 -0
  14. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/jsonpicklemixin.py +0 -0
  15. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/lod.py +0 -0
  16. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/mwTable.py +0 -0
  17. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/plot.py +0 -0
  18. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/query.py +0 -0
  19. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/querymain.py +0 -0
  20. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/sample.py +0 -0
  21. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/schema.py +0 -0
  22. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/storageconfig.py +0 -0
  23. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/tabulateCounter.py +0 -0
  24. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/trulytabular.py +0 -0
  25. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/uml.py +0 -0
  26. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/xml.py +0 -0
  27. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/lodstorage/yamlablemixin.py +0 -0
  28. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/pylodstorage.egg-info/SOURCES.txt +0 -0
  29. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/pylodstorage.egg-info/dependency_links.txt +0 -0
  30. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/pylodstorage.egg-info/requires.txt +0 -0
  31. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/pylodstorage.egg-info/top_level.txt +0 -0
  32. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/__init__.py +0 -0
  33. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/endpoints.yaml +0 -0
  34. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/formats.yaml +0 -0
  35. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/got.yaml +0 -0
  36. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/scholia.yaml +0 -0
  37. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/trulytabular.yaml +0 -0
  38. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/wf.yaml +0 -0
  39. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/sampledata/wikidata.yaml +0 -0
  40. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/setup.cfg +0 -0
  41. {pylodstorage-0.4.6 → pylodstorage-0.4.8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.4.6
3
+ Version: 0.4.8
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -10,7 +10,6 @@ License: Apache License
10
10
  Project-URL: Documentation, http://wiki.bitplan.com/index.php/PyLoDStorage
11
11
  Project-URL: Code, https://github.com/WolfgangFahl/pyLoDStorage/blob/master/lodstorage/sql.py
12
12
  Project-URL: Issue tracker, https://github.com/WolfgangFahl/pyLodStorage/issues
13
- Platform: UNKNOWN
14
13
  Classifier: Programming Language :: Python
15
14
  Classifier: Programming Language :: Python :: 3.7
16
15
  Classifier: Programming Language :: Python :: 3.8
@@ -69,5 +68,3 @@ see [test cases](https://github.com/WolfgangFahl/pyLoDStorage/tree/master/tests)
69
68
  ### Authors
70
69
  * [Wolfgang Fahl](http://www.bitplan.com/Wolfgang_Fahl)
71
70
  * [Tim Holzheim](https://www.semantic-mediawiki.org/wiki/Tim_Holzheim)
72
-
73
-
@@ -3,8 +3,9 @@ Created on 2020-08-14
3
3
 
4
4
  @author: wf
5
5
  '''
6
+ from typing import Union
6
7
  from SPARQLWrapper import SPARQLWrapper2
7
- from SPARQLWrapper.Wrapper import POSTDIRECTLY, POST
8
+ from SPARQLWrapper.Wrapper import POSTDIRECTLY, POST, BASIC, DIGEST
8
9
  from lodstorage.lod import LOD
9
10
  import datetime
10
11
  import time
@@ -46,8 +47,19 @@ class SPARQL(object):
46
47
  self.sparql=SPARQLWrapper2(url)
47
48
  self.method=method
48
49
  self.sparql.agent=agent
50
+
51
+ def addAuthentication(self, username:str, password:str, method: Union[BASIC, DIGEST] = BASIC):
52
+ """
53
+ Add Http Authentication credentials to the sparql wrapper
54
+ Args:
55
+ username: name of the user
56
+ password: password of the user
57
+ method: HTTP Authentication method
58
+ """
59
+ self.sparql.setHTTPAuth(method)
60
+ self.sparql.setCredentials(username, password)
49
61
 
50
- def rawQuery(self,queryString,method='POST'):
62
+ def rawQuery(self,queryString,method=POST):
51
63
  '''
52
64
  query with the given query string
53
65
 
@@ -124,7 +124,7 @@ class SQLDB(object):
124
124
  debugInfo="\nrecord #%d" % index
125
125
  return debugInfo
126
126
 
127
- def store(self,listOfRecords,entityInfo,executeMany=False,fixNone=False):
127
+ def store(self,listOfRecords,entityInfo,executeMany=False,fixNone=False,replace=False):
128
128
  '''
129
129
  store the given list of records based on the given entityInfo
130
130
 
@@ -134,8 +134,9 @@ class SQLDB(object):
134
134
  entityInfo(EntityInfo): the meta data to be used for storing
135
135
  executeMany(bool): if True the insert command is done with many/all records at once
136
136
  fixNone(bool): if True make sure empty columns in the listOfDict are filled with "None" values
137
+ replace(bool): if True allow replace for insert
137
138
  '''
138
- insertCmd=entityInfo.insertCmd
139
+ insertCmd=entityInfo.getInsertCmd(replace=replace)
139
140
  record=None
140
141
  index=0
141
142
  try:
@@ -507,12 +508,15 @@ class EntityInfo(object):
507
508
  print (ddlCmd)
508
509
  return ddlCmd
509
510
 
510
- def getInsertCmd(self):
511
+ def getInsertCmd(self,replace:bool=False)->str:
511
512
  '''
512
513
  get the INSERT command for this entityInfo
513
514
 
515
+ Args:
516
+ replace(bool): if True allow replace for insert
517
+
514
518
  Returns:
515
- the INSERT INTO SQL command for his entityInfo e.g.
519
+ str: the INSERT INTO SQL command for his entityInfo e.g.
516
520
 
517
521
  Example:
518
522
 
@@ -523,7 +527,8 @@ class EntityInfo(object):
523
527
  '''
524
528
  columns =','.join(self.typeMap.keys())
525
529
  placeholders=':'+',:'.join(self.typeMap.keys())
526
- insertCmd="INSERT INTO %s (%s) values (%s)" % (self.name, columns,placeholders)
530
+ replaceClause=" OR REPLACE" if replace else ""
531
+ insertCmd=f"INSERT{replaceClause} INTO {self.name} ({columns}) values ({placeholders})"
527
532
  if self.debug:
528
533
  print(insertCmd)
529
534
  return insertCmd
@@ -9,7 +9,7 @@ class Version(object):
9
9
  Version handling for pyLoDStorage
10
10
  '''
11
11
  name="pylodstorage"
12
- version='0.4.6'
12
+ version='0.4.8'
13
13
  date = '2020-09-10'
14
- updated = '2022-08-07'
14
+ updated = '2022-12-18'
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.4.6
3
+ Version: 0.4.8
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -10,7 +10,6 @@ License: Apache License
10
10
  Project-URL: Documentation, http://wiki.bitplan.com/index.php/PyLoDStorage
11
11
  Project-URL: Code, https://github.com/WolfgangFahl/pyLoDStorage/blob/master/lodstorage/sql.py
12
12
  Project-URL: Issue tracker, https://github.com/WolfgangFahl/pyLodStorage/issues
13
- Platform: UNKNOWN
14
13
  Classifier: Programming Language :: Python
15
14
  Classifier: Programming Language :: Python :: 3.7
16
15
  Classifier: Programming Language :: Python :: 3.8
@@ -69,5 +68,3 @@ see [test cases](https://github.com/WolfgangFahl/pyLoDStorage/tree/master/tests)
69
68
  ### Authors
70
69
  * [Wolfgang Fahl](http://www.bitplan.com/Wolfgang_Fahl)
71
70
  * [Tim Holzheim](https://www.semantic-mediawiki.org/wiki/Tim_Holzheim)
72
-
73
-
@@ -2,4 +2,3 @@
2
2
  lodquery = lodstorage.querymain:main
3
3
  sparqlquery = lodstorage.querymain:mainSPARQL
4
4
  sqlquery = lodstorage.querymain:mainSQL
5
-
@@ -2,6 +2,22 @@
2
2
  # Sample Queries for pyLodStorage library
3
3
  #
4
4
  # WF 2020-08-22
5
+ 'classHistogramm':
6
+ sparql: |
7
+ SELECT ?c (COUNT(?c) AS ?count)
8
+ WHERE {
9
+ ?subject a ?c
10
+ }
11
+ GROUP BY ?c
12
+ HAVING (?count >100)
13
+ ORDER BY DESC(?count)
14
+ 'propertyHistogramm':
15
+ sparql: |
16
+ SELECT ?property (COUNT(?property) AS ?propTotal)
17
+ WHERE { ?s ?property ?o . }
18
+ GROUP BY ?property
19
+ HAVING (?propTotal >1000)
20
+ ORDER BY DESC(?propTotal)
5
21
  'Predicate usage':
6
22
  sparql: |
7
23
  SELECT ?p (count(?p) as ?numberOfPredicates)
File without changes
File without changes
File without changes
File without changes