wso2cep : Error - 'within' is neither a function extension nor an aggregated attribute extension in execution plan "ExecutionPlan11" - wso2-cep

I am using WSO2 CEP 4.1.0 version for real time event processing and I am writing a execution plan for checking whether my inputted geocoordinates are within a polygon. But getting an error : 'within' is neither a function extension nor an aggregated attribute extension in execution plan "ExecutionPlan11"
My execution plan is below and please help me in solving this error.
/* Enter a unique ExecutionPlan */
#Plan:name('ExecutionPlan11')
#Import('NewInputStream:1.0.0')
define stream instream (meta_sourceId string, meta_engOilTemp float, meta_engFuelRate float, meta_acceleratorPedalPos float, meta_engSpeed float, meta_barometricPressure float, meta_receivedTime long, meta_latitude double, meta_longitude double);
#Export('NewOutputStream:1.0.0')
define stream outstream (meta_sourceId string, meta_alarmName string, meta_alarmMessage string, meta_alarmAttribute string, meta_data string, meta_unit string, meta_pointId string, meta_pointName string, meta_deviceId string, meta_receivedTime long);
from instream[geo:within(meta_latitude, meta_longitude,"{'type':'Polygon','coordinates':[[[12.52,77.32],[12.89,77.69],[13.011,77.686],[13.058,77.555],[12.9284,77.4421]]]}" == false)]
select meta_sourceId, "Geofencing Alarm" as meta_alarmName, "Out of geo range" as meta_alarmMessage, "geofence" as meta_alarmAttribute,
"NA" as meta_data, "NA" as meta_unit, "Latitude" as meta_pointId, "longitude" as meta_pointName,
"D1" as meta_deviceId, meta_receivedTime
insert into outstream;

I guess you have not installed gpl features.Above geo functions does not come in the default CEP pack.To use geo functions you need to install corresponding gpl features.Please follow link to install said features.(GPL - Siddhi Geo Extension)

Related

how to map a message likes "09Mar21 15:58:54.286667" to a timestamp field in filebeat?

I want to map a message likes "09Mar21 15:58:54.286667" to a timestamp field in filebeat
but I don't know how to do ?
1 My current filebeat is filebeat-7.10.0-windows-x86_64, how to do it?
2 from https://www.elastic.co/guide/en/beats/filebeat/current/processor-timestamp.html
the layout is supported in 8.0 , is it necessary to upgrade to 8.0 ?
how to define the layout in 8.0 to map the format likes "09Mar21 15:58:54.286667"
Thanks a lot !
TLDR;
You can use the following pattern:
02Jan06 15:04:05.000000
To understand
All the *beats (metricbeat, filebeat, ...) family is written in Golang.
So you will need to provide a pattern specific to Golang to parse this date string.
Golang offer a somewhat surprising way to handle date/time format.
It is based on a specific date, (The 2nd of January 2006 at 3:05:05 PM).
You are to use this reference time an put it to you desired format.
In your specific case
-> 02Jan06 15:04:05.000000
You can try it out with the following snippet
package main
import ("fmt"
"time")
func main() {
var t = "09Mar21 15:58:54.286667"
var t2, err = time.Parse("02Jan06 15:04:05.000000", t)
fmt.Println(t, t2, err)
}

Can't set types of fields when creating indexes

I am using Elasticsearch 7.6.2 (by running the official docker image with the default options) and py-elasticsearch 7.6.0 (installed with version >=7.6 <8)
I am trying to create an index with a float field like this (as described in the lib docs):
index_name = 'test_index'
body = {'mappings': {'properties': {'float_field': {'type': 'float'}}}}
client.create(index_name, body=body)
then I test if the type is working (I try to index an int to see if it converts to float as set in the mappings during index creation above):
id_ = 123
value = 11
client.index(index_name, body={'float_field': value}, id=id_)
r = client.get(index_name, id=id_)['_source']['float_field']
And the resulting value is integer, not float:
assert r == value # passes
assert isinstance(r, float) # AssertionError
so the mapping of float_field to float type doesn't seem to work, what am I doing wrong here?
the types seem to only be inferred automatically no matter what I set in mappings.
Setting the type to float will only index the value as a float inside the inverted index, but ES will never change whatever values you added inside the source document, so the value you retrieve from the source document you indexed (i.e. from a GET call) will always be the original one.
Bottom line: ES does not do any type conversion to field values inside your source document.

metafor package, rma.uni, mods, Model matrix contains character variables

