rdf-validate-shacl
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -7,3 +7,11 @@ | ||
* | ||
## 0.2.0 (2020-05-25) | ||
* [BREAKING] Change `ValidationReport` and `ValidationResult` shorthand | ||
properties to return RDF terms instead of strings (#30). | ||
## 0.1.3 (2020-04-23) | ||
@@ -10,0 +18,0 @@ |
{ | ||
"name": "rdf-validate-shacl", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "RDF SHACL validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,3 @@ | ||
// See https://www.w3.org/TR/shacl/#results-validation-result for details | ||
// about each method | ||
// about each property | ||
console.log(result.message) | ||
@@ -46,0 +46,0 @@ console.log(result.path) |
@@ -47,40 +47,26 @@ const clownface = require('clownface') | ||
get message () { | ||
return this._getValue(sh.resultMessage) | ||
return this.cf.out(sh.resultMessage).terms || [] | ||
} | ||
get path () { | ||
return this._getValue(sh.resultPath) | ||
return this.cf.out(sh.resultPath).term || null | ||
} | ||
get focusNode () { | ||
return this._getValue(sh.focusNode) | ||
return this.cf.out(sh.focusNode).term || null | ||
} | ||
get severity () { | ||
const severity = this._getValue(sh.resultSeverity) | ||
return severity ? severity.split('#')[1] : null | ||
return this.cf.out(sh.severity).term || null | ||
} | ||
get sourceConstraintComponent () { | ||
return this._getValue(sh.sourceConstraintComponent) | ||
return this.cf.out(sh.sourceConstraintComponent).term || null | ||
} | ||
get sourceShape () { | ||
return this._getValue(sh.sourceShape) | ||
return this.cf.out(sh.sourceShape).term || null | ||
} | ||
_getValue (predicate) { | ||
const term = this.cf.out(predicate).term | ||
return term ? serializeTermValue(term) : null | ||
} | ||
} | ||
function serializeTermValue (term) { | ||
if (term.termType === 'BlankNode') { | ||
return `_:${term.value}` | ||
} | ||
return term.value | ||
} | ||
module.exports = ValidationReport |
395497
8251