Claude,

IRIResolver.resolveFileURL() works on filenames only and
"jar:file://[jarPath]![enclosedFile]" isn't a filename.

But as a filename "jar:file:" is legal, albeit rather wierd (so for that matter is "http:" -- try it) and so it looks like "./jar:file:/".

So IRIResolver.resolveFileURL() isn't the right function to call. You want the non-existent IRIResolver.resolveJarURL() as access to some implementation for jarfiles.

The general IRIResolver.resolveString returns "jar:file://[jarPath]![enclosedFile]" because there is no code to handle the "jar:" URI scheme (or that that URI is already correct).

The deep change is to add to the jena-iri codebase. Statics on IRIResolver only work on the global resolver.

What is the correct absolute URI for

"jar:file://[jarPath]![enclosedFile]"

or rather, what do you want it to be?

        Andy


On 12/07/13 15:58, Claude Warren wrote:
I am looking at TestModelRead.testSimpleLoadImplictBase() where the test
cases are being read from the jena-core tests  jar v 2.10.1.

public void testSimpleLoadImplictBase() throws IRIException,
FileNotFoundException
{
final Model mBasedImplicit = createModel();
final String fn = IRIResolver
.resolveFileURL( getFileName("modelReading/based.n3"));
final Model wanted = createModel().add(ModelHelper.resource(fn),
ModelHelper.property("ja:predicate"),
ModelHelper.resource("ja:object"));
mBasedImplicit.read(fn, "N3");
ModelHelper.assertIsoModels(wanted, mBasedImplicit);
}


the method getFileName("modelReading/based.n3") returns a
jar:file://[jarPath]![enclosedFile] url.  I have registered a new Locator
(LocatorJarURL)  using StreamManager.get().addLocator( new LocatorJarURL()
  );

LocatorJarURL does as you would expect and extracts the stream from the jar.

The problem is that the IRIResolver.resolveFileURL() does not recognize the
jar: URL and converts it to
file://[directory]/jar:file://[jarPath]![enclosedFile]

While I could patch
IRIResolver.resolveFileURL() to handle the jar based URL I think this
points to a larger problem wherein file locators added to the StreamManager
do not add capabilities to the IRIResolver.

Is there a recommended way to register file based scheme (like jar) with
the IRIResolver?  I am more than happy to code it if we have a
recommendation.

Claude


Reply via email to