One suggestion is to run your schemas through a conversion process to eliminate 
the 1.1isms but keep as much of the typing .
ML doesn't require documents to be schema valid unless you explicitly validate 
them.  But it will use what it can from schemas to assign types to simple 
content.

For many things I've simply taken a corpus of a few docs (or few hundred) and 
ran them *with no schema* through a schema generation tool (like Oxygen has) 
and used the generated schema without even looking at it.
It won't be perfect, and the more docs you give it the better - but even a few 
sample docs can usually deduce basic atomic types close enough...

Alternatively you could use similar tools to down-convert 1.1 XSD to 1.0 and 
likely end up with a very accurate schema that's only missing a few things - 
like the asserts - which have no bearing at all on typing unless you use 
dynamic type assignment in the schema ... ( overstepping my knowledge here - 
I'm not sure there is such a thing).



-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com<http://www.marklogic.com/>

From: [email protected] 
[mailto:[email protected]] On Behalf Of Timothy W. Cook
Sent: Friday, October 31, 2014 1:07 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] datatypes and Range Indexes

So, since my schemas are not valid because they use some XML Schema 1.1 
features. I thought maybe I could get datatyping by building range indexes on 
certain elements.

However, unless I am doing something wrong; range indexes do not help with this 
issue.



I defined an Element Range index on  an element, magnitude with the namespace 
http://www.mlhim.org/ccd and a type of xs:decimal.

This query:


declare namespace ccd = "http://www.mlhim.org/ccd";;

for $doc in fn:doc()
  return 
xdmp:describe($doc//ccd:el-7ef40847-ea17-435e-856a-d489a32514d7/ccd:magnitude/data())


returns:

xs:untypedAtomic("998070")


So, does this mean that all of my queries will have to explicitly coerce the 
data?

Which leaves me with fn:number() correct?  now way to test that it is an 
integer, etc.

Any guidance is appreciated.


============================================
Timothy Cook
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
MLHIM http://www.mlhim.org<http://www.mlhim.org/>

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

Reply via email to