epimorphics / dclib

Data Conversion library
Apache License 2.0
2 stars 2 forks source link

dclib reads magic from current directory #51

Open andrew-pickin-epi opened 2 months ago

andrew-pickin-epi commented 2 months ago

dclib read a file (defaultPrefixes.ttl) from the current directory.

This leads to some counter-intuitive behaviour. eg: (from fsa data model repo) this works happily:

dclib common/lib.yaml fcm/fcm.yaml fcm/fcm.csv

but this fails.

cd fcm; dclib ../common/lib.yaml fcm.yaml fcm.csv
../common/lib.yaml
12:08:39.423 Problem with one-off preprocessing of template: com.epimorphics.dclib.framework.EvalFailed: Looks like unexpanded prefix in URI: regime:food-contact-materials
07-26 12:08:39 ERROR ConverterProcess     :: Problem with one-off preprocessing of template
com.epimorphics.dclib.framework.EvalFailed: Looks like unexpanded prefix in URI: regime:food-contact-materials
        at com.epimorphics.dclib.templates.TemplateBase.validateNode(TemplateBase.java:325)
        at com.epimorphics.dclib.templates.TemplateBase.asTriple(TemplateBase.java:254)
        at com.epimorphics.dclib.templates.ResourceMapTemplate.convertRow(ResourceMapTemplate.java:105)
        at com.epimorphics.dclib.templates.CompositeTemplate.preamble(CompositeTemplate.java:188)
        at com.epimorphics.dclib.templates.TemplateRef.preamble(TemplateRef.java:83)
        at com.epimorphics.dclib.templates.CompositeTemplate.preamble(CompositeTemplate.java:192)
        at com.epimorphics.dclib.framework.ConverterProcess.preprocess(ConverterProcess.java:310)
        at com.epimorphics.dclib.framework.ConverterProcess.process(ConverterProcess.java:166)
        at com.epimorphics.dclib.framework.ConverterService.simpleConvert(ConverterService.java:157)
        at com.epimorphics.dclib.Main$Command.call(Main.java:220)
        at com.epimorphics.dclib.Main.main(Main.java:116)
12:08:39.445 Warning: template fcm.regime.modified applied but failed: com.epimorphics.dclib.framework.EvalFailed: Looks like unexpanded prefix in URI: core:lastModified [1]
12:08:39.446 Warning: template fcm.auth applied but failed: com.epimorphics.dclib.framework.EvalFailed: Looks like unexpanded prefix in URI: fcm:useAsMonomerEtc [1]
12:08:39.449 Warning: template fcm.substance applied but failed: com.epimorphics.dclib.framework.EvalFailed: Looks like unexpanded prefix in URI: fcm-material:1 [1]
12:08:39.452 Warning: template fcm.legislation applied but failed: com.epimorphics.dclib.framework.EvalFailed: Looks like unexpanded prefix in URI: core:Document [1]

because defaultPrefixes.ttl isn't read. There shoudl be a way of specifying where this file is.

der commented 1 month ago

Default prefixes are built into the jar and overrides are normally done by the templates but it seems that in some cases people override by creating a defaultPrefixes.ttl file. To allow that pattern while allowing config of location added a command line option --prefixes.

Released as 2.1.3