I'm trying to run a meta-regression with MD's as dependent variable. I want to add a numeric moderator (year published) to the rma.uni function.
Formula so far:
metafor::rma.uni(yi=MCID12, sei=SE12, method="FE", data=Pain, slab=paste(Pain$Author, Pain$Year), weighted=TRUE, subset=(Pain$outcomegruppe=="9"), mods =("Pain$Year") )
I always get the error message:
Error in metafor::rma.uni(yi = MCID12, sei = SE12, method = "FE", data = Pain, :
Model matrix contains character variables.
My "Year" veriable is definetly numeric. As soon as I don't use the "mods" argument, everything works normal.
Could anyone help me with this problem?
Thanks in advance!
Don't put Year in quotes. Also, you don't need the Pain$ parts and weighted=TRUE is the default. This should do it:
metafor::rma.uni(yi=MCID12, sei=SE12, method="FE", data=Pain, slab=paste(Author, Year),
subset=(outcomegruppe=="9"), mods=~Year)

NSLocalizedString should be used directly for exporting XLIFF?

I used to use NSLocalizedString by custom function.
For example, to access Profile.strings, I define this function:
func LocalizedProfile(key: String, comment: String?) {
NSLocalizedString(key, tableName: "Profile", comment: comment ?? "")
}
And, called like this:
let localized = LocalizedProfile("Submit", comment: "For registration")
This method works fine except for exporting XLIFF.
On the Xcode 6.3.2, executting Export for localizationthrows error:
To get error information, I executed via command line:
xcodebuild -exportLocalizations -localizationPath ./xliff -project MyApp.xcodeproj -exportLanguage ja
And, I got this error:
Bad entry in file /Users/mono/Documents/Git/MyApp/Localization.swift (line = 29): Argument is not a literal string.
Defining custom localization method is very useful for me, but I also want to use exporting XLIFF feature.
Are there any methods to resolve this demands?
Export For Localization and xcodebuild -exportLocalizations both generate strings files by looking for invocations of NSLocalizedString(_:tableName:bundle:value:comment:) in code and uses the static values passed into the parameters to create the appropriate strings files.
This means that the only values you can pass into key, comment, value, and tableName are string literals.
Since you're using a wrapper function around NSLocalizedString(_:comment:) to localize your strings, the only time Xcode sees you calling NSLocalizedString(_:comment:) is in that one wrapper function with non-string-literal values, which is invalid.
What you really want to do instead is call NSLocalizedString(_:tableName:comment:) directly.
Alternatively, you can call Bundle.localizedString(forKey:value:table:) in your wrapper function, but then you have to manually create your own strings files for those key-value pairs.
/// - parameter comment: This value is ignored, but should be provided for
/// context at the call site about the requested localized string.
func LocalizedProfile(key: String, comment: String?) -> String {
return Bundle.main.localizedString(forKey: key, value: nil, table: "Profile")
}

Passing Field Symbol value to Return parameter of method

I have the below code which uses a method. When I try to assign the Field Symbol value [Type ANY] to the return parameter RO_TAB [Type Ref to Data], I am getting an error message OBJECTS_MOVE_NOT SUPPORTED [Conversion of type "l" to type "g" not supported.].
The issue is happening after a BW system upgrade along with which we also moved to ABAP objects. The code executes perfectly in the older version of ABAP.
The dump occurs in the below line:
RO_TAB = <lf_storage>.
I have no idea why.
method GET_LU_STORAGE_FOR_ODS.
* IMPORTS
* IF_ODS TYPE RSODSTECH
* IF_ODS_TABLE_TYPE TYPE ZODS_TAB_TYPE
* RETURNS
* RO_TAB TYPE REF TO DATA
FIELD-SYMBOLS:
<lf_storage> TYPE ANY.
DATA:
lf_index TYPE SY-TABIX,
lf_sindex TYPE STRING,
lf_name TYPE STRING.
lf_index = GET_LU_STORAGE_INDEX(
IF_ODS = IF_ODS
IF_ODS_TABLE_TYPE = IF_ODS_TABLE_TYPE ).
lf_sindex = lf_index.
CONCATENATE
'MO_LU_DATA_'
lf_sindex
INTO lf_name.
ASSIGN lf_name TO <lf_storage>.
RO_TAB = <lf_storage>.
endmethod.
You need to create a data object first, using the CREATE DATA statement. Then you can ASSIGN a field symbol to work with the dynamically created data object. There's an example in the online manual. A field symbol is not a reference, it simply places the variable assigned to it in its position. You're effectively trying to move a string (which is what lf_name is) to a reference variable, and that won't work.
You cannot assign a variable of type STRING to a variable of type REF TO DATA.
The following code snippet shows how it should be done.
DATA: lf_name TYPE string.
DATA: lo_tab TYPE REF TO DATA.
FIELD-SYMBOLS: <lf_name> TYPE string.
lf_name = 'test'.
GET REFERENCE OF lf_name INTO lo_tab.
*lf_name = lo_tab. "this is not allowed
ASSIGN lo_tab->* TO <lf_name>.
So in your case it would be sufficient to define a field symbol.
FIELD-SYMBOLS: <lf_name> TYPE STRING.
then assign the contents referenced by RO_TAB to this field symbol.
ASSIGN ro_tab->* TO <lf_name>.
and finally do the concatenation.
CONCATENATE
'MO_LU_DATA_'
lf_index
INTO <lf_name>.
That's all! No further assignments should be required.
How about just this?
lf_sindex = lf_index.
CONCATENATE
'MO_LU_DATA_'
lf_sindex
INTO RO_TAB.

Resources