I wanted a JAPE which on execute will return Annotation list which only sounds meaning to my requirement. Like I do not want SpaceToken, Sentence, Token, Lookup etc. implicit in my Annotation. As this Jape will be in last of Application sequence and it does not require any thing to match in LHS( as far my understanding, CMIIW ), is there any way we can have only RHS code)
Phase: filteAnnot
Input: token
Options: control = appelt
Rule: filteAnnot
Priority: 50
-->
:label{
[My Logical Stuff of removing annotations]
}
First of all, you probably don't need to delete the annotations. Usually when you're embedding GATE you'll call a pipeline and then delete the document anyways.
If you need to clear the default Annotation Set you can run an "Annotation Set Transfer PR" to move your valuable annotations to a different AS and then "Document Reset PR" to clear the default AS. Or if you don't have that many annotation types, just use "Document Reset PR" and add the types to its "annotationTypes" parameter.
You can also write a groovy script PR to remove annotations:
inputAS.findAll{
it.type != "MyAnnotation"
}.each{ ann ->
outputAS.remove(ann); // probably removeAll would be simpler
}
Related
I'm new in Informatica PowerCenter, trying to use a new declared parameter expression in Workflow Session parameter file.
Objective: the expression is being feed automatically from data base, so the reason behind all this is to be able to change the logic in db, parameter file will re-generate in the next run with the new logic which ultimately will cause not to change nothing in power Center, only record expression in db. Off course for new fields you will need to change informatica.
Let me summarize or try to be deatailed as posible.
Parameter file has no issues, when executing the workflow it's being read with out issues, here's an example of the parameter expression I'm trying to use (rest of them, dbCon, time etc i delete them)
[Example.WF:Example.WT:.ST:Example]
$$Param_checker=IIF(1=1,'A','B')
Mapping
Created the parameter in the mapping as:
Name: $$Param_checker
Type: Parameter
Data Type: String (as per doc)
Precision: 10000 <-- making sure there's no cut
IsExprVar: true
Created a field in a Transformation Expression Box (the violet one) as:
Name: out_param_checker
Data Type: String
Precision: 10
O: X
Expresion: $$Param_checker
Workflow
In it session reads correctly the parameter file of the Mapping replaces all variables but when it comes to $$Param_checker it's not being expanded, this is a sample of log outcome when inserting on data base (cast and allfunctions are done by Inf. aut.:
CASE WHEN CAST('$$Param_checker' AS VARCHAR(4000))
And off course in Data base when process finishes I see the string as well '$$Param_checker'
Just in case, and sorry for being verbose, I do already have a parameter with a expression working but in a source Qualifier using it on a SQL statement.
The issue is why can't I use it in a out field. Forgot to mention that we have redshift under the hood, all sessions are set to "Full" Optimization, hence I think that's the issue.
If anyone have any hint would appreciate it.
Thanks
Good morning,
I have a unique requirement where I have to apply a filter on "Get entities" from Azure table based on a condition, filters come from HTTP get request.
There are two filters - a and b.
If both filters passed to the flow are empty, no filter is applied.
If either one of the filters is not empty, the filter must be applied on that column.
If both filters are not empty, the filters must be applied on both columns.
Is it possible to apply an If statement in an ODATA filter query?
I can't seem to find a good answer.
For this requirement, we can just use "Condition" in logic app to implement it. It's not a smart solution, but it works.
First I use two variables to simulate your two filters from http request.
Then use another variable to store the result filter(s).
Now add a "Condition" to judge if filter1 is not equal to "empty".
If true, add another condition "Condition 2" to judge if filter2 is not equal to "empty" and set the value for filterResult.
If false, also add another condition "Condition 3" to judge if filter2 is not equal to "empty" and set the value for filterResult. Note: use expression string(' ') in "Set variable 4", or it will not allow us to save the logic app.
After that, we can use filterResult in "Get entities". The expression in below screenshot is trim(variables('filterResult')).
Let say I have an app where I want to give someone the weather in a city.
The first scene has a prompt: "What city would you like the weather of?"
I then have to collect a slot/parameter called conv.param.city: and then use it in my node webhook which is:
const { conversation } = require('#assistant/conversation');
const functions = require('firebase-functions');
const app = conversation();
app.handle('schedule', (conv, {location}) => {
let temperature = callApi(location);// this part doesn't matter right now
**conv.add(`You want to know the weather in ${location}`);
conv.close(`The weather in ${location} is ${temperature}`);
});
exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);
From what I can tell, you can only take in parameters/slots that are predefined by types/intents. I cannot make a list of all cities that exist to train with. How can I basically say: Whatever the user says at this point, make that word into this variable.
How can i do this with the Google Actions SDK?
You can accomplish this by setting your intent parameter type to be free text (here's an example from one of the sample repos).
freeText: {}
If you apply this type to an intent parameter, you can use the training phrases to provide the necessary context on where in the phrase that "word" should be matched (example from the same repo).
I cannot make a list of all cities that exist to train with.
Another option exists if your API can return the set of locations supported. You can also use runtime type overrides to dynamically generate the type from the list of list of locations the API provides. This will be more accurate, but is dependent on what your data source looks like.
I want to remove all attributes from a given flow file except the ones I explicitly define to keep.
Given the following sample flow file attributes:
name: aaa
Place: bbb
Host: ccc
JsonAttribute: {
"A": "a",
"B": "b"
}
data: ddd
And I want to keep Host and JsonAttribute only.
Thus, the resulting flow file attributes should be:
Host: ccc
JsonAttribute: {
"A": "a",
"B": "b"
}
How can I achieve this using the standard processors NiFi provides?
renaming the attributes
Is it possible to rename the attributes using the same procedure? E.g. I would like to keep the attributes like above but rename JsonAttribute into customName
The UpdateAttribute processor does not only allow to add / set flow file attributes but also enables you to delete existing attributes from a flow file.
To do so you have to pass a regular expression matching all attributes you want to remove to the property Delete Attributes Expression.
In your case you can use a negative look-around to match every attribute other than the ones you want to keep.
^((?!Host)(?!JsonAttribute).)*$
So no additional processor is needed.
keeping Host attribute, moving JsonAttribute to a different attribute name
You should be able to also achieve the second behaviour using only a single UpdateAttribute processor.
Simply add a property, e.g. customName, to the processor and reference the old attribute using the NiFi Expression Language:
${JsonAttribute}
In that case you may also simplify your deletion regex to also delete the JsonAttribute flow file attribute:
^((?!Host).)*$
AttributesToJSON Processor can filter data you don't need.You can set Attributes Regular Expression in this Processor.
In the invokehttp processor there is an Attributes to Send property where you could define attributes to be used in request.
So you don't need to filter out attributes in another processor.
I am currently using SDN 4 and trys to do the following query:
#Query("MATCH (n:TNode:{0}) RETURN n")
Collection<TNode> getNodes(String type);
where each node has a common label "TNode" and an individual label type. However, it always returns syntax error. I'm sure the query is correct because it returns nodes using Neo4j web client.
Does the error occurs because SDN can not find nodes by label?
This is a limitation of Cypher, not SDN. Labels (or relationship types) as parameters are not supported. See this and related feature requests.
You can work around this using where clause and labels(n) function:
MATCH (n:TNode)
WHERE {0} in labels(n)
RETURN n
This comes with a caveat - it will go through all nodes matched by the MATCH clause. In your situation having a :TNode label might solve the issue, but generally having simple MATCH (n) would go through all nodes in the database, which will be very slow.
Other option would be to build the query manually and use org.springframework.data.neo4j.template.Neo4jOperations#queryForObjects to run the query:
String query = "MATCH (n:TNode:" + type + ") RETURN n"; // ugly, but works, beware of query injections etc..
Collection<TNode> nodes = neo4jOperations.queryForObjects(TNode.class, query, params);