From 5b19d8c6ebe215eae2f0531b0139de35cd518186 Mon Sep 17 00:00:00 2001 From: Ahmad-Nouri1 Date: Tue, 5 Mar 2024 07:40:56 -0800 Subject: [PATCH] Changes done for v1.1.9. --- Makefile | 40 ------------------- README.md | 8 ++-- .../CHANGELOG.md | 7 ++++ .../native.function/function.xml | 0 .../impl}/include/eval_predicate.h | 0 .../info.xml | 4 +- samples/01_eval_predicate_example/Makefile | 39 ++++++++++++++++++ .../EvalPredicateExample.spl | 10 +++-- samples/01_eval_predicate_example/info.xml | 15 +++++++ .../Makefile | 39 ++++++++++++++++++ .../FunctionalTests.spl | 12 ++++-- .../info.xml | 15 +++++++ 12 files changed, 136 insertions(+), 53 deletions(-) delete mode 100644 Makefile rename CHANGELOG.md => com.ibm.streamsx.eval_predicate/CHANGELOG.md (80%) rename com.ibm.streamsx.eval_predicate/{ => com.ibm.streamsx.eval_predicate}/native.function/function.xml (100%) rename {impl => com.ibm.streamsx.eval_predicate/impl}/include/eval_predicate.h (100%) rename info.xml => com.ibm.streamsx.eval_predicate/info.xml (82%) create mode 100644 samples/01_eval_predicate_example/Makefile rename {com.ibm.streamsx.eval_predicate => samples/01_eval_predicate_example/com.ibm.streamsx.eval_predicate.test}/EvalPredicateExample.spl (99%) create mode 100644 samples/01_eval_predicate_example/info.xml create mode 100644 samples/02_eval_predicate_functional_tests/Makefile rename {com.ibm.streamsx.eval_predicate => samples/02_eval_predicate_functional_tests/com.ibm.streamsx.eval_predicate.test}/FunctionalTests.spl (99%) create mode 100644 samples/02_eval_predicate_functional_tests/info.xml diff --git a/Makefile b/Makefile deleted file mode 100644 index 1ddc6fc..0000000 --- a/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C)2020, 2021 International Business Machines Corporation and -# others. All Rights Reserved. -.PHONY: build all distributed clean - -ifeq ($(STREAMS_STUDIO_BUILDING), 1) - $(info Building from Streams Studio, use env vars set by studio) - SPLC = $(STREAMS_STUDIO_SC_PATH) - DATA_DIR = $(STREAMS_STUDIO_DATA_DIRECTORY) - OUTPUT_DIR = $(STREAMS_STUDIO_OUTPUT_DIRECTORY) - TOOLKIT_PATH = $(STREAMS_STUDIO_SPL_PATH) -else - $(info build use env settings) - ifndef STREAMS_INSTALL - $(error require streams environment STREAMS_INSTALL) - endif - SPLC = $(STREAMS_INSTALL)/bin/sc - DATA_DIR = data - OUTPUT_DIR1 = output/com.ibm.streamsx.eval_predicate.EvalPredicateExample/BuildConfig - OUTPUT_DIR2 = output/com.ibm.streamsx.eval_predicate.FunctionalTests/BuildConfig - TOOLKIT_PATH = -endif - -SPL_MAIN_COMPOSITE1 = com.ibm.streamsx.eval_predicate::EvalPredicateExample -SPL_MAIN_COMPOSITE2 = com.ibm.streamsx.eval_predicate::FunctionalTests -SPLC_FLAGS = -a -SPL_CMD_ARGS ?= - -build: distributed - -all: clean build - -distributed: - $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE1) --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR1) $(SPL_CMD_ARGS) - $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE2) --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR2) $(SPL_CMD_ARGS) - -clean: - $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE1) --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR1) -C $(SPL_CMD_ARGS) - $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE2) --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR2) -C $(SPL_CMD_ARGS) - - rm -rf output diff --git a/README.md b/README.md index 3d60888..1be5792 100644 --- a/README.md +++ b/README.md @@ -285,16 +285,16 @@ This toolkit came into existence for a specific need with which a large enterpri (Value.Status.Event equalsCI 'PATCHING') && ((Value.Status.UserName containsCI 'EWR') || (Value.Status.EntityState equalsCI 'ENGINEERING') || ((Value.Properties.OwnedBy containsCI 'FER') && ((Value.Status.Availability equalsCI 'Up') || ((Value.Status.Availability equalsCI 'Down') && (Value.Status.StatusCategory3 containsCI 'StatusCategory3'))))) && (Value.Status.StatusCategory4 equalsCI 'StatusCategory4') ## Source code -The complete C++ logic for the **eval_predicate** function is available in the [eval_predicate.h](impl/include/eval_predicate.h) file of this repository. +The complete C++ logic for the **eval_predicate** function is available in the [eval_predicate.h](com.ibm.streamsx.eval_predicate/impl/include/eval_predicate.h) file of this repository. ## Example applications -There is a well documented and well tested example application available in the [EvalPredicateExample.spl](com.ibm.streamsx.eval_predicate/EvalPredicateExample.spl) file of this repository. Users can browse that example code, compile and run it to become familiar with the usage of the **eval_predicate** function. There is also [FunctionalTests.spl](com.ibm.streamsx.eval_predicate/FunctionalTests.spl) which is a comprehensive application that tests the major code paths in the **eval_predicate** function. +There is a well documented and well tested example application available in the [EvalPredicateExample.spl](samples/01_eval_predicate_example/com.ibm.streamsx.eval_predicate.test/EvalPredicateExample.spl) file of this repository. Users can browse that example code, compile and run it to become familiar with the usage of the **eval_predicate** function. There is also [FunctionalTests.spl](samples/02_eval_predicate_functional_tests/com.ibm.streamsx.eval_predicate.test/FunctionalTests.spl) which is a comprehensive application that tests the major code paths in the **eval_predicate** function. -At the top-level of this toolkit directory, a *Makefile* can be found. To build the two example applications mentioned above, one can type `make` from a Linux terminal window by being in that top-level directory. Alternatively, the extracted toolkit directory can also be imported into IBM Streams Studio or Microsoft Visual Studio Code. Before importing, it is a must to rename that Makefile in that top-level directory to *Makefile.org*. Only with that renaming of the Makefile, the example applications will build correctly after importing the toolkit into the Studio development environment. +A *Makefile* can be found in each of the example applications mentioned above. One can type `make` from a Linux terminal window by being inside the specific example directory. Alternatively, the extracted toolkit directory and the individual example directories can also be imported into IBM Streams Studio or Microsoft Visual Studio Code. Before importing, it is a must to rename that Makefile in that example directory to *Makefile.org*. Only with that renaming of the Makefile, the example applications will build correctly after importing the toolkit into the Studio development environment. ## Getting an official version of this toolkit One can clone this repository as needed for making code changes. But, for users who only want to use this toolkit in their applications, it is better to download an official version of this toolkit that has a release tag. In the right hand side column of this web page, you will see the *Releases* section. There, you can click on the *Latest* button and then download the tar.gz file which can be extracted for ready use as a dependency in your IBM Streams application project. ## WHATS NEW -see: [CHANGELOG.md](CHANGELOG.md) +see: [CHANGELOG.md](com.ibm.streamsx.eval_predicate/CHANGELOG.md) diff --git a/CHANGELOG.md b/com.ibm.streamsx.eval_predicate/CHANGELOG.md similarity index 80% rename from CHANGELOG.md rename to com.ibm.streamsx.eval_predicate/CHANGELOG.md index a5b68bc..eb93067 100644 --- a/CHANGELOG.md +++ b/com.ibm.streamsx.eval_predicate/CHANGELOG.md @@ -1,5 +1,12 @@ # Changes +## v1.1.9 +* Mar/05/2024 +* Rearranged this toolkit's directory to have a top-level directory that in turn contains two subdirectories i.e. com.ibm.streamsx.eval_predicate subdirectory containing the main C++ code for this toolkit and the samples subdirectory containing two comprehensive examples showcasing the eval_predicate features. +* Both the EvalPredicateExample and FunctionalTests applications are now placed in their own subirectories within the samples directory in a new namespace com.ibm.streamsx.eval_predicate.test. +* Other than the above-mentioned directory and file restructuring, there are no functional changes done in this release. +* User applications that want to use this toolkit will have to now have this statement at the top of their SPL file(s): use com.ibm.streamsx.eval_predicate::*; + ## v1.1.8 * Oct/11/2023 * Made a fix to correctly evaluate new multi-level nested expression patterns as shown in the test cases A51.22 to A51.24 in FunctionalTests.spl. diff --git a/com.ibm.streamsx.eval_predicate/native.function/function.xml b/com.ibm.streamsx.eval_predicate/com.ibm.streamsx.eval_predicate/native.function/function.xml similarity index 100% rename from com.ibm.streamsx.eval_predicate/native.function/function.xml rename to com.ibm.streamsx.eval_predicate/com.ibm.streamsx.eval_predicate/native.function/function.xml diff --git a/impl/include/eval_predicate.h b/com.ibm.streamsx.eval_predicate/impl/include/eval_predicate.h similarity index 100% rename from impl/include/eval_predicate.h rename to com.ibm.streamsx.eval_predicate/impl/include/eval_predicate.h diff --git a/info.xml b/com.ibm.streamsx.eval_predicate/info.xml similarity index 82% rename from info.xml rename to com.ibm.streamsx.eval_predicate/info.xml index 442fbc3..cd66c13 100644 --- a/info.xml +++ b/com.ibm.streamsx.eval_predicate/info.xml @@ -2,9 +2,9 @@ - eval_predicate + com.ibm.streamsx.eval_predicate Toolkit for user defined rule (expression) processing - 1.1.8 + 1.1.9 4.2.1.6 diff --git a/samples/01_eval_predicate_example/Makefile b/samples/01_eval_predicate_example/Makefile new file mode 100644 index 0000000..346ad68 --- /dev/null +++ b/samples/01_eval_predicate_example/Makefile @@ -0,0 +1,39 @@ +# Copyright (C)2020, 2024 International Business Machines Corporation and +# others. All Rights Reserved. +.PHONY: build all distributed clean + +# Please point this to your correct eval_predicate toolkit location. +STREAMS_EVAL_PREDICATE_TOOLKIT ?= $(PWD)/../../com.ibm.streamsx.eval_predicate + +ifeq ($(STREAMS_STUDIO_BUILDING), 1) + $(info Building from Streams Studio, use env vars set by studio) + SPLC = $(STREAMS_STUDIO_SC_PATH) + DATA_DIR = $(STREAMS_STUDIO_DATA_DIRECTORY) + OUTPUT_DIR = $(STREAMS_STUDIO_OUTPUT_DIRECTORY) + TOOLKIT_PATH = $(STREAMS_STUDIO_SPL_PATH) +else + $(info build use env settings) + ifndef STREAMS_INSTALL + $(error require streams environment STREAMS_INSTALL) + endif + SPLC = $(STREAMS_INSTALL)/bin/sc + DATA_DIR = data + OUTPUT_DIR = output/com.ibm.streamsx.eval_predicate.test.EvalPredicateExample/BuildConfig + TOOLKIT_PATH = $(STREAMS_EVAL_PREDICATE_TOOLKIT) +endif + +SPL_MAIN_COMPOSITE = com.ibm.streamsx.eval_predicate.test::EvalPredicateExample +SPLC_FLAGS = -a +SPL_CMD_ARGS ?= + +build: distributed + +all: clean build + +distributed: + $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) -t ${TOOLKIT_PATH} --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR) $(SPL_CMD_ARGS) + +clean: + $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) -t ${TOOLKIT_PATH} --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR) -C $(SPL_CMD_ARGS) + + rm -rf output diff --git a/com.ibm.streamsx.eval_predicate/EvalPredicateExample.spl b/samples/01_eval_predicate_example/com.ibm.streamsx.eval_predicate.test/EvalPredicateExample.spl similarity index 99% rename from com.ibm.streamsx.eval_predicate/EvalPredicateExample.spl rename to samples/01_eval_predicate_example/com.ibm.streamsx.eval_predicate.test/EvalPredicateExample.spl index e206e99..d76a18d 100644 --- a/com.ibm.streamsx.eval_predicate/EvalPredicateExample.spl +++ b/samples/01_eval_predicate_example/com.ibm.streamsx.eval_predicate.test/EvalPredicateExample.spl @@ -1,14 +1,14 @@ /* ============================================== # Licensed Materials - Property of IBM -# Copyright IBM Corp. 2021, 2023 +# Copyright IBM Corp. 2021, 2024 ============================================== */ /* ================================================================== First created on: Mar/05/2021 -Last modified on: Sep/20/2023 +Last modified on: Mar/05/2024 This is an example application that shows how to use the eval_predicate function to evaluate an SPL expression a.k.a @@ -142,7 +142,11 @@ importing the toolkit into the Studio development environment. ================================================================== */ // eval_predicate function is available from this namespace. -namespace com.ibm.streamsx.eval_predicate; +namespace com.ibm.streamsx.eval_predicate.test; + +// We have to declare the use of this namespace from where we will get the +// eval_predicate native functions that are called from this application. +use com.ibm.streamsx.eval_predicate::*; // This is the main composite for this application. composite EvalPredicateExample { diff --git a/samples/01_eval_predicate_example/info.xml b/samples/01_eval_predicate_example/info.xml new file mode 100644 index 0000000..bc1168a --- /dev/null +++ b/samples/01_eval_predicate_example/info.xml @@ -0,0 +1,15 @@ + + + + 01_eval_predicate_example + Simple example that showcases the major eval_predicate features. + 1.1.9 + 4.2.0.0 + + + + com.ibm.streamsx.eval_predicate + [1.1.9,9.0.0) + + + diff --git a/samples/02_eval_predicate_functional_tests/Makefile b/samples/02_eval_predicate_functional_tests/Makefile new file mode 100644 index 0000000..ab9274b --- /dev/null +++ b/samples/02_eval_predicate_functional_tests/Makefile @@ -0,0 +1,39 @@ +# Copyright (C)2020, 2024 International Business Machines Corporation and +# others. All Rights Reserved. +.PHONY: build all distributed clean + +# Please point this to your correct eval_predicate toolkit location. +STREAMS_EVAL_PREDICATE_TOOLKIT ?= $(PWD)/../../com.ibm.streamsx.eval_predicate + +ifeq ($(STREAMS_STUDIO_BUILDING), 1) + $(info Building from Streams Studio, use env vars set by studio) + SPLC = $(STREAMS_STUDIO_SC_PATH) + DATA_DIR = $(STREAMS_STUDIO_DATA_DIRECTORY) + OUTPUT_DIR = $(STREAMS_STUDIO_OUTPUT_DIRECTORY) + TOOLKIT_PATH = $(STREAMS_STUDIO_SPL_PATH) +else + $(info build use env settings) + ifndef STREAMS_INSTALL + $(error require streams environment STREAMS_INSTALL) + endif + SPLC = $(STREAMS_INSTALL)/bin/sc + DATA_DIR = data + OUTPUT_DIR = output/com.ibm.streamsx.eval_predicate.test.FunctionalTests/BuildConfig + TOOLKIT_PATH = $(STREAMS_EVAL_PREDICATE_TOOLKIT) +endif + +SPL_MAIN_COMPOSITE = com.ibm.streamsx.eval_predicate.test::FunctionalTests +SPLC_FLAGS = -a +SPL_CMD_ARGS ?= + +build: distributed + +all: clean build + +distributed: + $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) -t ${TOOLKIT_PATH} --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR) $(SPL_CMD_ARGS) + +clean: + $(SPLC) $(SPLC_FLAGS) -M $(SPL_MAIN_COMPOSITE) -t ${TOOLKIT_PATH} --data-dir $(DATA_DIR) --output-dir $(OUTPUT_DIR) -C $(SPL_CMD_ARGS) + + rm -rf output diff --git a/com.ibm.streamsx.eval_predicate/FunctionalTests.spl b/samples/02_eval_predicate_functional_tests/com.ibm.streamsx.eval_predicate.test/FunctionalTests.spl similarity index 99% rename from com.ibm.streamsx.eval_predicate/FunctionalTests.spl rename to samples/02_eval_predicate_functional_tests/com.ibm.streamsx.eval_predicate.test/FunctionalTests.spl index 7b4cc15..5ce09a6 100644 --- a/com.ibm.streamsx.eval_predicate/FunctionalTests.spl +++ b/samples/02_eval_predicate_functional_tests/com.ibm.streamsx.eval_predicate.test/FunctionalTests.spl @@ -1,14 +1,14 @@ /* ============================================== # Licensed Materials - Property of IBM -# Copyright IBM Corp. 2021, 2023 +# Copyright IBM Corp. 2021, 2024 ============================================== */ /* ================================================================== First created on: Mar/28/2021 -Last modified on: Oct/11/2023 +Last modified on: Mar/05/2024 This application is meant for doing several hundred functional tests to provide as much coverage as possible to @@ -68,7 +68,11 @@ the Makefile, the example application will build correctly after importing the toolkit into the Studio development environment. ================================================================== */ -namespace com.ibm.streamsx.eval_predicate; +namespace com.ibm.streamsx.eval_predicate.test; + +// We have to declare the use of this namespace from where we will get the +// eval_predicate native functions that are called from this application. +use com.ibm.streamsx.eval_predicate::*; // This is the main composite for this application. composite FunctionalTests { @@ -9574,4 +9578,4 @@ composite FunctionalTests { } // End of onTuple MTD. } // End of the HappyPathSink operator. } // End of main composite. - \ No newline at end of file + diff --git a/samples/02_eval_predicate_functional_tests/info.xml b/samples/02_eval_predicate_functional_tests/info.xml new file mode 100644 index 0000000..9b54f76 --- /dev/null +++ b/samples/02_eval_predicate_functional_tests/info.xml @@ -0,0 +1,15 @@ + + + + 02_eval_predicate_functional_tests + Comprehensive example that showcases all the eval_predicate features. + 1.1.9 + 4.2.0.0 + + + + com.ibm.streamsx.eval_predicate + [1.1.9,9.0.0) + + +