mustrd 0.2.7a0__py3-none-any.whl → 0.3.1a0__py3-none-any.whl

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.
mustrd/README.md CHANGED
@@ -27,3 +27,5 @@ As the project is actually built from the requirements.txt file at the project r
27
27
 
28
28
  `poetry export -f requirements.txt --without-hashes > requirements.txt`
29
29
 
30
+ We also recommend pairing MustRD with the VS Code plugin [faubulous.mentor](https://marketplace.visualstudio.com/items?itemName=faubulous.mentor) to enhance your development experience and streamline working with SPARQL and RDF specifications.
31
+
mustrd/anzo_utils.py CHANGED
@@ -31,16 +31,18 @@ from requests import Response, HTTPError, RequestException
31
31
  from bs4 import BeautifulSoup
32
32
  import logging
33
33
 
34
+ logger = logging.getLogger()
35
+
34
36
 
35
37
  def query_azg(anzo_config: dict, query: str,
36
38
  format: str = "json", is_update: bool = False,
37
39
  data_layers: List[str] = None):
38
40
  params = {
39
- 'skipCache': True,
41
+ 'skipCache': 'true',
40
42
  'format': format,
41
43
  'datasourceURI': anzo_config['gqe_uri'],
42
- 'default-graph-uri': data_layers,
43
- 'named-graph-uri': data_layers
44
+ 'using-graph-uri' if is_update else 'default-graph-uri': data_layers,
45
+ 'using-named-graph-uri' if is_update else 'named-graph-uri': data_layers
44
46
  }
45
47
  url = f"{anzo_config['url']}/sparql"
46
48
  return send_anzo_query(anzo_config, url=url, params=params, query=query, is_update=is_update)
@@ -52,7 +54,7 @@ def query_graphmart(anzo_config: dict,
52
54
  format: str = "json",
53
55
  data_layers: List[str] = None):
54
56
  params = {
55
- 'skipCache': True,
57
+ 'skipCache': 'true',
56
58
  'format': format,
57
59
  'default-graph-uri': data_layers,
58
60
  'named-graph-uri': data_layers
@@ -87,7 +89,8 @@ def manage_anzo_response(response: Response) -> str:
87
89
 
88
90
  def send_anzo_query(anzo_config, url, params, query, is_update=False):
89
91
  headers = {"Content-Type": f"application/sparql-{'update' if is_update else 'query' }"}
90
- return manage_anzo_response(requests.post(url=url, params=params, data=query,
92
+ logger.debug(f"send_anzo_query {url=} {query=} {is_update=}")
93
+ return manage_anzo_response(requests.post(url=url, params=params, data=query.encode('utf-8'),
91
94
  auth=(anzo_config['username'], anzo_config['password']),
92
95
  headers=headers, verify=False))
93
96
 
mustrd/logger_setup.py CHANGED
@@ -35,6 +35,7 @@ def setup_logger(name: str) -> logging.Logger:
35
35
  log = logging.getLogger(name)
36
36
  log.setLevel(LOG_LEVEL)
37
37
 
38
+
38
39
  stderr_handler = logging.StreamHandler(sys.stderr)
39
40
  stderr_handler.setLevel(logging.ERROR)
40
41
  log.addHandler(stderr_handler)
@@ -50,3 +51,5 @@ def setup_logger(name: str) -> logging.Logger:
50
51
  def flush():
51
52
  logging.shutdown()
52
53
  sys.stdout.flush()
54
+
55
+ logging.getLogger("edn_format").setLevel(logging.WARNING)
@@ -140,10 +140,20 @@ must:OrderedTableDatasetShape
140
140
  must:FileDatasetShape
141
141
  a sh:NodeShape ;
142
142
  sh:targetClass must:FileDataset ;
143
- sh:property [ sh:path must:file ;
144
- sh:datatype xsd:string ;
145
- sh:minCount 1 ;
146
- sh:maxCount 1 ; ] .
143
+ sh:or (
144
+ [
145
+ sh:path must:file ;
146
+ sh:datatype xsd:string ;
147
+ sh:maxCount 1 ;
148
+ ]
149
+ [
150
+ sh:path must:fileurl ;
151
+ sh:nodeKind sh:IRI ;
152
+ sh:minCount 1 ;
153
+ sh:maxCount 1 ;
154
+ ]
155
+ )
156
+ .
147
157
 
148
158
  must:StatementShape
149
159
  a sh:NodeShape ;
@@ -249,5 +259,14 @@ must:AnzoGraphmartQueryDrivenTemplatedStepSparqlSourceShape
249
259
  sh:minCount 1 ;
250
260
  sh:maxCount 1 ; ] .
251
261
 
252
-
253
-
262
+ must:SpadeEdnGroupSourceShape
263
+ a sh:NodeShape ;
264
+ sh:targetClass must:SpadeEdnGroupSource ;
265
+ sh:property [ sh:path must:fileurl ;
266
+ sh:message "A SpadeEdnGroupSource must have a fileurl property pointing to the spade.edn config." ;
267
+ sh:minCount 1 ;
268
+ sh:maxCount 1 ; ] ;
269
+ sh:property [ sh:path must:groupId ;
270
+ sh:message "A SpadeEdnGroupSource must have a groupId property referencing the group in the EDN file." ;
271
+ sh:minCount 1 ;
272
+ sh:maxCount 1 ; ] .
mustrd/model/ontology.ttl CHANGED
@@ -146,7 +146,7 @@ sh:order rdf:type owl:DatatypeProperty ;
146
146
 
147
147
  ### https://mustrd.com/model/file
148
148
  :file rdf:type owl:DatatypeProperty ;
149
- rdfs:comment "Relative or absolute path to local file" ;
149
+ rdfs:comment "Relative or absolute path to local file as a string, or a file:// url" ;
150
150
  rdfs:label "file" .
151
151
 
152
152
 
@@ -158,7 +158,6 @@ sh:order rdf:type owl:DatatypeProperty ;
158
158
 
159
159
  ### https://mustrd.com/model/fileurl
160
160
  :fileurl rdf:type owl:DatatypeProperty ;
161
- rdfs:domain :FileSparqlSource ;
162
161
  rdfs:comment "a full or relatively qualified file:// url. Relative to what? We haven't thought that through, yet." ;
163
162
  rdfs:isDefinedBy : ;
164
163
  rdfs:label "fileUrl" .
@@ -461,6 +460,11 @@ sh:order rdf:type owl:DatatypeProperty ;
461
460
  rdfs:isDefinedBy : ;
462
461
  rdfs:label "AnzoGraphmartQueryDrivenTemplatedStepSparqlSource" .
463
462
 
463
+ ### https://mustrd.com/model/SpadeEdnGroupSource
464
+ :SpadeEdnGroupSource rdf:type owl:Class ;
465
+ rdfs:subClassOf :SparqlSource ;
466
+ rdfs:comment "Allows reference to a spade.edn file, and a specific groupid (think Anzo layer), within that" ;
467
+ rdfs:label "SpadeEdnGroupSource" .
464
468
 
465
469
  ### https://mustrd.com/model/Then
466
470
  :Then rdf:type owl:Class ;