How can I delete data from logicblox without warning message - datalog

In the new version of logicblox (any version later than 4.2.1), if there is a predicate "Person(p), hasPNr(p:n) -> int(n)."
And I insert an data "+Person(p),+hasPNr[p]=1."
Then if I want to delete data by "-Person(1)."
There will be an warning message " WARNING : expression '1' has type 'int', but a value of type 'Person' is needed. The compiler has inserted a use of the predicate 'hasPNr' to allow the code to compile."
How can I delete the data without this message?

You can delete by:
-Person(n) <- Person:hasPNr#prev(n, 1).
You should probably modify the way you do inserts as well. The feature in the compiler converting a "1" into a "Person", is called "refmode conversion". That feature is actually being removed because it often causes confusion (as it has already in your case :) ) So to insert without refmode conversion:
+Person(n), +Person:hasPnr(n, 1).

Related

Power Automate: Create_Item Failed

I am trying to create an intake process where where a response from a Microsoft Form creates an item into our SharePoint queue for my team to work. This workflow has some branching so some questions may not always need answers. When the "Date of Change" field is used as intended in the workflow by the user, everything works correctly and appears in our queue. When the user goes down a path where the "Date of Change" field is not needed or a part of the workflow, I receive the below error and the results are never pushed to our queue.
Error Message:
The 'inputs.parameters' of workflow operation 'Create_item' of type 'OpenApiConnection' is not valid. Error details: Input parameter 'item/DateofChange' is required to be of type 'String/date'. The runtime value '""' to be converted doesn't have the expected format 'String/date'.
Workflow Images:
To fix this I have tried making the field "Not required" in hopes that if left blank it would not get read by the flow.
I have also tried, changing the format of the column from Date and time to Single Line of Text and neither of those have worked.
Try an expression instead of the dynamic content field. In this expression check for empty with the empty function. If it is empty use the null value.
Below is an example
Make sure you change the question id to your question id in the expression.
if(empty(outputs('Get_response_details')?['body/rec7e8e58aab84f49a27cacc460a7eeaf']), null, outputs('Get_response_details')?['body/rec7e8e58aab84f49a27cacc460a7eeaf'])

Empty in expression cause an exception in native query

