RE: Calabash: Java API

To make things clear: this is not about Calabash, but about EMC's
Calumet. The thing is that Calumet resolves relative source URIs against
the base URI of the pipeline while the pipeline itself is resolved
against cwd (or a custom base URI provided through Calumet API).
 
Suppose cwd is /home/foo. Then, with the default configuration, the
following code:
 
String path = "some/path/to/pipeline.xproc";
Source src = new Source(path);
Pipeline pipe = engine.newPipeline(src);
 
will attempt to load the pipeline from
/home/foo/some/path/to/pipeline.xproc.
 
However, the URIs of input docuemnts are resolved against the base URI
of the pipeline. So if you do:
 
PipelineInput input = new PipelineInput();
input.addInput("source", new Source(path));
 
with the intention of passing the pipeline itself as its input, the
source will be expected to be in
/home/foo/some/path/to/some/path/to/pipeline.xproc. I agree this may be
confusing because you are expecting the source URI to be resolved
against cwd, similar to the pipeline itself.
 
--
 
On the other hand, if your pipeline is at
http://foo/pipelines/pipeline.xpl and you pass "../data/doc.xml" as the
source URI, the engine will automatically load it from
http://foo/data/doc.xml
 
I am still trying to understand what should be the preferred behavior. I
can see value in both...
 
Regards,
Vojtech



________________________________

	From: David A. Lee [mailto:dlee@calldei.com] 
	Sent: Thursday, July 23, 2009 3:05 PM
	To: Florent Georges
	Cc: Toman, Vojtech; xproc-dev@w3.org
	Subject: Re: Calabash: Java API
	
	
	I think its me thats confused.   
	
	Your right I was referring to the test driver, but itself it
calls into the xproc core so its fundamentally the same issue.
	(but I was talking about calabash source, not sure which
codebase your referring to).
	
	Looking at your example I only see the difference being :
	
	
	String path = "some/path/to/pipeline.xproc"; 
	input.addInput("source", new Source(path)); 
	
	vs
	
	input.addInput("source", new Source("pipeline.xproc")); 

	
	

	The later works but not the former ?
	where is "pipeline.xproc" located?
	


	David A. Lee
	dlee@calldei.com  
	http://www.calldei.com
	http://www.xmlsh.org
	812-482-5224


	Florent Georges wrote: 

		2009/7/23 David A. Lee wrote:
		
		  Hi David,
		
		  

			[...]
			    

		
		  

			Then inside that test is a reference to
"testpipe.xml" (the
			xproc source).
			    

		
		  

			[...]
			    

		
		  

			Different threads in xmlsh have their own
"current directory"
			but java doesnt support per-thread pwd's, so if
calabash had
			resolved all relative URI's to the
process-global PWD it would
			break given any relative paths.
			    

		
		  

			So I think this is the correct way to go both
from an XML
			perspective and from a Java perspective.
			    

		
		  Well, in your example with the test suite, I think
this is a
		feature *of the test suite format* itself: how should
embedded
		URIs be resolved.
		
		  About the PWD, my point is not about using the PWD,
whatever is
		is defined to be, but instead to use the same resolving
mechanism
		for different Source objects using a system ID,
independently of
		what they are use for (as pipeline document source or
input
		document source.)
		
		  To take a concrete example, the following tries to
apply an
		XProc document to itself, but won't work:
		
		    String        path  = "some/path/to/pipeline.xproc";
		    Source        src   = new Source(path);
		    Pipeline      pipe  = engine.newPipeline(src);
		    PipelineInput input = new PipelineInput();
		    input.addInput("source", new Source(path));
		
		  Something like
"some/path/to/some/path/to/pipeline.xproc cannot
		be found" will be the error message.  But the following
will
		succeed (a little bit surprisingly IMHO):
		
		    Source        src   = new
Source("some/path/to/pipeline.xproc");
		    Pipeline      pipe  = engine.newPipeline(src);
		    PipelineInput input = new PipelineInput();
		    input.addInput("source", new
Source("pipeline.xproc"));
		
		  But maybe I missed your point?
		
		  Regards,
		
		  

Received on Thursday, 23 July 2009 13:17:51 UTC