rdflib 2.2.31 → 2.2.32-2b635b59

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 (53) hide show
  1. package/dist/670.rdflib.min.js +1 -0
  2. package/dist/730.rdflib.min.js +3 -0
  3. package/dist/730.rdflib.min.js.LICENSE.txt +58 -0
  4. package/dist/730.rdflib.min.js.map +1 -0
  5. package/dist/rdflib.min.js +1 -1
  6. package/dist/rdflib.min.js.LICENSE.txt +0 -59
  7. package/dist/rdflib.min.js.map +1 -1
  8. package/esm/blank-node.js +10 -6
  9. package/esm/collection.js +3 -4
  10. package/esm/factories/factory-types.js +10 -10
  11. package/esm/fetcher.js +69 -36
  12. package/esm/formula.js +10 -13
  13. package/esm/jsonldparser.js +4 -3
  14. package/esm/lists.js +2 -1
  15. package/esm/literal.js +6 -8
  16. package/esm/node-internal.js +5 -10
  17. package/esm/rdfxmlparser.js +3 -0
  18. package/esm/serializer.js +1 -2
  19. package/esm/statement.js +7 -11
  20. package/esm/store.js +39 -32
  21. package/esm/types.js +18 -1
  22. package/esm/update-manager.js +28 -16
  23. package/esm/utils.js +0 -1
  24. package/esm/variable.js +2 -4
  25. package/lib/blank-node.js +10 -6
  26. package/lib/collection.js +3 -4
  27. package/lib/factories/factory-types.js +10 -10
  28. package/lib/fetcher.js +93 -37
  29. package/lib/formula.js +10 -13
  30. package/lib/index.d.ts +1 -1
  31. package/lib/jsonldparser.js +9 -3
  32. package/lib/lists.js +15 -1
  33. package/lib/literal.js +6 -8
  34. package/lib/node-internal.js +5 -10
  35. package/lib/query.d.ts +1 -1
  36. package/lib/rdfxmlparser.js +3 -0
  37. package/lib/serializer.d.ts +1 -1
  38. package/lib/serializer.js +1 -2
  39. package/lib/sparql-to-query.d.ts +1 -1
  40. package/lib/statement.js +7 -11
  41. package/lib/store.d.ts +1 -1
  42. package/lib/store.js +55 -34
  43. package/lib/types.js +22 -0
  44. package/lib/update-manager.d.ts +1 -1
  45. package/lib/update-manager.js +34 -17
  46. package/lib/utils-js.d.ts +3 -3
  47. package/lib/variable.js +2 -4
  48. package/lib/xsd-internal.d.ts +1 -1
  49. package/package.json +19 -19
  50. package/src/fetcher.ts +18 -1
  51. package/src/jsonldparser.js +2 -4
  52. package/src/store.ts +18 -1
  53. package/src/update-manager.ts +20 -11
@@ -87,14 +87,16 @@ export default class UpdateManager {
87
87
  * the user logs in, then that data misrepresents what would happen
88
88
  * if the user tried again.
89
89
  */
90
- flagAuthorizationMetadata () {
91
- const kb = this.store
92
- const meta = kb.fetcher.appNode
90
+ flagAuthorizationMetadata (kb?: IndexedFormula) {
91
+ if (!kb) {
92
+ kb = this.store
93
+ }
94
+ const meta = kb.fetcher?.appNode
93
95
  const requests = kb.statementsMatching(undefined, this.ns.link('requestedURI'), undefined, meta).map(st => st.subject)
94
96
  for (const request of requests) {
95
97
  const response = kb.any(request, this.ns.link('response'), null, meta) as Quad_Subject
96
98
  if (response !== undefined) { // ts
97
- this.store.add(response, this.ns.link('outOfDate'), true as any, meta) // @@ Boolean is fine - fix types
99
+ kb.add(response, this.ns.link('outOfDate'), true as any, meta) // @@ Boolean is fine - fix types
98
100
  }
99
101
  }
100
102
  }
@@ -111,11 +113,18 @@ flagAuthorizationMetadata () {
111
113
  * LOCALFILE or false if known, undefined if not known.
112
114
  */
113
115
  async checkEditable (uri: string | NamedNode, kb?: IndexedFormula): Promise<string | boolean | undefined> {
114
- const initial = this.editable(uri, kb)
116
+ if (!uri) {
117
+ return false // Eg subject is bnode, no known doc to write to
118
+ }
119
+ if (!kb) {
120
+ kb = this.store
121
+ }
122
+
123
+ const initial = this.editable(uri, kb)
115
124
  if (initial !== undefined) {
116
125
  return initial
117
126
  }
118
- await this.store.fetcher.load(uri)
127
+ await kb.fetcher?.load(uri)
119
128
  const final = this.editable(uri, kb)
120
129
  // console.log(`Loaded ${uri} just to check editable, result: ${final}.`)
121
130
  return final
@@ -141,17 +150,17 @@ flagAuthorizationMetadata () {
141
150
  uri = termValue(uri)
142
151
 
143
152
  if ( !this.isHttpUri(uri as string) ) {
144
- if (this.store.holds(
145
- this.store.rdfFactory.namedNode(uri),
146
- this.store.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
147
- this.store.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
153
+ if (kb.holds(
154
+ kb.rdfFactory.namedNode(uri),
155
+ kb.rdfFactory.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
156
+ kb.rdfFactory.namedNode('http://www.w3.org/2007/ont/link#MachineEditableDocument'))) {
148
157
  return 'LOCALFILE'
149
158
  }
150
159
  }
151
160
 
152
161
  var request
153
162
  var definitive = false
154
- const meta = this.store.fetcher.appNode
163
+ const meta = kb.fetcher?.appNode
155
164
  // const kb = s
156
165
 
157
166
  // @ts-ignore passes a string to kb.each, which expects a term. Should this work?