Skip to content

Commit aecd989

Browse files
Add support for application/sparql-update-single-match
1 parent 14c93f5 commit aecd989

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/parse.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import RDFParser from './rdfxmlparser'
88
import sparqlUpdateParser from './patch-parser'
99
import * as Util from './utils-js'
1010
import Formula from './formula'
11-
import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'
11+
import { ContentType, TurtleContentType, N3ContentType, RDFXMLContentType, XHTMLContentType, HTMLContentType, SPARQLUpdateContentType, SPARQLUpdateSingleMatchContentType, JSONLDContentType, NQuadsContentType, NQuadsAltContentType } from './types'
1212
import { Quad } from './tf-types'
1313

1414
type CallbackFunc = (error: any, kb: Formula | null) => void
@@ -48,7 +48,7 @@ export default function parse (
4848
} else if (contentType === HTMLContentType) {
4949
parseRDFaDOM(Util.parseXML(str, {contentType: HTMLContentType}), kb, base)
5050
executeCallback()
51-
} else if (contentType === SPARQLUpdateContentType) { // @@ we handle a subset
51+
} else if ((contentType === SPARQLUpdateContentType) || (contentType === SPARQLUpdateSingleMatchContentType)) { // @@ we handle a subset
5252
sparqlUpdateParser(str, kb, base)
5353
executeCallback()
5454
} else if (contentType === JSONLDContentType) {
@@ -73,6 +73,7 @@ export default function parse (
7373
'application/xhtml+xml': true,
7474
'text/html': true,
7575
'application/sparql-update': true,
76+
'application/sparql-update-single-match': true,
7677
'application/ld+json': true,
7778
'application/nquads' : true,
7879
'application/n-quads' : true

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const NQuadsContentType = "application/n-quads" as const
4040
export const NTriplesContentType = "application/n-triples" as const
4141
export const RDFXMLContentType = "application/rdf+xml" as const
4242
export const SPARQLUpdateContentType = "application/sparql-update" as const
43+
export const SPARQLUpdateSingleMatchContentType = "application/sparql-update-single-match" as const
4344
export const TurtleContentType = "text/turtle" as const
4445
export const TurtleLegacyContentType = "application/x-turtle" as const
4546
export const XHTMLContentType = "application/xhtml+xml" as const
@@ -55,6 +56,7 @@ export type ContentType = typeof RDFXMLContentType
5556
| typeof NQuadsAltContentType
5657
| typeof NQuadsContentType
5758
| typeof SPARQLUpdateContentType
59+
| typeof SPARQLUpdateSingleMatchContentType
5860
| typeof TurtleContentType
5961
| typeof TurtleLegacyContentType
6062
| typeof XHTMLContentType

src/update-manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export default class UpdateManager {
146146
for (let i = 0; i < acceptPatch.length; i++) {
147147
method = acceptPatch[i].value.trim()
148148
if (method.indexOf('application/sparql-update') >= 0) return 'SPARQL'
149+
if (method.indexOf('application/sparql-update-single-match') >= 0) return 'SPARQL'
149150
}
150151
}
151152
var authorVia = kb.each(response, this.ns.httph('ms-author-via'))
@@ -375,7 +376,7 @@ export default class UpdateManager {
375376

376377
let options = {
377378
noMeta: true,
378-
contentType: 'application/sparql-update',
379+
contentType: 'application/sparql-update-single-match',
379380
body: query
380381
}
381382

0 commit comments

Comments
 (0)