[JBoss JIRA] (DROOLS-1624) Map Handling with Property Reactive Always Enabled
by Mario Fusco (JIRA)
[ https://issues.jboss.org/browse/DROOLS-1624?page=com.atlassian.jira.plugi... ]
Mario Fusco commented on DROOLS-1624:
-------------------------------------
I tried to do what you suggest (see my test case I'm pasting below) but it works for me. Is my use case different from yours? If so what should I change to reproduce the problem?
{code}
@Test
public void testPropertyReactivityOnMap() {
// DROOLS-1624
final String drl =
"import " + Map.class.getCanonicalName() + ";\n" +
"rule R1 when\n" +
" $key : String( )\n" +
" $m : Map( this[$key] == \"Mario\" )\n" +
"then\n" +
" delete($key);\n" +
" modify($m) { put(\"enabled\", \"true\") };\n" +
"end\n" +
"rule R2 when\n" +
" $m : Map( this[\"enabled\"] == \"true\" )\n" +
"then\n" +
" modify($m) { put(\"enabled\", \"false\"), put(\"result\", \"OK\") };\n" +
"end\n";
final KieSession ksession = new KieHelper().addContent(drl, ResourceType.DRL).build().newKieSession();
ksession.insert("name");
Map<String, String> map = new HashMap<>();
map.put("name", "Mario");
FactHandle mapFh = ksession.insert(map);
ksession.fireAllRules();
System.out.println(map);
assertEquals( "OK", map.get("result") );
}
{code}
> Map Handling with Property Reactive Always Enabled
> --------------------------------------------------
>
> Key: DROOLS-1624
> URL: https://issues.jboss.org/browse/DROOLS-1624
> Project: Drools
> Issue Type: Bug
> Components: core engine
> Affects Versions: 7.0.0.Final
> Environment: * JDK8
> * Docker running Alpine
> Reporter: KimJohn Quinn
> Assignee: Mario Fusco
> Priority: Minor
>
> Referencing a conversation on [Google Groups - Drools Usage|https://groups.google.com/forum/?fromgroups#!topic/drools-usage/G7r...] and as requested by Mario Fusco...
> We currently have a ruleset that relies heavily on Map facts. In Drools 6.5 we fire approximately 400 rules.
> In Drools 7.0 we get only about 50 rules unless we add the "<property key="drools.propertySpecific" value="ALLOWED"/>" to the kmodule.xml, in which case we fire the full 400 rules or by using @Watch(*) or @Watch(!*) on the rules. It "seems" like only the first evaluations of the rules are firing and then no others after that.
> Our flow generally follows something like below, within a stateful session, using rules only. We fire all rules per-request then close the session.
> Watch for changes to the Map properties
> If a certain property or properties exist a 'populate' rule fires (calls modify())
> The populate rule enriches the map fact. (calls modify())
> Based on #3, more rules fire when certain properties exist (calls modify())
> We are work heavily with rules that depend on loaded available facts up-front and computed properties throughout evaluation.
> I have a couple of usage questions regarding Drools 7, the default enabling of Property Reactive and using Maps as the facts:
> In general, how do maps work with property reactive and respond to modify/insert events? Does Drools look at the Map as a whole, any change re-evaluates the tree, or each individual property within the map re-evaluates the change?
> In Drools 7, by defaulting the property reactive setting, does that mean all rules need to be annotated or they should they work as is (dao or map-based facts) when using modify/insert?
> For reference, we are relying on this doco https://docs.jboss.org/drools/release/7.0.0.Final/drools-docs/html_single....
> I am looking into details or an example how to properly use Maps in Drools 7 with Property Reactive features always enabled (as suggested per the doco)....
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years
[JBoss JIRA] (DROOLS-1622) NPE when compiling DMN file from test DMNRuntimeTest.testNoPrefix on IBM JDK
by Matteo Mortari (JIRA)
[ https://issues.jboss.org/browse/DROOLS-1622?page=com.atlassian.jira.plugi... ]
Matteo Mortari edited comment on DROOLS-1622 at 6/21/17 5:45 AM:
-----------------------------------------------------------------
Some investigation results.
This is about {{com.thoughtworks.xstream.io.xml.StaxReader}}
method {{public String getAttribute(final String name)}}.
When called with openjdk, this calls {{com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl}}
which respects the javadoc specs, in the case the "namespace" parameter is passed as null:
{code:java}
String javax.xml.stream.XMLStreamReader.getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality
Parameters:
namespaceURI the namespace of the attribute
localName the local name of the attribute, cannot be null
{code}
while on IBM JDK it calls {{com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy}} which in turns calls
{code:java}
String com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getAttributeValue(String s, String s2)
{code}
which in turn calling
{code:java}
/* */ public XMLString getAttributeValue(final int n, final int n2) {
/* */
/* 1817 */ if (((SimpleScannerHelper)this).fIsNamespaceAware) {
/* 1818 */ for (int i = 0; i < ((SimpleScannerHelper)this).fAttributeCount; ++i) {
/* 1819 */ final com.ibm.xml.xlxp.scan.util.QName attributeName = this.attributeName(i);
/* 1820 */ if (n2 == attributeName.localHandle && n == attributeName.nsHandle) {
/* 1821 */ return this.normalizedAttributeValue(i);
/* */ }
/* */ }
/* */ }
/* */ else {
/* 1826 */ for (int j = 0; j < ((SimpleScannerHelper)this).fAttributeCount; ++j) {
/* */
/* 1828 */ if (n2 == this.attributeName(j).handle) {
/* 1829 */ return this.normalizedAttributeValue(j);
/* */ }
/* */ }
/* */ }
/* 1833 */ return null;
/* */ }
{code}
and we can see line 1820 it *forcibly* check the namespace for the attribute corresponds, in this case null = 0, so it check the attribute namespace is null.
This is not compliant with the Java JDK javadoc specs.
was (Author: tari_manga):
Some investigation results.
This is about {{com.thoughtworks.xstream.io.xml.StaxReader}}
method {{public String getAttribute(final String name)}}.
When called with openjdk, this calls {{com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl}}
which respects the javadoc specs:
{code:java}
String javax.xml.stream.XMLStreamReader.getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality
Parameters:
namespaceURI the namespace of the attribute
localName the local name of the attribute, cannot be null
{code}
while on IBM JDK it calls {{com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy}} which in turns calls
{code:java}
String com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getAttributeValue(String s, String s2)
{code}
which in turn calling
{code:java}
/* */ public XMLString getAttributeValue(final int n, final int n2) {
/* */
/* 1817 */ if (((SimpleScannerHelper)this).fIsNamespaceAware) {
/* 1818 */ for (int i = 0; i < ((SimpleScannerHelper)this).fAttributeCount; ++i) {
/* 1819 */ final com.ibm.xml.xlxp.scan.util.QName attributeName = this.attributeName(i);
/* 1820 */ if (n2 == attributeName.localHandle && n == attributeName.nsHandle) {
/* 1821 */ return this.normalizedAttributeValue(i);
/* */ }
/* */ }
/* */ }
/* */ else {
/* 1826 */ for (int j = 0; j < ((SimpleScannerHelper)this).fAttributeCount; ++j) {
/* */
/* 1828 */ if (n2 == this.attributeName(j).handle) {
/* 1829 */ return this.normalizedAttributeValue(j);
/* */ }
/* */ }
/* */ }
/* 1833 */ return null;
/* */ }
{code}
and we can see line 1820 it *forcibly* check the namespace for the attribute corresponds, in this case null = 0, so it check the attribute namespace is null.
This is not compliant with the Java JDK javadoc specs.
> NPE when compiling DMN file from test DMNRuntimeTest.testNoPrefix on IBM JDK
> ----------------------------------------------------------------------------
>
> Key: DROOLS-1622
> URL: https://issues.jboss.org/browse/DROOLS-1622
> Project: Drools
> Issue Type: Bug
> Components: dmn engine
> Affects Versions: 7.0.0.Final
> Reporter: Tibor Zimányi
> Assignee: Matteo Mortari
> Labels: reported-by-qe
> Fix For: 7.1.0.Final
>
>
> When running test [1] on IBM JDK, the test fails with this output [2].
> [1] https://github.com/kiegroup/drools/blob/32822e243a237cf26f26830a895035b97...
> [2] https://gist.github.com/baldimir/969bd8f72665ff0e4244350abaed1ef4
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years
[JBoss JIRA] (DROOLS-1622) NPE when compiling DMN file from test DMNRuntimeTest.testNoPrefix on IBM JDK
by Matteo Mortari (JIRA)
[ https://issues.jboss.org/browse/DROOLS-1622?page=com.atlassian.jira.plugi... ]
Matteo Mortari commented on DROOLS-1622:
----------------------------------------
Some investigation results.
This is about {{com.thoughtworks.xstream.io.xml.StaxReader}}
method {{public String getAttribute(final String name)}}.
When called with openjdk, this calls {{com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl}}
which respects the javadoc specs:
{code:java}
String javax.xml.stream.XMLStreamReader.getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality
Parameters:
namespaceURI the namespace of the attribute
localName the local name of the attribute, cannot be null
{code}
while on IBM JDK it calls {{com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy}} which in turns calls
{code:java}
String com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getAttributeValue(String s, String s2)
{code}
which in turn calling
{code:java}
/* */ public XMLString getAttributeValue(final int n, final int n2) {
/* */
/* 1817 */ if (((SimpleScannerHelper)this).fIsNamespaceAware) {
/* 1818 */ for (int i = 0; i < ((SimpleScannerHelper)this).fAttributeCount; ++i) {
/* 1819 */ final com.ibm.xml.xlxp.scan.util.QName attributeName = this.attributeName(i);
/* 1820 */ if (n2 == attributeName.localHandle && n == attributeName.nsHandle) {
/* 1821 */ return this.normalizedAttributeValue(i);
/* */ }
/* */ }
/* */ }
/* */ else {
/* 1826 */ for (int j = 0; j < ((SimpleScannerHelper)this).fAttributeCount; ++j) {
/* */
/* 1828 */ if (n2 == this.attributeName(j).handle) {
/* 1829 */ return this.normalizedAttributeValue(j);
/* */ }
/* */ }
/* */ }
/* 1833 */ return null;
/* */ }
{code}
and we can see it *forcibly* check the namespace for the attribute corresponds, in this case null = 0, so it check the attribute namespace is null.
This is not compliant with the Java JDK javadoc specs.
> NPE when compiling DMN file from test DMNRuntimeTest.testNoPrefix on IBM JDK
> ----------------------------------------------------------------------------
>
> Key: DROOLS-1622
> URL: https://issues.jboss.org/browse/DROOLS-1622
> Project: Drools
> Issue Type: Bug
> Components: dmn engine
> Affects Versions: 7.0.0.Final
> Reporter: Tibor Zimányi
> Assignee: Matteo Mortari
> Labels: reported-by-qe
> Fix For: 7.1.0.Final
>
>
> When running test [1] on IBM JDK, the test fails with this output [2].
> [1] https://github.com/kiegroup/drools/blob/32822e243a237cf26f26830a895035b97...
> [2] https://gist.github.com/baldimir/969bd8f72665ff0e4244350abaed1ef4
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years
[JBoss JIRA] (DROOLS-1622) NPE when compiling DMN file from test DMNRuntimeTest.testNoPrefix on IBM JDK
by Matteo Mortari (JIRA)
[ https://issues.jboss.org/browse/DROOLS-1622?page=com.atlassian.jira.plugi... ]
Matteo Mortari edited comment on DROOLS-1622 at 6/21/17 5:44 AM:
-----------------------------------------------------------------
Some investigation results.
This is about {{com.thoughtworks.xstream.io.xml.StaxReader}}
method {{public String getAttribute(final String name)}}.
When called with openjdk, this calls {{com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl}}
which respects the javadoc specs:
{code:java}
String javax.xml.stream.XMLStreamReader.getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality
Parameters:
namespaceURI the namespace of the attribute
localName the local name of the attribute, cannot be null
{code}
while on IBM JDK it calls {{com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy}} which in turns calls
{code:java}
String com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getAttributeValue(String s, String s2)
{code}
which in turn calling
{code:java}
/* */ public XMLString getAttributeValue(final int n, final int n2) {
/* */
/* 1817 */ if (((SimpleScannerHelper)this).fIsNamespaceAware) {
/* 1818 */ for (int i = 0; i < ((SimpleScannerHelper)this).fAttributeCount; ++i) {
/* 1819 */ final com.ibm.xml.xlxp.scan.util.QName attributeName = this.attributeName(i);
/* 1820 */ if (n2 == attributeName.localHandle && n == attributeName.nsHandle) {
/* 1821 */ return this.normalizedAttributeValue(i);
/* */ }
/* */ }
/* */ }
/* */ else {
/* 1826 */ for (int j = 0; j < ((SimpleScannerHelper)this).fAttributeCount; ++j) {
/* */
/* 1828 */ if (n2 == this.attributeName(j).handle) {
/* 1829 */ return this.normalizedAttributeValue(j);
/* */ }
/* */ }
/* */ }
/* 1833 */ return null;
/* */ }
{code}
and we can see line 1820 it *forcibly* check the namespace for the attribute corresponds, in this case null = 0, so it check the attribute namespace is null.
This is not compliant with the Java JDK javadoc specs.
was (Author: tari_manga):
Some investigation results.
This is about {{com.thoughtworks.xstream.io.xml.StaxReader}}
method {{public String getAttribute(final String name)}}.
When called with openjdk, this calls {{com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl}}
which respects the javadoc specs:
{code:java}
String javax.xml.stream.XMLStreamReader.getAttributeValue(String namespaceURI, String localName)
Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality
Parameters:
namespaceURI the namespace of the attribute
localName the local name of the attribute, cannot be null
{code}
while on IBM JDK it calls {{com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy}} which in turns calls
{code:java}
String com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getAttributeValue(String s, String s2)
{code}
which in turn calling
{code:java}
/* */ public XMLString getAttributeValue(final int n, final int n2) {
/* */
/* 1817 */ if (((SimpleScannerHelper)this).fIsNamespaceAware) {
/* 1818 */ for (int i = 0; i < ((SimpleScannerHelper)this).fAttributeCount; ++i) {
/* 1819 */ final com.ibm.xml.xlxp.scan.util.QName attributeName = this.attributeName(i);
/* 1820 */ if (n2 == attributeName.localHandle && n == attributeName.nsHandle) {
/* 1821 */ return this.normalizedAttributeValue(i);
/* */ }
/* */ }
/* */ }
/* */ else {
/* 1826 */ for (int j = 0; j < ((SimpleScannerHelper)this).fAttributeCount; ++j) {
/* */
/* 1828 */ if (n2 == this.attributeName(j).handle) {
/* 1829 */ return this.normalizedAttributeValue(j);
/* */ }
/* */ }
/* */ }
/* 1833 */ return null;
/* */ }
{code}
and we can see it *forcibly* check the namespace for the attribute corresponds, in this case null = 0, so it check the attribute namespace is null.
This is not compliant with the Java JDK javadoc specs.
> NPE when compiling DMN file from test DMNRuntimeTest.testNoPrefix on IBM JDK
> ----------------------------------------------------------------------------
>
> Key: DROOLS-1622
> URL: https://issues.jboss.org/browse/DROOLS-1622
> Project: Drools
> Issue Type: Bug
> Components: dmn engine
> Affects Versions: 7.0.0.Final
> Reporter: Tibor Zimányi
> Assignee: Matteo Mortari
> Labels: reported-by-qe
> Fix For: 7.1.0.Final
>
>
> When running test [1] on IBM JDK, the test fails with this output [2].
> [1] https://github.com/kiegroup/drools/blob/32822e243a237cf26f26830a895035b97...
> [2] https://gist.github.com/baldimir/969bd8f72665ff0e4244350abaed1ef4
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years