Thanks Gary, Looks like ML 8.5.5 /9.x doesn't have cts:maximum-value, cts:minimum-value. I tried with cts:min, cts:max, throwing XDMP-NONMIXEDCOMPLEXCONT error. Any advise?
Thanks Shan. On Wed, May 24, 2017 at 7:44 AM, <general-requ...@developer.marklogic.com> wrote: > Send General mailing list submissions to > general@developer.marklogic.com > > To subscribe or unsubscribe via the World Wide Web, visit > http://developer.marklogic.com/mailman/listinfo/general > or, via email, send a message with subject or body 'help' to > general-requ...@developer.marklogic.com > > You can reach the person managing the list at > general-ow...@developer.marklogic.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of General digest..." > > > Today's Topics: > > 1. Ignoring empty/null values while search (Gary Vidal) > 2. Priorities for queries (Gary Vidal) > 3. Re: Schema validation fails for certain XMLs > (Karunanithi, Bharathi) > 4. Re: Schema validation fails for certain XMLs #CGO# > (Jain, Abhishek) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 24 May 2017 06:56:47 -0400 > From: Gary Vidal <gvidalsass...@gmail.com> > Subject: [MarkLogic Dev General] Ignoring empty/null values while > search > To: general@developer.marklogic.com > Message-ID: > <CANYhtWf5ps-Bmvgz2KRG_oPA-LbNrJqG18aQvduZ3NBKkprYKw@ > mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Shiv, > > The problem is quite simple to solve. The first thing is to determine what > is empty. Mostly empty can be the non-existence of the element and second > an empty element. Simply just add an additional negated > cts.notQuery(cts.propertyValueQuery(...)). This will filter out empty > dob > documents during projection of results. > > Q2. > > What you are expecting cannot be done simply because age is a temporal > value and MarkLogic operates on stored values. So you cannot simple > determine age without coding it for each document. But lets make some > assumptions that dob is just xs:date value and the simplest way to extract > out each bucket is quite simple: > > xquery version "1.0-ml"; > (:Get current year:) > let $today := fn:current-date() > (:Get Current Range of DOB to get years:) > let $dob-ranges := cts:value-ranges( > cts:json-property-reference("dob"), > () > ) > (:Get range of years to calculate > Any arithmetic between to dates results in a duration. > :) > let $years := fn:years-from-duration($today - > $dob-ranges/cts:minimum-value) to fn:years-from-duration($today - > $dob-ranges/cts:maximum-value) > let $year-dates := $years ! ($today - > xs:yearMonthDuration(fn:concat("P",.,"Y"))) > let $year-ranges := cts:value-ranges( > cts:json-property-reference("dob"), > $year-dates > ) > let $year-map := json:object-define($years ! fn:string(.)) > return ( > (:Iterate all year-ranges and calculate age :) > for $yr in $year-ranges > let $year := fn:years-from-duration($today - $yr/cts:maximum-value) > return > map:put($year-map,$year,cts:frequency($yr)), > $year-map > ) > > (:Enjoy:) > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://developer.marklogic.com/pipermail/general/ > attachments/20170524/7f2b48be/attachment-0001.html > > ------------------------------ > > Message: 2 > Date: Wed, 24 May 2017 06:58:17 -0400 > From: Gary Vidal <gvidalsass...@gmail.com> > Subject: [MarkLogic Dev General] Priorities for queries > To: general@developer.marklogic.com > Message-ID: > <CANYhtWciAKHRgwXnAj5jjz2pfu3M95NQf5BKdXDPA=p4PtP2Fg@mail. > gmail.com> > Content-Type: text/plain; charset="utf-8" > > Oleksii, > > Why dont you just create 2 app servers. 1 for query traffic and 1 for > admin > > Regards > > Gary > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://developer.marklogic.com/pipermail/general/ > attachments/20170524/c07cea6b/attachment-0001.html > > ------------------------------ > > Message: 3 > Date: Wed, 24 May 2017 11:27:53 +0000 > From: "Karunanithi, Bharathi" <bharathi_karunani...@condenast.com> > Subject: Re: [MarkLogic Dev General] Schema validation fails for > certain XMLs > To: MarkLogic Developer Discussion <general@developer.marklogic.com> > Message-ID: > <BN6PR02MB257798D4304D24D5353472ADFCFE0@BN6PR02MB2577. > namprd02.prod.outlook.com> > > Content-Type: text/plain; charset="us-ascii" > > Can I please get any help on the below issue? > > From: general-boun...@developer.marklogic.com [mailto:general-bounces@ > developer.marklogic.com] On Behalf Of Karunanithi, Bharathi > Sent: Tuesday, May 23, 2017 5:20 PM > To: MarkLogic Developer Discussion > Subject: [MarkLogic Dev General] Schema validation fails for certain XMLs > > Hi Team, > > I am getting the following validation error in MarkLogic 8.0-6.4 hosted on > a AWS EC2 instance. But certain xml files fails the validation against the > Schema particularly in this environment alone. > Same XML passes the validation in other ML environments and also from > other standalone validation tools using Schemas. > > The used Schema files are attached in Zip format. Major Schema file being > pam.xsd from the zip. > Sample XML for which the error is occurring and the error are also > attached with this email. > > Error: Please note that this error only occurs for a xml with a line break > tags(<br/> or <br></br>). XML files without any line breaks are passing the > Schema Validation. > XDMP-VALIDATEUNEXPECTED: (err:XQDY0027) validate lax { $n } -- Invalid > node: Found @clear but expected (@title? & @class? & @id?) at > fn:doc("//swcnpny048/2017/Print/Lucky/20170306/XML/ > GW201703_11_11.xml")/pam:message/pam:article/pam-xhtml: > body/pam-xhtml:h1/pam-xhtml:br/@clear using schema "pam.xsd" > > Script: > import module namespace validate = "http://condenast.com/dam/2.0/ > lib/validation" at "/application/lib/validation-lib.xqy"; > > import module namespace mapping = "http://condenast.com/dam/2.0/ > lib/mapping" at "/application/lib/mapping-lib.xqy"; > import module namespace util = "http://condenast.com/dam/2.0/ > lib/validation-utils" at "/application/lib/validation-utils.xqy"; > > declare namespace cndam = "http://condenast.com/dam/2.0"; > > let $path:= "//swcnpny048/2017/Print/Lucky/20170306/XML/GW201703_ > 11_11.xml" > let $assetType:= mapping:get-asset-type-by-extension($path) > let $content := xdmp:document-get($path) > let $schema := validate:get-schema-from-asset-type($assetType) > let $results := util:validate-with-schema( > $content, > $schema/cndam:namespace/text(), > $schema/cndam:schemaLocation/text() > ) > > return $results > > Please tell me if I am missing any configurations? Or any? > > Thanks, > Bharathi K > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://developer.marklogic.com/pipermail/general/ > attachments/20170524/c12ccffb/attachment-0001.html > > ------------------------------ > > Message: 4 > Date: Wed, 24 May 2017 11:44:30 +0000 > From: "Jain, Abhishek" <abhishek.b.j...@capgemini.com> > Subject: Re: [MarkLogic Dev General] Schema validation fails for > certain XMLs #CGO# > To: MarkLogic Developer Discussion <general@developer.marklogic.com> > Message-ID: > <5A37843F322E824AA0D8359ED88CD01F5EAC7FD1@IN-HYD-DAGND2. > corp.capgemini.com> > > Content-Type: text/plain; charset="us-ascii" > > Hi Bharathi, > > It's not a solution but will help in getting around a solution. > I think proper understanding of lax and Strict will help here. I think for > any new element (in your case its <br>) > Validation will obviously fail if it doesn't comply with XSDs. > > https://msdn.microsoft.com/en-us/library/dd297062.aspx > > > Thanks and Regards, > Abhishek Jain > > From: general-boun...@developer.marklogic.com [mailto:general-bounces@ > developer.marklogic.com] On Behalf Of Karunanithi, Bharathi > Sent: Wednesday, May 24, 2017 4:58 PM > To: MarkLogic Developer Discussion > Subject: Re: [MarkLogic Dev General] Schema validation fails for certain > XMLs > > Can I please get any help on the below issue? > > From: general-boun...@developer.marklogic.com<mailto:general- > boun...@developer.marklogic.com> [mailto:general-bounces@ > developer.marklogic.com] On Behalf Of Karunanithi, Bharathi > Sent: Tuesday, May 23, 2017 5:20 PM > To: MarkLogic Developer Discussion > Subject: [MarkLogic Dev General] Schema validation fails for certain XMLs > > Hi Team, > > I am getting the following validation error in MarkLogic 8.0-6.4 hosted on > a AWS EC2 instance. But certain xml files fails the validation against the > Schema particularly in this environment alone. > Same XML passes the validation in other ML environments and also from > other standalone validation tools using Schemas. > > The used Schema files are attached in Zip format. Major Schema file being > pam.xsd from the zip. > Sample XML for which the error is occurring and the error are also > attached with this email. > > Error: Please note that this error only occurs for a xml with a line break > tags(<br/> or <br></br>). XML files without any line breaks are passing the > Schema Validation. > XDMP-VALIDATEUNEXPECTED: (err:XQDY0027) validate lax { $n } -- Invalid > node: Found @clear but expected (@title? & @class? & @id?) at > fn:doc("//swcnpny048/2017/Print/Lucky/20170306/XML/ > GW201703_11_11.xml")/pam:message/pam:article/pam-xhtml: > body/pam-xhtml:h1/pam-xhtml:br/@clear using schema "pam.xsd" > > Script: > import module namespace validate = "http://condenast.com/dam/2.0/ > lib/validation" at "/application/lib/validation-lib.xqy"; > > import module namespace mapping = "http://condenast.com/dam/2.0/ > lib/mapping" at "/application/lib/mapping-lib.xqy"; > import module namespace util = "http://condenast.com/dam/2.0/ > lib/validation-utils" at "/application/lib/validation-utils.xqy"; > > declare namespace cndam = "http://condenast.com/dam/2.0"; > > let $path:= "//swcnpny048/2017/Print/Lucky/20170306/XML/GW201703_ > 11_11.xml" > let $assetType:= mapping:get-asset-type-by-extension($path) > let $content := xdmp:document-get($path) > let $schema := validate:get-schema-from-asset-type($assetType) > let $results := util:validate-with-schema( > $content, > $schema/cndam:namespace/text(), > $schema/cndam:schemaLocation/text() > ) > > return $results > > Please tell me if I am missing any configurations? Or any? > > Thanks, > Bharathi K > > > This message contains information that may be privileged or confidential > and is the property of the Capgemini Group. It is intended only for the > person to whom it is addressed. If you are not the intended recipient, you > are not authorized to read, print, retain, copy, disseminate, distribute, > or use this message or any part thereof. If you receive this message in > error, please notify the sender immediately and delete all copies of this > message. > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://developer.marklogic.com/pipermail/general/ > attachments/20170524/7d0eed93/attachment.html > > ------------------------------ > > _______________________________________________ > General mailing list > General@developer.marklogic.com > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > > > End of General Digest, Vol 155, Issue 32 > **************************************** >
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general