I use Hibernate and JpaRepository to handle my DB operations.
I have this query (to simplify because original query is quite big):
#Query(value="select * from history h where h.project_id in :projects", nativeQuery=true)
List<History> getHistoriesByProjectsIn(#Param("projects")List<Long> projects);
and it is working when I pass valid and not empty List<Long>. However when I pass empty list which may happen and it is not unusual in my scenario I get:
org.postgresql.util.PSQLException: ERROR: syntax error at or near ")"
Can anyone give me a hint on how to get rid of it?
The postgresql documentation states: in predicate can not hold empty list
expression IN (value [, ...])
and as hibernate passes the native queries as is, it's predictable that this leads to a problem.
But as workaround you can follow this suggestion: initialize the list with an impossible value.
EDIT
Actually, this behaviour was changed in hibernate 5.4.10. See the commit:
SHA-1: ab9ae431858dc6727023d7f03bd6925f99011c62
* HHH-8901 replace "in ()" SQL with "in (null)" in QueryParameterBindingsImpl
And for your case the following sql will be generated:
select * from history h where h.project_id in (null)
It looks strange that the task HHH-8901 description completely irrelevant to these changes.

K-means error in foreign function call

I am trying to do the clustering on a set of data using the easy:
fit <- kmeans(my data, 2)
The problem is, when I run it, I get:
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message: In kmeans(my data, 2) : NAs introduced
by coercion
Even though I checked whether I had only numbers in the data set.
Any ideas what might be wrong?
First, can you do str(my data)? Second, don't use a space in the name.
Maybe you have numeric id columns.
Please see link 1 and link 2.

Type mismatch error while reading lotus notes document in vb6

Am trying to read the lotus notes document using VB6.I can able to read the values of the but suddenly type mismatch error is throwed.When i reintialise the vb6 variable it works but stops after certain point.
ex; address field in lotus notes
lsaddress=ImsField(doc.address)
private function ImsField(pValue)
ImsField=pValue(0)
end function
Like this I am reading the remaining fields but at certain point the runtime error "13" type mismatch error throwed.
I have to manually reintialize by
set doc=view.getdocumentbykey(doclist)
The type mismatch error occurs for a certain field. The issue should be a data type incompatibility. Try to figure out which field causes the error.
Use GetItemValue() instead of short notation for accessing fields and don't use ImsField():
lsaddress=doc.GetItemValue("address")(0)
The type mismatch is occurring because you are encountering a case where pValue is not an array. That will occur when you attempt to reference a NotesItem that does not exist. I.e., doc.MissingItem.
You should not use the shorthand notation doc.itemName. It is convenient, but it leads to sloppy coding. You should use getItemValue as everyone else is suggesting, and also you should check to see if the NotesItem exists. I.e.,
if doc.hasItem("myItem") then
lsaddress=doc.getItemValue("myItem")(0)
end if
Notes and Domino are schema-less. There are no data integrity checks other than what you write yourself. You may think that the item always has to be there, but the truth is that there is nothing that will ever guarantee that, so it is always up to you to write your code so that it doesn't assume anything.
BTW: There are other checks that you might want to perform besides just whether or not the field exists. You might want to check the field's type as well, but to do that requires going one more level up the object chain and using getFirstItem instead of getItemValue, which I'm not going to get into here. And the reason, once again, is that Notes and Domino are schema-less. You might think that a given item must always be a text list, but all it takes is someone writing sloppy code in an one-time fix-it agent and you could end up having a document in which that item is numeric!
Checking your fields is actually a good reason (sometimes) to encapsulate your field access in a function, much like the way you have attempted to do. The reason I added "sometimes" above is that your code's behavior for a missing field isn't necessarily always going to be the same, but for cases where you just want to return a default value when the field doesn't exist you can use something like this:
lsaddress ImsField("address","")
private function ImsField(fieldName,defaultValue)
if doc.hasItem(fieldName) then
lsaddress=doc.getItemValue(fieldName)(0)
else
lsaddress=defaultValue
end if
end function
Type mismatch comes,
When you try to set values from one kind of datatype variable to different datatype of another variable.
Eg:-
dim x as String
Dim z as variant
z= Split("Test:XXX",":")
x=z
The above will through the error what you mentioned.
So check the below code...
lsaddress = ImsField(doc.address)
What is the datatype of lsaddress?
What is the return type of ImsField(doc.address)?
If the above function parameter is a string, then you should pass the parameter like (doc.address(0))

Cannot access animate-properties in Clutter

I am trying to animate an actor in Clutter, but when I enter a property that exists, something goes wrong.
actor.animate( AnimationMode.LINEAR, 400, scale_x:2);
gives me this error
Clutter-WARNING **: Cannot bind property '\x83\xec\u0014\x89\xc6e\xa1\u000c': objects of type 'ClutterTexture' do not have this property
Looks like Unicode-characters to me.
However, when I enter a property that does NOT exist
actor.animate( AnimationMode.LINEAR, 400, thisdoesntwork:2);
I get an error that makes much more sense
Clutter-WARNING **: Cannot bind property 'thisdoesntwork': objects of type 'ClutterTexture' do not have this property
I get the exact same problem when I try this alternative approach:
actor.animate( AnimationMode.LINEAR, 400, "scale-x", 2);
How come all properties that actually exist get converted to some mess, and what can I do to get this to work?
You should be using 2.0 for the value, not 2. 2 is an integer, 2.0 is a double. Vala can't provide type safety for variadic methods, so you have to be careful.
As for why you're seeing the behavior you are for properties which exist, my guess is it has to do with the fact that 2 is a (32-bit) integer and 2.0 is a (64-bit) double. This is simplifying things a bit, and I don't know how much experience you have with C (probably not a lot, since this is the sort of mistake someone coming from a dynamically typed language would make), however... Clutter (well, va_arg) expects a double so it parses 64 bits of data, but you only provided 32 bits, so the first 32-bits of the next argument (NULL) are included. Now, when it starts trying to parse the next argument it starts from the wrong location (32-bits into the argument), so you get the the remainder of NULL and part of whatever garbage happened to be on the stack... Unsuprisingly, that doesn't just so happen to be 32-bits of 0s so when Clutter tests to see if the value it just read == NULL it isn't and Clutter thinks it's been given a pointer to an null-terminated array of characters (which is how strings are represented in C). It reads the data at that location, which just so happens to be \x83\xec\u0014\x89\xc6e\xa1\u000c, and checks to see if there is a property with that name. There isn't, so it emits the error message you saw.
Now, if you switch to using a property which doesn't exist, Clutter will parse the argument (the name of the property), notice that it doesn't exist (just like it did with the second property above), and emit an error.

Resources