-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
146 changes: 146 additions & 0 deletions
146
drools-docs/src/modules/ROOT/pages/language-reference/_language-level.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
drools-docs/src/modules/ROOT/pages/release-notes/_release-notes-10.1.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters