Skip to content

Commit

Permalink
replace removeMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgeoa committed Apr 3, 2024
1 parent dad4052 commit c45ae25
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,21 +887,36 @@ export default class IndexedFormula extends Formula { // IN future - allow pass

removeMetadata(doc: Quad_Graph): IndexedFormula {
const meta = this.sym('chrome://TheCurrentSession') // or this.rdfFactory.namedNode('chrome://TheCurrentSession')
const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#' // alain
const linkNamespaceURI = 'http://www.w3.org/2007/ont/link#'
// remove status/response/request metadata
const requests = this.statementsMatching(undefined, this.sym(`${linkNamespaceURI}requestedURI`), this.rdfFactory.literal(doc.value), meta).map(st => st.subject)
for (var r = 0; r < requests.length; r++) {
const request = requests[r]
if (request != undefined) {
// removeMatches unresolved issue with collection https://github.com/linkeddata/rdflib.js/issues/631
let sts: Quad[]
// status collection
const status = this.any(request, this.sym(`${linkNamespaceURI}status`), null, meta) as Quad_Subject
if (status != undefined) {
this.removeMatches(status, this.sym(`${linkNamespaceURI}status`), null, meta)
sts = this.statementsMatching(status, this.sym(`${linkNamespaceURI}status`), null, meta).slice()
for (var i = 0; i < sts.length; i++) {
this.removeStatement(sts[i])
}
}
// response items list
const response = this.any(request, this.sym(`${linkNamespaceURI}response`), null, meta) as Quad_Subject
if (response != undefined) { // ts
this.removeMatches(response, null, null, meta)
if (response != undefined) {
sts = this.statementsMatching(response, null, null, meta).slice()
for (var i = 0; i < sts.length; i++) {
this.removeStatement(sts[i])
}
}
this.removeMatches(request, null, null, meta)
// request triples
sts = this.statementsMatching(request, null, null, meta).slice()
for (var i = 0; i < sts.length; i++) {
this.removeStatement(sts[i])
}

}
}
this.removeMatches(this.sym(doc.value), null, null, meta) // content-type
Expand Down

0 comments on commit c45ae25

Please sign in to comment.