New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rmlio/yarrrml-parser

Package Overview
Dependencies
Maintainers
2
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmlio/yarrrml-parser - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

test/joincondition-with-function/mapping.rml.ttl

9

CHANGELOG.md

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

## [0.2.3] - 2018-11-07
### Added
- support recursive functions with join conditions
### Fixed
- recursive functions were broken due to changes in [0.2.0]
## [0.2.2] - 2018-10-23

@@ -45,2 +53,3 @@

[0.2.3]: https://github.com/RMLio/yarrrml-parser/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/RMLio/yarrrml-parser/compare/v0.2.1...v0.2.2

@@ -47,0 +56,0 @@ [0.2.1]: https://github.com/RMLio/yarrrml-parser/compare/v0.2.0...v0.2.1

3

lib/expander.js

@@ -302,2 +302,3 @@ /**

expandFunction(e.value);
e.from = 'function';
}

@@ -357,2 +358,2 @@ }

module.exports = expand;
module.exports = expand;

@@ -423,3 +423,3 @@ /**

const {predicate, object} = this.getAppropriatePredicateAndObjectForObjectValue(pm.parameter);
const {predicate, object} = this.getAppropriatePredicateAndObjectForObjectValue(pm.parameter, true);

@@ -446,28 +446,26 @@ this.quads.push(quad(

if (pm.from === 'subject') {
if (pm.value instanceof Object) {
this.generateFunctionTermMap(omSubject, pm.value, sourceSubject);
} else {
//get type: iri or literal
const {predicate, object} = this.getAppropriatePredicateAndObjectForObjectValue(pm.value);
//get type: iri or literal
const {predicate, object} = this.getAppropriatePredicateAndObjectForObjectValue(pm.value);
this.quads.push(quad(
omSubject,
predicate,
object
));
if (pm.type === 'iri') {
this.quads.push(quad(
omSubject,
predicate,
object
namedNode(namespaces.rr + 'termType'),
namedNode(namespaces.rr + 'IRI')
));
if (pm.type === 'iri') {
this.quads.push(quad(
omSubject,
namedNode(namespaces.rr + 'termType'),
namedNode(namespaces.rr + 'IRI')
));
} else {
this.quads.push(quad(
omSubject,
namedNode(namespaces.rr + 'termType'),
namedNode(namespaces.rr + 'Literal')
));
}
} else {
this.quads.push(quad(
omSubject,
namedNode(namespaces.rr + 'termType'),
namedNode(namespaces.rr + 'Literal')
));
}
} else if (pm.from === 'function') {
this.generateFunctionTermMap(omSubject, pm.value, sourceSubject);
} else {

@@ -616,3 +614,3 @@ const parentTermMapSubject = namedNode(this.baseIRI + this.getUniqueID('ptm'));

getAppropriatePredicateAndObjectForObjectValue(value) {
getAppropriatePredicateAndObjectForObjectValue(value, isFunctionParameter = false) {
let predicate = namedNode(namespaces.rr + 'template');

@@ -629,3 +627,8 @@ const escapedValue = YARRRML2Anything.escapeTemplate(value);

predicate = namedNode(namespaces.rr + 'constant');
object = literal(YARRRML2Anything.expandPrefix(value));
if (isFunctionParameter) {
object = namedNode(YARRRML2Anything.expandPrefix(value));
} else {
object = literal(YARRRML2Anything.expandPrefix(value));
}
} else {

@@ -639,2 +642,2 @@ object = literal(YARRRML2Anything.expandPrefix(parsedValue));

module.exports = YARRRML2Anything;
module.exports = YARRRML2Anything;

@@ -143,5 +143,9 @@ /**

generateCondition(condition, omSubject) {
if (condition.function === 'equal') {
if (condition.function === 'equal' && !this._parametersContainsFunction(condition.parameters)) {
super.generateCondition(condition, omSubject);
} else {
if (condition.function === 'equal') {
this._convertEqualToIDLabEqual(condition);
}
const joinConditionSubject = namedNode(this.baseIRI + this.getUniqueID('jc'));

@@ -162,4 +166,26 @@

}
_parametersContainsFunction(parameters) {
let i = 0;
while (i < parameters.length && typeof parameters[i].value === 'string') {
i ++
}
return i < parameters.length;
}
_convertEqualToIDLabEqual(fn) {
fn.function = 'http://example.com/idlab/function/equal';
fn.parameters.forEach(pm => {
if (pm.parameter === 'str1') {
pm.parameter = 'http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter';
} else if (pm.parameter === 'str2') {
pm.parameter = 'http://users.ugent.be/~bjdmeest/function/grel.ttl#valueParameter2';
}
});
}
}
module.exports = YARRRML2RML;

@@ -56,3 +56,3 @@ /**

work('example8/mapping.yml', 'example8/mapping.rml.ttl', done);
})
});

@@ -71,2 +71,6 @@ it('works for prefix expansion', function (done) {

it('recursive functions', function (done) {
work('recursive-functions/mapping.yml', 'recursive-functions/mapping.rml.ttl', done);
});
it('works for strings starting with "{"', function (done) {

@@ -89,2 +93,6 @@ work('template-escape/mapping.yml', 'template-escape/mapping.rml.ttl', done);

});
it('joincondition with function', function (done) {
work('joincondition-with-function/mapping.yml', 'joincondition-with-function/mapping.rml.ttl', done);
});
});

@@ -91,0 +99,0 @@

{
"name": "@rmlio/yarrrml-parser",
"version": "0.2.2",
"version": "0.2.3",
"description": "Parse YARRRML descriptions into RML RDF statements",

@@ -5,0 +5,0 @@ "main": "lib/yarrrml2rml.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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