Skip to content

Commit

Permalink
- release notes and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tkobayas committed Feb 4, 2025
1 parent 428a1e6 commit 8a9bbff
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
[id='language-level_drl-rules']
= Language Level
Language Level is a feature that allows you to specify the version of the DRL (Drools Rule Language) syntax you want to use.
Supported language levels are:
* DRL6 (default)
* DRL10
Some old language levels are deprecated and will be removed in the future:
* DRL5
* DRL6_STRICT
DRL6 is compatible with the previous Drools versions, while DRL10 introduces some changes to reduce ambiguity.
Language Level can be specified by kmodule.xml or system property. Note that the configuration should be effective when rules are built.
.kmodule.xml example
[source,xml]
----
<kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.drools.org/xsd/kmodule">
<configuration>
<property key="drools.lang.level" value="DRL10"/>
</configuration>
</kmodule>
----
.System property example
[source,java]
----
System.setProperty("drools.lang.level", "DRL10");
----
== DRL10
DRL10 has been added, which is handled by the new parser based on ANTLR4. DRL10 introduces the following changes mainly to reduce ambiguity:
* Require a prefix `##` to custom operators
.DRL6
[source]
----
Person(addresses supersetOf $alice.addresses)
----
.DRL10
[source]
----
Person(addresses ##supersetOf $alice.addresses)
----
The custom operator's implementation Java code wouldn't need to be changed.
* Drop half constraint syntax
.DRL6
[source]
----
Person(age > 10 && < 20)
----
.DRL10 (also valid in DRL6)
[source]
----
Person(age > 10 && age < 20)
----
* Drop double ampersand as infix and
.DRL6
[source]
----
( Person(age == 10)
&&
Person(age == 20) )
----
.DRL10 (also valid in DRL6)
[source]
----
( Person(age == 10)
and
Person(age == 20) )
----
`&&` in a constraint will remain supported. For example, `Person(age == 10 && age == 20)` is valid in DRL6 and DRL10.
* Drop double pipe as infix or
.DRL6
[source]
----
( Person(age == 10)
||
Person(age == 20) )
----
.DRL10 (also valid in DRL6)
[source]
----
( Person(age == 10)
or
Person(age == 20) )
----
`||` in a constraint will remain supported. For example, `Person(age == 10 || age == 20)` is valid in DRL6 and DRL10.
* Drop annotation inside LHS pattern
.DRL6
[source]
----
( Double()
or @Annot1 String()
or @Annot2 Integer() )
----
There is no equivalent expression in DRL10.
Annotation in other places will remain supported. For example, `Person(name == "Mario") @watch(*)` is valid in DRL6 and DRL10.
Those syntaxes are deprecated and will be removed in the future. Warnings are logged when the deprecated syntax is used in DRL6.
Warnings are logged when the deprecated syntax is used in DRL6. The warning logs can be suppressed by the log level of `org.drools.drl.parser.lang.ParserHelper`.
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ include::_drl-rules.adoc[leveloffset=+1]
include::_performance-tuning-drl-ref.adoc[leveloffset=+2]
include::_XLSDecisionTable-section.adoc[leveloffset=+1]
include::_language-level.adoc[leveloffset=+1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
== 10.1.0 release notes
=== Language Level DRL10
New language level DRL10 has been added. DRL10 is handled by the new parser based on ANTLR4. The default language level is still DRL6.
DRL10 introduces the following changes mainly to reduce ambiguity:
* Require a prefix '##' to custom operators
* Drop half constraint syntax
* Drop double ampersand as infix and
* Drop double pipe as infix or
* Drop annotation inside LHS pattern
Those syntaxes are deprecated and will be removed in the future. Warnings are logged when the deprecated syntax is used in DRL6.
You can refer xref:language-reference/index.adoc#language-level_drl-rules[Language Level] for details.
2 changes: 2 additions & 0 deletions drools-docs/src/modules/ROOT/pages/release-notes/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ This chapter contains the release notes for the {PRODUCT} 10-series.
For the release notes of the _previous releases_, you can refer to the {PRODUCT} documentation of link:https://docs.drools.org/8.44.0.Final/drools-docs/drools/release-notes/index.html[version 8].
include::_release-notes-10.1.adoc[leveloffset=0]
include::_release-notes-10.0.adoc[leveloffset=0]
== Drools 10-series release notes
Expand Down

0 comments on commit 8a9bbff

Please sign in to comment.