rdflib 2.2.31 → 2.2.32-2f2a2f3c

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 (54) 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 +64 -35
  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 +2 -3
  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 +150 -83
  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 +88 -36
  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 +2 -3
  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 +25 -5
  45. package/lib/update-manager.js +154 -82
  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 +20 -19
  50. package/src/fetcher.ts +13 -0
  51. package/src/jsonldparser.js +2 -4
  52. package/src/serializer.js +1 -1
  53. package/src/store.ts +18 -1
  54. package/src/update-manager.ts +243 -163
@@ -1,5 +1,3 @@
1
-
2
- import jsonld from 'jsonld'
3
1
  import { arrayToStatements } from './utils'
4
2
 
5
3
  /**
@@ -70,8 +68,8 @@ export default function jsonldParser (str, kb, base, callback) {
70
68
  ? base.value
71
69
  : base
72
70
 
73
- return jsonld
74
- .flatten(JSON.parse(str), null, { base: baseString })
71
+ return import('jsonld')
72
+ .then(jsonld => { return jsonld.flatten(JSON.parse(str), null, { base: baseString }) })
75
73
  .then((flattened) => flattened.reduce((store, flatResource) => {
76
74
 
77
75
  kb = processResource(kb, base, flatResource)
package/src/serializer.js CHANGED
@@ -261,7 +261,7 @@ export class Serializer {
261
261
  } else if (this.flags.indexOf('u') >= 0) { // Unicode encoding NTriples style
262
262
  uri = backslashUify(uri)
263
263
  } else {
264
- uri = hexify(uri)
264
+ uri = hexify(decodeURI(uri))
265
265
  }
266
266
  return '<' + uri + '>'
267
267
  }
package/src/store.ts CHANGED
@@ -871,10 +871,27 @@ export default class IndexedFormula extends Formula { // IN future - allow pass
871
871
  }
872
872
 
873
873
  /**
874
- * Removes all statements in a doc
874
+ * Removes all statements in a doc, along with the related metadata including request/response
875
875
  * @param doc - The document / graph
876
876
  */
877
877
  removeDocument(doc: Quad_Graph): IndexedFormula {
878
+ const meta = this.sym('chrome://TheCurrentSession') // or this.rdfFactory.namedNode('chrome://TheCurrentSession')
879
+ const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#' // alain
880
+ // remove request/response and metadata
881
+ const requests = this.statementsMatching(undefined, this.sym(`${linkNamespaceURI}requestedURI`), this.rdfFactory.literal(doc.value), meta).map(st => st.subject)
882
+ for (var r = 0; r < requests.length; r++) {
883
+ const request = requests[r]
884
+ if (request !== undefined) {
885
+ this.removeMatches(request, null, null, meta)
886
+ const response = this.any(request, this.sym(`${linkNamespaceURI}response`), null, meta) as Quad_Subject
887
+ if (response !== undefined) { // ts
888
+ this.removeMatches(response, null, null, meta)
889
+ }
890
+ }
891
+ }
892
+ this.removeMatches(this.sym(doc.value), null, null, meta) // content-type
893
+
894
+ // remove document
878
895
  var sts: Quad[] = this.statementsMatching(undefined, undefined, undefined, doc).slice() // Take a copy as this is the actual index
879
896
  for (var i = 0; i < sts.length; i++) {
880
897
  this.removeStatement(sts[i])