Skip to content

Commit

Permalink
Fix custom factory not always used
Browse files Browse the repository at this point in the history
Some quads in the validation report dataset were not created using the
provided custom data factory. This was caused by the fact that
"clownface" didn't support a custom factory. It does in the new version.
  • Loading branch information
martinmaillard committed Apr 15, 2020
1 parent a79cc50 commit d8da2d9
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 89 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

## Next version (TBA)

* Fix provided factory not being used to create all quads in the validation
report
* Performance improvements


Expand Down
144 changes: 61 additions & 83 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"@rdfjs/dataset": "~1.0.1",
"@rdfjs/namespace": "~1.1.0",
"@rdfjs/term-set": "~1.0.1",
"clownface": "^0.12.1",
"clownface": "^0.12.3",
"rdf-validate-datatype": "^0.1.1"
},
"devDependencies": {
"@rdfjs/parser-n3": "^1.1.3",
"@rdfjs/parser-n3": "^1.1.4",
"@zazuko/rdf-vocabularies": "^2020.3.23",
"debug": "^4.1.1",
"get-stream": "^5.1.0",
"mocha": "^7.1.1",
"nyc": "^15.0.0",
"nyc": "^15.0.1",
"rdf-ext": "^1.3.0",
"rdf-utils-fs": "^2.1.0",
"standard": "^14.3.3"
Expand Down
2 changes: 1 addition & 1 deletion src/rdflib-graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RDFLibGraph {
}

get cf () {
return clownface({ dataset: this.dataset })
return clownface({ dataset: this.dataset, factory: this.factory })
}

getInstancesOf ($class) {
Expand Down
3 changes: 1 addition & 2 deletions test/validation_report_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ describe('ValidationReport', () => {

assert.ok(report.dataset._test === 'test')
report.dataset.forEach((quad) => {
// TODO: This fails because clownface doesn't support a custom factory yet
// assert.ok(quad._test === 'test')
assert.ok(quad._test === 'test')
assert.ok(quad.subject._test === 'test')
assert.ok(quad.predicate._test === 'test')
assert.ok(quad.object._test === 'test')
Expand Down

0 comments on commit d8da2d9

Please sign in to comment.