Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmlio/rmlmapper-java-wrapper

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmlio/rmlmapper-java-wrapper - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

test/tc02/mapping.ttl

6

CHANGELOG.md

@@ -8,2 +8,7 @@ # Changelog

## [0.0.3] - 2019-05-16
### Added
- Return log as part of an error when RMLMapper execution fails.
## [0.0.2] - 2019-05-13

@@ -15,2 +20,3 @@

[0.0.3]: https://github.com/RMLio/yarrrml-parser/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/RMLio/yarrrml-parser/compare/v0.0.1...v0.0.2

@@ -31,2 +31,22 @@ /**

});
it('Invalid mapping', async () => {
const wrapper = new RMLMapperWrapper(rmlmapperPath, tempFolderPath, true);
const rml = fs.readFileSync('./test/tc02/mapping.ttl', 'utf-8');
const sources = {
'student.csv': fs.readFileSync('./test/tc02/student.csv', 'utf-8')
};
let error;
try {
await wrapper.execute(rml, sources, false, true);
} catch (err) {
error = err;
}
assert.strictEqual(error === null, false);
assert.strictEqual(error.message, `Error while executing the rules.`);
assert.strictEqual(error.log.indexOf('No Triples Maps found.') !== -1, true);
});
});

66

lib/wrapper.js

@@ -68,41 +68,43 @@ /**

if (stderr) {
console.error(stderr);
}
const err = new Error(`Error while executing the rules.`);
err.log = stderr;
reject(err);
} else {
fs.readFile(outputFile, 'utf8', async (outputErr, output) => {
if (outputErr) {
outputErr.message = `Error while reading output file '${outputFile}'`;
reject(outputErr);
} else {
if (asQuads) {
output = await strToQuads(output);
}
fs.readFile(outputFile, 'utf8', async (outputErr, output) => {
if (outputErr) {
outputErr.message = `Error while reading output file '${outputFile}'`;
reject(outputErr);
} else {
if (asQuads) {
output = await strToQuads(output);
}
if (generateMetadata) {
fs.readFile(metadataFile, 'utf8', async (metadataErr, metadata) => {
if (metadataErr) {
metadataErr.message = `Error while reading output file '${metadataFile}'`;
reject(metadataErr);
} else {
if (asQuads) {
metadata = await strToQuads(metadata);
}
if (generateMetadata) {
fs.readFile(metadataFile, 'utf8', async (metadataErr, metadata) => {
if (metadataErr) {
metadataErr.message = `Error while reading output file '${metadataFile}'`;
reject(metadataErr);
} else {
if (asQuads) {
metadata = await strToQuads(metadata);
resolve({output, metadata});
}
});
} else {
resolve({output});
}
}
resolve({output, metadata});
if (self.removeTempFolders) {
fs.remove(processDir, err => {
if (err) {
err.message = `Unable to remove temp folder "${processDir}.`;
reject(err)
}
});
} else {
resolve({output});
}
}
if (self.removeTempFolders) {
fs.remove(processDir, err => {
if (err) {
err.message = `Unable to remove temp folder "${processDir}.`;
reject(err)
}
});
}
});
});
}
});

@@ -109,0 +111,0 @@ }

{
"name": "@rmlio/rmlmapper-java-wrapper",
"version": "0.0.2",
"version": "0.0.3",
"description": "A JavaScript wrapper around the Java RMLMapper.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc