Skip to content

Commit

Permalink
Changes done for v1.1.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad-Nouri1 committed Mar 5, 2024
1 parent dbd3755 commit 5b19d8c
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 53 deletions.
40 changes: 0 additions & 40 deletions Makefile

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 7 additions & 0 deletions CHANGELOG.md → com.ibm.streamsx.eval_predicate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions info.xml → com.ibm.streamsx.eval_predicate/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<info:toolkitInfoModel xmlns:common="http://www.ibm.com/xmlns/prod/streams/spl/common"
xmlns:info="http://www.ibm.com/xmlns/prod/streams/spl/toolkitInfo">
<info:identity>
<info:name>eval_predicate</info:name>
<info:name>com.ibm.streamsx.eval_predicate</info:name>
<info:description>Toolkit for user defined rule (expression) processing</info:description>
<info:version>1.1.8</info:version>
<info:version>1.1.9</info:version>
<info:requiredProductVersion>4.2.1.6</info:requiredProductVersion>
</info:identity>
<info:dependencies/>
Expand Down
39 changes: 39 additions & 0 deletions samples/01_eval_predicate_example/Makefile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 15 additions & 0 deletions samples/01_eval_predicate_example/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<info:toolkitInfoModel xmlns:common="http://www.ibm.com/xmlns/prod/streams/spl/common" xmlns:info="http://www.ibm.com/xmlns/prod/streams/spl/toolkitInfo">
<info:identity>
<info:name>01_eval_predicate_example</info:name>
<info:description>Simple example that showcases the major eval_predicate features.</info:description>
<info:version>1.1.9</info:version>
<info:requiredProductVersion>4.2.0.0</info:requiredProductVersion>
</info:identity>
<info:dependencies>
<info:toolkit>
<common:name>com.ibm.streamsx.eval_predicate</common:name>
<common:version>[1.1.9,9.0.0)</common:version>
</info:toolkit>
</info:dependencies>
</info:toolkitInfoModel>
39 changes: 39 additions & 0 deletions samples/02_eval_predicate_functional_tests/Makefile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -9574,4 +9578,4 @@ composite FunctionalTests {
} // End of onTuple MTD.
} // End of the HappyPathSink operator.
} // End of main composite.


15 changes: 15 additions & 0 deletions samples/02_eval_predicate_functional_tests/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<info:toolkitInfoModel xmlns:common="http://www.ibm.com/xmlns/prod/streams/spl/common" xmlns:info="http://www.ibm.com/xmlns/prod/streams/spl/toolkitInfo">
<info:identity>
<info:name>02_eval_predicate_functional_tests</info:name>
<info:description>Comprehensive example that showcases all the eval_predicate features.</info:description>
<info:version>1.1.9</info:version>
<info:requiredProductVersion>4.2.0.0</info:requiredProductVersion>
</info:identity>
<info:dependencies>
<info:toolkit>
<common:name>com.ibm.streamsx.eval_predicate</common:name>
<common:version>[1.1.9,9.0.0)</common:version>
</info:toolkit>
</info:dependencies>
</info:toolkitInfoModel>

0 comments on commit 5b19d8c

Please sign in to comment.