I got one step further with this.   the 3 arg setNewVariable is already
calling  valueVactory.newSequence

I got further by replacing it with this

 

     request.setNewVariable( new XName("", "dirs"),
ValueFactory.newSequence(dirs.toArray(new XdmValue[dirs.size()])));

     

 

Now I got 

 

com.marklogic.xcc.exceptions.UnimplementedFeatureException: Setting
variables that are sequences is not supported

 

 

So I guess sequences are not supported ... UG ...

 

Could I put in a feature request to support sequences for XCC xquery
calls ?  

 

 

What I'm trying to do is avoid 10,000 calls to adHocQuery by passing in
all the values as an argument.

My next step will be to try create an Element as the argument instead of
a sequence.

Any chance elements are supported as variables in XCC ???

 

If that doesnt work then I suppose I'll serialize a huge XQuery document
with in-line values to construct a sequence ... 

 

 

-David

 

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Lee, David
Sent: Saturday, March 13, 2010 10:04 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Problem creating a SEQUENCE in XCC to
passto xquery function

 

I'm trying to create a SEQUENCE in XCC to pass to an ad-hoc xquery.

I want a sequence of xs:string 

 

I create a linked-list of XdmValue using this :

 

 

List<XdmValue> dirs = new LinkedList<XdmValue>();

...

 

XdmValue xdm = ValueFactory.newValue(ValueType.XS_STRING, uri);

dirs.add(xdm);

 

Then call this

 

request.setNewVariable("dirs", 

     ValueType.SEQUENCE, 

     ValueFactory.newSequence(dirs.toArray(new XdmValue[dirs.size()])));

 

I get this exception :

 

java.lang.IllegalArgumentException: Value must be array of XdmValue

 

 

Inspecting dirs I find each entry is of type XsStringImpl which is
implements XdmValue (indirectly)

So I dont see where my problem is ...

 

Any suggestions on making a sequence of strings to pass through XCC ?

 

 

 

----------------------------------------

David A. Lee

Senior Principal Software Engineer

Epocrates, Inc.

[email protected]

812-482-5224

 

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to