sparqljson-parse
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -53,2 +53,5 @@ "use strict"; | ||
} | ||
else if (jsonParser.key === "metadata" && jsonParser.stack.length === 1) { | ||
resultStream.emit('metadata', value); | ||
} | ||
}; | ||
@@ -55,0 +58,0 @@ const resultStream = sparqlResponseStream |
{ | ||
"name": "sparqljson-parse", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Parses SPARQL JSON query results", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -120,2 +120,27 @@ # SPARQL-Results+JSON Parse | ||
### Advanced: metadata entries | ||
This library can recognise metadata on the result stream in the following form: | ||
```json | ||
{ | ||
"head": { "vars": [ "book", "library" ] }, | ||
"results": { | ||
"bindings": [ | ||
{ "book": { "type": "uri", "value": "http://example.org/book/book1" }, "library": { "type": "uri", "value": "http://example.org/book/library1" } } | ||
] | ||
}, | ||
"metadata": { "httpRequests": 0 } | ||
} | ||
``` | ||
This metadata can be captured by listening to the `"metadata"` event: | ||
``` | ||
sparqlJsonParser.parseJsonResultsStream(myStream) | ||
.on('metadata', (metadata: any) => console.log(metadata)) | ||
.on('data', (bindings: IBindings) => console.log(bindings)); | ||
``` | ||
Note that this is part of the SPARQL/JSON specification. | ||
## License | ||
@@ -122,0 +147,0 @@ This software is written by [Ruben Taelman](http://rubensworks.net/). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258
149
19353
9