Ability to provide base IRI for parsing relative IRIs in input files
When an input has no @base, the file's URL is used to parse relative references.
I would like to ask for a --base or --base-iri CLI option to set the base for parsing if the base directive is missing.
For eye you can use
--wcache <uri> <file> to tell that <uri> is cached as <file>
Hm, that did not work.
I have a base.n3 file:
PREFIX ex: <http://example.org/>
<foobar> a ex:Foo .
{
<http://localhost/foobar> a ex:Foo .
} => {
<http://localhost/foobar> a ex:Bar .
} .
I expected that calling with --wcache http://localhost/ base.n3 would do the trick but it still parses the relative reference as file:// URL
> eye --nope --quiet --pass --wcache http://localhost/ base.n3 base.n3
@prefix ex: <http://example.org/>.
<file:///absolute/path/foobar> a ex:Foo.
I'm also unsure how this is going to work when there are multiple files like that. Consider foo.n3 and bar.n3
eye --nope --quiet --pass --wcache http://localhost/ foo.n3 foo.n3 --wcache http://localhost/ bar.n3 bar.n3
The description of --wcache suggests that this is not valid usage and each usage should have a different value of <uri>?
It works as follows:
$ eye --nope --quiet --pass --wcache http://localhost . http://localhost/base.n3
@prefix ex: <http://example.org/>.
<http://localhost/foobar> a ex:Foo.
<http://localhost/foobar> a ex:Bar.
and we use it all the time for multiple files, either by specifying a "directory", like the above . or by multiple --wcache options
for examples see all test files in the subdirectories of https://github.com/eyereasoner/eye/tree/master/reasoning
It took me a while to understand that in a sense it is the opposite of specifying base - instead of specifying what base to use to interpret a local file, wcache specifies what local cache to use for a given remote URL.
My use case involved globbing files. I therefore needed to instead use string manipulation to construct the remote URLs based on the local paths.
eye --nope --quiet --pass --wcache https://remote . $(find main/ -maxdepth 1 -type f -name '*.ttl' -printf 'https://remote/%f\n')
Edit: This was a partial solution because the files in question used the convention that https://remote/resource maps to the local file resource$.ttl.
As a workaround I post processed the generated triples to remove the $.ttl:
sed 's/\$.ttl//g'