← Back to team overview

zorba-coders team mailing list archive

Re: [Merge] lp:~zorba-coders/zorba/bug1064978 into lp:zorba

 

> > > > > So, should I remove the xml dependency from the function? or should I
> > > remove
> > > > > the whole function?
> > > > > If we remove the function the user should be able to create the same
> > > > function
> > > > > by themselves using xqxq:get-type-variable
> > > > I think we should remove the entire function. It leaves to many
> unanswered
> > > > questions. For example,
> > > > what if the user wants to pass other parameters to the parse-fragment
> > > function
> > > > or what if the user wants to validate items before passing them as
> > > arguments?
> > >
> > > So I made the following changes:
> > > *Removed the implementation of bind-cast-variable
> > > *Changed the return value of getVariableType from zorba::String to a
> string
> > > Item since if the function returns a TypeIdentifier getting a legible type
> > of
> > > the variable is lost, unless there is a way to get the schema String from
> a
> > > typeIdentifier?
> > I think a string item doesn't make a difference. The type of a variable is a
> > sequence type that consists of a QName and an occurrence indicator. Just
> > having the name doesn't really help. What do you think is missing from the
> > TypeIdentifier? It allows you to retrieve the URI, local name, and
> quantifier.
> > What am I missing?
> 
> There are 2 things I miss information about typeIdentifier:
> 1. how to create a TypeIdentifier from a XQType
Take a look at CollectionImpl::getType in src/api/collectionimpl.cpp.

> 2. The function of xqxq is supposed to return the string of type function so
> getVariableType is returning the XQType toSchemaString so that the user can
> actually use it to cast the values of the variable, now does a typeIdentifier
> has a value like that? Does the localname represents that?
The problem is that there is no representation of types in the data model. To answer the question we need to investigate the use case. I think the function should either (1) return a QName item that represents the name of the type (maybe renaming the function to getVariablePrimeType) or (2) return a string using the sequence-type syntax (e.g. xs:string*, xs:integer?, or Q{http://foo.bar}my-type*).

-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1064978/+merge/150696
Your team Zorba Coders is subscribed to branch lp:zorba.


Follow ups

References