AKSW / RDFUnit

An RDF Unit Testing Suite
http://RDFUnit.aksw.org
Apache License 2.0
150 stars 42 forks source link

More transparent facilites to specify local alternatives for LOV schema locations for CLI #39

Open neradis opened 8 years ago

neradis commented 8 years ago

Currently, when I want to use, for example a local version of the NIF core ontology instead of the official version at /opt/nif-core.ttl, I can declare this using: bin/rdf-unit -s /opt-nif-core.ttl -d /opt/nif-doc-to-test.ttl

But if I use a file URL, the initialisation fails - a org.aksw.rdfunit.io.reader.RDFDereferenceReader and org.aksw.rdfunit.io.reader.RDFaReader are tried, which both seem only to expect and accept RDF/XML: bin/rdf-unit -s file:///opt-nif-core.ttl -d /opt/nif-doc-to-test.ttl <- fails

This specific issue should probably be fixed, but then still a user just wanting to re-route a single ontology to a local work-in-progress version would not be able to utilize the convenient automatic LOV-resolution for other vocabs appearing in the document ot validate.

I would propose a different approach, that introduced a new command line switch --prefix-remap:

bin/rdf-unit --prefix-map 'nif:/opt-nif-core.ttl' -d /opt/nif-doc-to-test.ttl

Proposed semantics: Initialize the prefix <-> schema-uri BiMap as before, but afterwards merge the map provided from the command line into the default BiMap. This allows (as in the example scenario) easy-rerouting for test purposes and to specify additional prefixes for vacabularies that did not make it to LOV yet.

The -s switch could then really just expect prefix names (as many identifiers in the code already suggest), making its semantics clearer to follow by users and less error-prone to implement.

@jimkont What do you think?