UNPKG

graphdb

Version:

Javascript client library supporting GraphDB and RDF4J REST API.

40 lines (39 loc) 1.62 kB
export = SparqlJsonResultParser; /** * Parse a sparql tuple query json result and convert it RDFJS-based * data structure. * * A custom parser library is used for the parsing. Also the N3 DataFactory is * used for building the data objects instead of the native RDFJS datafactory as * there are some minor discrepancies in between them and we already stuck to N3 * as a default implementation. * * @class * @author Mihail Radkov * @author Svilen Velikov */ declare class SparqlJsonResultParser extends ContentParser { parser: SparqlJsonParser; /** * This method should be invoked with a text stream and will return also a * stream converted to RDFJS objects. * * Client of the method can subscribe to following events in order to consume * the stream: * <code> * stream.on('variables', (variables) => console.log(variables)); * stream.on('data', (bindings) => console.log(bindings)); * stream.on('error', (error) => console.log(error)); * </code> * * @param {NodeJS.ReadableStream} stream with the text which has to be parsed * to given format. * @param {Object} [config] optional parser configuration. * @return {NodeJS.ReadableStream|Promise<boolean>} a stream with the * converted content for SELECT queries and a Promise which resolves to * boolean value for ASK queries. */ parse(stream: NodeJS.ReadableStream, config?: any): NodeJS.ReadableStream | Promise<boolean>; } import ContentParser = require("../parser/content-parser"); import { SparqlJsonParser } from "sparqljson-parse/lib/SparqlJsonParser";