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.
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/PKG-INFO +1 -1
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/entity.py +5 -5
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/query.py +7 -8
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/sparql.py +6 -6
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/PKG-INFO +1 -1
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/setup.py +1 -1
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/LICENSE +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/README.md +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/__init__.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/csv.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/jsonable.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/jsonpicklemixin.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/lod.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/mwTable.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/plot.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/sample.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/schema.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/sql.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/storageconfig.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/tabulateCounter.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/uml.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/lodstorage/yamlablemixin.py +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/SOURCES.txt +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/dependency_links.txt +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/requires.txt +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/pylodstorage.egg-info/top_level.txt +0 -0
- {pylodstorage-0.0.71 → pylodstorage-0.0.73}/setup.cfg +0 -0
|
@@ -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
|
-
|
|
309
|
-
self.showProgress (
|
|
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=
|
|
312
|
-
primaryKey=
|
|
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
|
-
|
|
123
|
+
uqitem=urllib.parse.unquote(item)
|
|
125
124
|
if tablefmt=="latex":
|
|
126
|
-
link=
|
|
125
|
+
link=uqitem
|
|
127
126
|
else:
|
|
128
|
-
link=self.getLink(value,
|
|
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"
|
|
180
|
-
sourceCodeHeader="
|
|
181
|
-
resultHeader="
|
|
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='
|
|
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
|
|
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
|
|
185
|
+
errors.append(f"primary key {primaryKey} value is None in record {index}")
|
|
186
186
|
else:
|
|
187
187
|
encodedPrimaryValue=self.getLocalName(primaryValue)
|
|
188
|
-
tSubject="
|
|
189
|
-
insertCommand+='
|
|
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="
|
|
197
|
+
tPredicate=f"{entityType}_{key}"
|
|
198
198
|
tObject=value
|
|
199
199
|
if valueType == str:
|
|
200
200
|
escapedString=self.controlEscape(value)
|
|
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
|