extracting strings and merging using regex in oracle 12c - oracle12c

I Have a column value like :
{"extarctrule":[{"includescene":"includewhen","columnid":"product","columnoperator":"in","columnvalue":"cat dog"}],"includerule(text)":" {{This Rule applies When}} {{Product}} {{in}} cat dog","surplexrule":[{"surplexruletype":"available","scene":"initially"}],"surplexrule(text)":" {{Make Available}} {{Initially}}"}
i want the output like
This Rule applies When Product in cat dog Make Available initially

Related

Parameter field with multiple values not working

Setup a Parameter field with multiple values to be used in a SQL query command and it does not work when more than one value is selected, but works fine with one value selected. And yes, the "Allow multiple values" flag is set to True under Options.
I am trying to go from this:
EMPBNFIT.BENEFITPLAN in ('CONSUMER CHOICE','HMO', 'HS HMO','HS NETWORK CHOICE','HS PPO BASIC NH RPN','HS PPO PLUS NH RPN','MFS CONSUMER CHOICE','NETWORK CHOICE','PPO BASIC NH RPN','PPO PLUS NH RPN','WAIVE MEDICAL')
to this:
WHERE EMPBNFIT.BENEFITPLAN in ('{?MyPlans}')
What a coincidence; had the same problem this morning. I was able to make a workaround in Crystal by converting the array of multiple parameters into a single string, then replacing the IN section with an INSTR comparison.
Make a formula called ParamFix with this logic:
REPLACE(JOIN({?MyPlans}, ","), "&", "; ")
In my case, the different values were separated by an &, but you can replace that based on what comes back from the tables. Then replace the IN comparison with:
INSTR({#ParamFix}, EMPBNFIT.BENEFITPLAN) > 0

Cypher query equivalent for neo4j-import

I'm trying to create a about 27 millions relationships along with 15 million nodes, initially I was using Cypher, but it was taking a lot of time, so I switched neo4j-import tool utility.
I have confusion whether the result of cypher query is same as that of neo4j-import.
My Cypher query was:
load csv from "file://dataframe6.txt" as line fieldterminator" "
MERGE (A :concept{name:line[0]})
WITH line, A
MERGE (B :concept{name:line[1]})
WITH B,A
MERGE (A)-[:test]->(B);
Content in dataframe6 :
C0000005,C0036775,RB_
C0000039,C0000039,SY_sort_version_of
C0000039,C0000039,SY_entry_version_of
C0000039,C0000039,SY_permuted_term_of
C0000039,C0001555,AQ_
C0000039,C0001688,AQ_
My neo4j-import script:
neo4j-import --into graph.db --nodes:concept "nheader,MRREL-nodes" --relationships "rheader,MRREL-relations" --skip-duplicate-node true
rheader : :START_ID,:END_ID,:TYPE
nheader : :ID,name
MRREL-nodes :
C0000005,C0000005
C0000039,C0000039
C0000052,C0000052
C0036775,C0036775
C0001555,C0001555
MRREL-relations
C0000005,C0036775,RB_
C0000039,C0000039,SY_sort_version_of
C0000039,C0000039,SY_entry_version_of
C0000039,C0000039,SY_permuted_term_of
C0000039,C0001555,AQ_
C0000039,C0001688,AQ_
Somehow I don't see same result
[EDITED]
If you want your relationships to have dynamically assigned types, then you need to change your Cypher code to make use of line[2] to specify the relationship type (e.g., via the APOC procedure apoc.create.relationship). It is currently always using test as the type.
If, instead, you actually wanted all the relationships imported by neo4j-import to have the same test type, then you need to use the right syntax.
Try removing ",:TYPE" from rheader, and use this import command line ( --relationships has been changed to --relationships:test):
neo4j-import --into graph.db --nodes:concept "nheader,MRREL-nodes" --relationships:test "rheader,MRREL-relations" --skip-duplicate-node true

Laravel WhereIn with multiple options in the field itself

Normally a whereIn in Eloquent compares a value from a field to an array with options. I like to reverse that and compare a option to multiple options in the field:
field contains 'option1,option2,option3'
Model::whereIn('field', 'option1')->get();
Is this possible?
You can make your query using LIKE:
Model::where('field', 'LIKE', '%option1%')->get();
Documentation on the syntax is available here: http://dev.mysql.com/doc/refman/5.7/en/pattern-matching.html
If you always add a comma , even after the last choice, like option1,option2,option3, you can use a bit of a more robust filter:
Model::where('field', 'LIKE', '%option1,%')->get();
And a comma at the start (or any other separator if that matters) would make it even better:
Model::where('field', 'LIKE', '%,option1,%')->get();
Otherwise you can have issues if one of your option is similar to another one at the end (if you have fish and goldfish as possible categories, using LIKE ',fish,' will guarantee that you don't match goldfish, while LIKE 'fish,' would match both fish and goldfish).
I'd recommend to store your categories like that: /fish/goldfish/water/ and then filter using LIKE '%/yourcategory/%'

Drools Decision Table using in and not in for same column

I'm working on POC using Drools decision table - Drools 6.5.4. I have a scenario where for one column i want to use both in and not in at same time.
Example :-
listOfApples in ("Apple","Banana")
listOfApples not in ("Apple","Orange")
You should use two columns, one for the condition where the operator "in" is used and the other one for "not in". By entering the list in the right column, the decision is made between these two operators. An entry would be a list of strings, inserted via $param:
someString in ($param) | someString not in ($param)
... |
"Apple", "Banana" |
| "Lemon", "Orange"
Thanks for the answer . Tried this and it is working fine
ContainsString $param
not in ('A')|
in ('A','B')|
in ('C','D')|

Text classification using Weka

I'm a beginner to Weka and I'm trying to use it for text classification. I have seen how to StringToWordVector filter for classification. My question is, is there any way to add more features to the text I'm classifying? For example, if I wanted to add POS tags and named entity tags to the text, how would I use these features in a classifier?
It depends of the format of your dataset and the preprocessing steps you perform. For instance, let us suppose that you have pre-POS-tagged your texts, looking like:
The_det dog_n barks_v ._p
So you can build an specific tokenizer (see weka.core.tokenizers) to generate two tokens per word, one would be "The" and the other one would be "The_det" so you keep the tag information.
If you want only tagged words, then you can just ensure that "_" is not a delimiter in the weka.core.tokenizers.WordTokenizer.
My advice is to have both the words and tagged words, so a simpler way would be to write an script that joins the texts and the tagged texts. From a file containing "The dog barks" and another one cointaining "The_det dog_n barks_v ._p", it would generate a file with "The The_det dog dog_n barks barks_v . ._p". You may even forget about the order unless you are going to make use of n-grams.