Thanks for this info. Question: Is there anything that the initial load or indexing of documents uses the schema ? That is, is there a performance/indexing advantage to pre-declaring the schema at load time as apposed to importing it in a given xquery.
For example I could imagine indexes indexing date types differently than string types - but it would have to know at the time the document was loaded. ---------------------------------------- David A. Lee Senior Principal Software Engineer Epocrates, Inc. [email protected] 812-482-5224 -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Michael Blakeley Sent: Friday, June 24, 2011 10:37 AM To: General MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Applying schemas to schema-less documents The server applies schemas dynamically, looking at whatever happens to be available. So yes it's possible. However that can lead to a problem: if I have a node 'run/elapsed', I might have two different schemas that contain an element 'run'. The server will use the first one it finds. Because of this I strongly recommend using namespaces and schemas together. A schema that targets {mynamespace}run is much less likely to conflict with some other schema. You can also disambiguate which schema you want using an 'import schema...' prolog expression. Let's see... there used to be a quick schema tutorial on the developer site. Here it is: http://developer.marklogic.com/learn/2007-04-schema -- Mike On 24 Jun 2011, at 07:28 , Lee, David wrote: > Suppose I have a bunch of documents with no namespace and no schemas. > I would like to apply a schema to these documents so that > > 1) I can avoid lots of casting in my xquery such as > fn:avg(($runs[@status eq 'true']/@elapsed) > instead of > fn:avg( xs:dayTimeDuration($runs[@status eq 'true']/@elapsed > )) > > 2) So that indexes are built knowing about the element and attribute types so > that things like > fn:max( xdmp:directory("/logs/" )//run/@elapsed ) > can go through an index instead and be sorted correctly (by dateTimeDuration > instead of by string > > Is this possible ? > If so how ? > > Thanks for suggestions and pointers to RTFM's > > > > > ---------------------------------------- > David A. Lee > Senior Principal Software Engineer > Epocrates, Inc. > [email protected] > 812-482-5224 > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
