pyLodStorage 0.0.71__tar.gz → 0.0.73__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 (27) hide show
  1. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/PKG-INFO +1 -1
  2. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/entity.py +5 -5
  3. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/query.py +7 -8
  4. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/sparql.py +6 -6
  5. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/PKG-INFO +1 -1
  6. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/setup.py +1 -1
  7. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/LICENSE +0 -0
  8. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/README.md +0 -0
  9. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/__init__.py +0 -0
  10. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/csv.py +0 -0
  11. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/jsonable.py +0 -0
  12. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/jsonpicklemixin.py +0 -0
  13. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/lod.py +0 -0
  14. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/mwTable.py +0 -0
  15. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/plot.py +0 -0
  16. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/sample.py +0 -0
  17. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/schema.py +0 -0
  18. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/sql.py +0 -0
  19. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/storageconfig.py +0 -0
  20. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/tabulateCounter.py +0 -0
  21. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/uml.py +0 -0
  22. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/yamlablemixin.py +0 -0
  23. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/SOURCES.txt +0 -0
  24. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/dependency_links.txt +0 -0
  25. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/requires.txt +0 -0
  26. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/top_level.txt +0 -0
  27. {pylodstorage-0.0.71 → pylodstorage-0.0.73}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.0.71
3
+ Version: 0.0.73
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -305,12 +305,12 @@ SELECT ?eventId ?acronym ?series ?title ?year ?country ?city ?startDate ?endDate
305
305
  pass
306
306
  elif mode is StoreMode.SPARQL:
307
307
  startTime=time.time()
308
- # @ FIXME make abstract
309
- self.showProgress ("storing %d events for %s to %s" % (len(self.events),self.name,self.mode))
308
+ msg=f"storing {len(listOfDicts)} {self.entityPluralName} to {self.config.mode} ({self.config.endpoint})"
309
+ self.showProgress (msg)
310
+ # @ FIXME make abstract /configurable
310
311
  entityType="cr:Event"
311
- prefixes="PREFIX cr: <http://cr.bitplan.com/>"
312
- primaryKey="eventId"
313
- self.sparql.insertListOfDicts(listOfDicts, entityType, primaryKey, prefixes,limit=limit,batchSize=batchSize)
312
+ prefixes=self.config.prefix
313
+ self.sparql.insertListOfDicts(listOfDicts, entityType, self.primaryKey, prefixes,limit=limit,batchSize=batchSize)
314
314
  self.showProgress ("store for %s done after %5.1f secs" % (self.name,time.time()-startTime))
315
315
  elif mode is StoreMode.SQL:
316
316
  startTime=time.time()
@@ -47,7 +47,7 @@ class QueryResultDocumentation():
47
47
  '''
48
48
  text=f"{self.title}\n{self.query.description}\n{self.sourceCodeHeader}\n{self.sourceCode}{self.tryItMarkup}\n{self.resultHeader}\n{self.result}"
49
49
  return text
50
-
50
+
51
51
  class Query(object):
52
52
  ''' a Query e.g. for SPAQRL '''
53
53
 
@@ -105,7 +105,6 @@ class Query(object):
105
105
  markup=r"\href{%s}{%s}" % (url,title)
106
106
  return markup
107
107
 
108
-
109
108
  def prefixToLink(self,lod:list,prefix:str,tablefmt:str):
110
109
  '''
111
110
  convert url prefixes to link according to the given table format
@@ -121,11 +120,11 @@ class Query(object):
121
120
  value=record[key]
122
121
  if value is not None and isinstance(value,str) and value.startswith(prefix):
123
122
  item=value.replace(prefix,"")
124
- item=urllib.parse.quote(item)
123
+ uqitem=urllib.parse.unquote(item)
125
124
  if tablefmt=="latex":
126
- link=item
125
+ link=uqitem
127
126
  else:
128
- link=self.getLink(value,item,tablefmt)
127
+ link=self.getLink(value,uqitem,tablefmt)
129
128
  record[key]=link
130
129
 
131
130
 
@@ -176,9 +175,9 @@ class Query(object):
176
175
  if withSourceCode:
177
176
  tryItMarkup=self.getLink(tryItUrl, "try it!", tablefmt)
178
177
  if tablefmt=="github":
179
- title=f"**{self.title}**"
180
- sourceCodeHeader="**query**"
181
- resultHeader="**result**"
178
+ title=f"## {self.title}"
179
+ sourceCodeHeader="### query"
180
+ resultHeader="## result"
182
181
  sourceCode=f"""```sql
183
182
  {self.query}
184
183
  ```"""
@@ -175,18 +175,18 @@ class SPARQL(object):
175
175
  if startTime is None:
176
176
  startTime=batchStartTime
177
177
  rdfprefix="PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
178
- insertCommand='%s%s\nINSERT DATA {\n' % (rdfprefix,prefixes)
178
+ insertCommand=f'{rdfprefix}{prefixes}\nINSERT DATA {{\n'
179
179
  for index,record in enumerate(listOfDicts):
180
180
  if not primaryKey in record:
181
- errors.append("missing primary key %s in record %d" % (primaryKey,index))
181
+ errors.append(f"missing primary key {primaryKey} in record {index}")
182
182
  else:
183
183
  primaryValue=record[primaryKey]
184
184
  if primaryValue is None:
185
- errors.append("primary key %s value is None in record %d" % (primaryKey,index))
185
+ errors.append(f"primary key {primaryKey} value is None in record {index}")
186
186
  else:
187
187
  encodedPrimaryValue=self.getLocalName(primaryValue)
188
- tSubject="%s__%s" %(entityType,encodedPrimaryValue)
189
- insertCommand+=' %s rdf:type "%s".\n' %(tSubject,entityType)
188
+ tSubject=f"{entityType}__{encodedPrimaryValue}"
189
+ insertCommand+=f' {tSubject} rdf:type "{entityType}".\n'
190
190
  for keyValue in record.items():
191
191
  key,value=keyValue
192
192
  # convert key if necessary
@@ -194,7 +194,7 @@ class SPARQL(object):
194
194
  valueType=type(value)
195
195
  if self.debug:
196
196
  print("%s(%s)=%s" % (key,valueType,value))
197
- tPredicate="%s_%s" % (entityType,key)
197
+ tPredicate=f"{entityType}_{key}"
198
198
  tObject=value
199
199
  if valueType == str:
200
200
  escapedString=self.controlEscape(value)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pylodstorage
3
- Version: 0.0.71
3
+ Version: 0.0.73
4
4
  Summary: python List of Dict (Table) Storage library
5
5
  Home-page: https://github.com/WolfgangFahl/pyLodStorage
6
6
  Author: Wolfgang Fahl
@@ -11,7 +11,7 @@ with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
11
11
 
12
12
  setup(
13
13
  name='pylodstorage',
14
- version='0.0.71',
14
+ version='0.0.73',
15
15
 
16
16
  packages=['lodstorage',],
17
17
  author='Wolfgang Fahl',
File without changes
File without changes
File without changes