inrupt/artifact-generator

[3pt] Prevent failure when encountering a term from another namespace

NSeydoux opened this issue · 1 comments

Currently, the artifact generator fails when a term is encountered that has a different namespace than the base vocabulary's. This will lead to valid vocabs not being manageable with the artifact generator.

I would suggest to simply get rid of this behaviour, although it is true that it may prevent typos. I suggest to use an edit distance to compare the namespaces, and to only fail under a certain threshold, when the two namespaces are very similar. Otherwise, the term should just be ignored.

Probably needs further discussion. This failing was not just for typos (but I like the idea of using an edit distance to suggest that!), but was for vocabs that do actually define terms from two different namespaces, meaning it's ambiguous which namespace we should actually use for the generated source code file. I think PROV-O was an example.
Since we have the power of a YAML config file now, I'm sure we can easily configure how to handle this situation now (e.g. provide an option 'onlyGenerateTermsFromNamespace' and run the same vocab (e.g. PROV_O as defined in this vocab: http://www.w3.org/ns/prov#) through twice with different values for that option to specify the explicit namespace we want to use for each pass). But if that option is not set, and we encounter his current situation, I'd still blow up (but extend the error message to point to the new option to provide disambiguation).