Is there a way to verify that the template contains only those characters that are passed to #param ?
I considered options with xpath functions(fn:) but have not found a suitable option.
this is 2 valid xml for example:
<rule type="myRule" template="A-B-CB">
<attribute param="B"/>
<attribute param="A"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="A(C)-B">
<attribute param="C"/>
<attribute param="A"/>
<attribute param="B"/>
</rule>
and 2 not valid xml:
<rule type="myRule" template="AB-CD">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
<rule type="myRule" template="AC">
<attribute param="A"/>
<attribute param="B"/>
<attribute param="C"/>
</rule>
perhaps there are ideas how to implement it using schematrone or otherwise?
So the set of letters in #template must be exactly the same as the set of letters in ./attribute/#param?
That is to say, distinct-values(string-to-codepoints(replace(#template, '\P{L}', ''))) must be the same set as distinct-values(attribute/#param/string-to-codepoints()).
So how do you assert that two sequences contain the same values, under permutation?
In XPath 3.1, deep-equal(sort($X), sort($Y))
In XPath 2.0, I can't think of anything better than
empty($X[not(.=$Y)]) and empty($Y[not(.=$X)])
I'll leave you to put this all together.
Related
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.StopFilterFactory" words="stopwords.txt" ignoreCase="true"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="15"/>
</analyzer>
Above is my query ^
Search ==> Saree
Results of EdgeNGramFilterFactory ==> [sar, sare, saree]
then the searching happens ..but products title (boost field) having value sar appears first in the list...but I want results of saree first and then remaining word
what I want ==> [saree, sare, sar]
Can anyone suggest how can I get above results.
Thanks.
edit1
rawquerystring": "saree",
"querystring": "saree",
"parsedquery": "(+DisjunctionMaxQuery(((category_name_textv:sar category_name_textv:sare category_name_textv:saree) | ((title_textv:sar title_textv:sare title_textv:saree)^0.24) | (product_id_text:sar product_id_text:sare product_id_text:saree) | ((specification_textv:sar specification_textv:sare specification_textv:saree)^0.5) | ((description_textv:sar description_textv:sare description_textv:saree)^0.5)))
I printed values of deubg=all as pointed by #MatsLindh
how can I change patter of highlighted part
(category_name_textv:sar category_name_textv:sare category_name_textv:saree)
to
(category_name_textv:saree category_name_textv:sare category_name_textv:sar)
Please suggest to achieve the above pattern.
Thanks in advance.
I am trying to get the attribute tags within accessory tag to be line items of a CSV file
I have tried to iterate using map function but im just getting one value at a time.What i want is there are two Accesory Type tag in this XML i want their respective attribute tags to become each line item in the CSV
<Accessory Type="Panel">
<PartNumber>9021447</PartNumber>
<Attribute Name="DescCode">Operating Panel, White/PI White, Low E SmartSun Tempered Glass</Attribute>
<Attribute Name="Mark_ID">41424</Attribute>
<Attribute Name="Order_Quantity">1</Attribute>
<Attribute Name="QUOTE_QUANTITY">1</Attribute>
<Attribute Name="Quote_Quantity_Extended">1</Attribute>
<Attribute Name="MarkName">0001</Attribute>
<Attribute Name="US_ENERGY_STAR_CLIMATE_ZONE">Northern</Attribute>
<Attribute Name="SubUnitID">1</Attribute>
<Attribute Name="AW_Control_2">47AoYY</Attribute>
<Attribute Name="ReferenceID">3</Attribute>
<Attribute Name="OrderPONum"/>
</Accessory>
<Accessory Type="Screen">
<PartNumber>2505930</PartNumber>
<Attribute Name="Total_Pre_Price_in_USD">208.70</Attribute>
<Attribute Name="Total_Price_in_USD">208.700</Attribute>
<Attribute Name="QUOTE_QUANTITY">1</Attribute>
<Attribute Name="Quote_Quantity_Extended">1</Attribute>
<Attribute Name="DescCode">Insect Screen, Gliding, White</Attribute>
<Attribute Name="Mark_ID">41424</Attribute>
<Attribute Name="Order_Quantity">1</Attribute>
</Accessory>
I have tried to make the attributes under accessory tag to become line items.
Expected output:
9021447|Operating Panel, White/PI White, Low E SmartSun Tempered Glass|41424
//and in the next line
25005930|208.70|1 //and so on
This is the code that i have tried
%dw 2.0
output application/json
---
payload.m2oFile.m2oOrder.Unit.*Accessory map (value, index) -> {
(index) : value.*Attribute filter($.#Name == "MarkID"),
(index) : value.*Attribute filter($.#Name == "PRODTYPE"),
(index) : value.*Attribute filter($.#Name == "UNIT_CODE")
}
Try with this approach..
%dw 2.0
output application/csv header=false
---
(payload.a.*Accessory map {
PN: $.PartNumber,
($.*Attribute map {
(($$) : $) if (isEmpty($) == false)
})
}
)
Should give you the output as follows:
PS: i had to add "a" as the root to the xml as otherwise the xml would not be well formed..
I need help finding the overlapping dates in this XML code. I need to make sure that the End date is not less than or equal to the proceeding Start Date.
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-18" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="9" />
</InvCounts>
</Inventory>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-19" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="8" />
</InvCounts>
</Inventory>
I have tried the following code.
<rule context="Inventory">
<report test="translate(StatusApplicationControl/#Start, '-', '') <= translate(preceding::Inventory/preceding::StatusApplicationControl/#End, '-', '')">The #Start="<value-of select="#Start"/>" and #End="<value-of select="#End"/>" dates are overlaping</report>
</rule>
I expect this message to be printed -
The Start="2019-07-18" is less than or equal to the End="2019-07-18" date
Any help is greatly appreciated!
It looks like the comments are not helping you.
The rule should be:
<rule context="Inventory">
<report
test="translate(StatusApplicationControl/#Start, '-', '')
<=translate(preceding::Inventory[1]/StatusApplicationControl/#End,'-','')"
>The #Start="<value-of select="#Start"/>" and #End="<value-of
select="preceding::Inventory[1]/StatusApplicationControl/#End"
/>" dates are overlaping</report>
</rule>
EDIT
This Schematron
<schema xmlns="http://purl.oclc.org/dsdl/schematron">
<pattern>
<title>Test dates</title>
<rule context="Inventory">
<assert
test="translate(StatusApplicationControl/#Start, '-', '')
> translate(preceding::Inventory[1]/StatusApplicationControl/#End,'-','')"
>The #Start="<value-of
select="StatusApplicationControl/#Start"
/>" and #End="<value-of
select="preceding::Inventory[1]/StatusApplicationControl/#End"
/>" dates are overlaping</assert>
</rule>
</pattern>
</schema>
With this input:
<root>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-18" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="9" />
</InvCounts>
</Inventory>
<Inventory>
<StatusApplicationControl Start="2019-07-18" End="2019-07-19" InvTypeCode="STDX" />
<InvCounts>
<InvCount CountType="2" Count="8" />
</InvCounts>
</Inventory>
</root>
Output:
Pattern 'Test dates' Failed : The #Start="2019-07-18" and #End="2019-07-18" dates are overlaping.
Check in https://www.liquid-technologies.com/online-schematron-validator
Here is the SchemaTron rule that worked for me. The issue was passing preceding:: to the translate() function. When doing that I got a SchemaTron Exception.
<rule context="Inventory/StatusApplicationControl">
<report test="translate(#Start, '-', '') <= preceding::StatusApplicationControl/translate(#End, '-', '') ">The #Start="<value-of select="#Start"/>" and #End="<value-of select="#End"/>" dates are overlaping</report>
</rule>
My current url is: mysite.com/datasheet/100-DE-xmas2016-6
in web.config:
<rule name="myrule">
<match url="^datasheet/([_0-9a-z-]+)-([_0-9a-z-]+)-([_0-9a-z-]+)" />
<action type="Rewrite" url="ajax/datasheet.aspx?shop={R:1}&language={R:2}&product={R:3}" />
</rule>
it will not rewrites to
mysite.com/ajax/datasheet.aspx?shop_id=100&language=DE&product=xmas2016-6
Why???
How to make possible product "xmas2016-6" to work?
The list "mysite.com/datasheet/100-DE-xmas20166" will work. But I really want to use product as "xmas2016-6" (in regular expression set to [_0-9a-z-], but its like ignoring my "-" symbol in product parameter or what?)
This rule will work for you:
<rule name="myrule">
<match url="^datasheet/([_0-9a-z]+)\-([_0-9A-Z]+)\-([_a-z]+[0-9]{4})([0-9]{1})$" />
<action type="Rewrite" url="/ajax/datasheet.aspx?shop={R:1}&language={R:2}&product={R:3}-{R:4}" />
</rule>
Regexp ^datasheet/([_0-9a-z]+)\-([_0-9A-Z]+)\-([_a-z]+[0-9]{4})([0-9]{1})$ is splitting datasheet/100-DE-xmas20166 into four groups:
{R:0} datasheet/100-DE-xmas20166
{R:1} 100
{R:2} DE
{R:3} xmas2016
{R:4} 6
No matter what I have tried, I was unsuccessful in getting the Advanced Find feature of MS CRM 2015 online to show me Active Accounts that are of type Branch that have as their parent have an Account type again of Branch.
I have checked and re-checked the data but perhaps there is something wrong with my query in the Advanced Find feature.
Or there is a bug to it.
I have run this query in SQL as well, we have a BigData db that holds our CRM data and there it reveals the correct results (of course).
Here is my query so that you can see:
--BRANCH OF A BRANCH
select [dbo].[fn_getDescFromCRMguid](a.[Parentaccountid]) as [ParentAccountName],
--[fn_getDescFromCRMguid] udf is just a look-up for descriptions and names
( select left(a3.[etf_accountlevel],6)
from [Stg_CRMAccount] a3
where a3.[accountid] = left(a.[parentaccountid],36)
) as [ParentAccountLevel],
[dbo].[fn_getDescFromCRMguid](isnull(a.[owninguser], a.[owningteam])) as [OwningEntity],
a.*
from [Stg_CRMAccount] a
where a.[statuscode] = 'Active::1'
and a.[etf_accountlevel] like 'Branch%'
and a.[Parentaccountid] is not null
and exists (
select 0
from [Stg_CRMAccount] a2
where a2.[statuscode] = 'Active::1'
and a2.[etf_accountlevel] like 'Branch%'
and left(a.[Parentaccountid],36) = a2.[accountid]
)
order by a.[Parentaccountid],
a.[name],
a.[address1_city];
I am also attaching the screenshot of my Advanced Find query and please feel free to comment or let me know of any useful thoughts.
I hope some person has any idea about this because to me it is puzzling.
I have navigated into the resulting Accounts from this and then into their parent Account and it was not a Branch.
Despite the clear (at least to me) specification of the Where clause under the use of the related Entity - Account, using the relation Parent Account.
The plot thickens even more, if you remove the Account Type = Branch for the related Entity and say change the Status = Active to Inactive then it will very correctly find and show only those Branches where their Parent is Inactive.
That leads me to suspect some kind of a recursive error with the query builder they are using.
It finds Account Type = Branch twice and erroneously does not differentiate between the first occurrence which is for the outer selection and the second occurrence which would be for the nested (in the Where clause) selection.
But all that is mere speculation.
I don't really know why it can't handle it.
It begs the question in what other scenarios it can mess up recursive query builds.
Your thoughts?
and here is my fetch XML from the Advanced Find query
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="account">
<attribute name="etf_rating" />
<attribute name="parentaccountid" />
<attribute name="etf_lastcontact" />
<attribute name="etf_city" />
<attribute name="address1_line1" />
<attribute name="etf_accountlevel" />
<attribute name="name" />
<attribute name="ownerid" />
<attribute name="etf_segment" />
<attribute name="accountid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="etf_accountlevel" operator="eq" value="964850002" />
</filter>
<link-entity name="account" from="parentaccountid" to="accountid" alias="ag">
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="etf_accountlevel" operator="eq" value="964850002" />
</filter>
</link-entity>
</entity>
</fetch>