I am trying to store a graph created from Spark-dataframes with the project Cypher-for-Apache-Spark into neo4j.
When i run my code: which you can find it in the last comment in an issue in github
i get this error :
Exception in thread "main" org.neo4j.driver.v1.exceptions.DatabaseException: Unable to create CONSTRAINT ON ( ___neo4jgraphs874:___neo4jgraphs874 ) ASSERT ___neo4jgraphs874.___morpheusID IS UNIQUE:
Both Node(57) and Node(74) have the label `___neo4jgraphs874` and property `___morpheusID` = 4
any one knows why that happen ?
Solved here
I 've figured out what is the problem:
this error is fired because the dataframes have the same id numbers :
df1||df2||df3
0L||0L ||0L
1L||1L ||1L
2L||2L ||2L
to be fixed each dataframe need to have it's id differents from the other :
df1||df2||df3
0L||3L ||6L
1L||4L ||7L
2L||5L ||8L
Related
We're using nodejs mcprotocol library to pole periodic data from Mitsubishi Electric PLC-FX5U-64M after every 1 minute and saving it to mongodb collection.
We've added 1 tag named as Tag_1 with configuration as
{
'tagname' : 'Tag_1',
'type' : 'number',
'address' : 'D10',
'tagsize' : 2
}
But when we read the tag value we're getting error of something went wrong writing values with status code and actual data as BAD 255.MC protocol BAD 255
Please refer to attached image for the same.
Thank you.
We've so far tried by changing the address series to test for another Tag of D sereis, but still the BAD 255 code continues.
I am new to redis and created an index and am attempting to ingest Zeek Logging Data, create an index for multiple fields, and then search fields in that index. For the life of me, I cannot get any values to return when searching for the #orig_ip name or using JSON.GET to retried any id.* related fields.
UPDATE: I figured this out after more troubleshooting and am updating here to help anyone else struggling with this problem.
Here is my WRONG code for creating the index:
# Options for index creation
index_def = IndexDefinition(
index_type=IndexType.JSON,
prefix = ['uid:'],
score = 0.5,
score_field = 'doc_score'
)
# Schema definition
schema = (
TagField('$.orig_l2_addr', as_name='orig_mac'),
TagField('$.id.orig_h', as_name='orig_ip'), #Wrong field path
TagField('$.id.resp_h', as_name='resp_ip'), #Wrong field path
NumericField('$.orig_bytes', as_name='orig_bytes'),
NumericField('$.resp_bytes', as_name='resp_bytes'),
NumericField('$.ts', as_name='timestamp')
)
r.ft('py_conn_idx').create_index(schema, definition = index_def)
Here is the result I kept getting with the above WRONG schema (no results)
search_result4 = r.ft('py_conn_idx').search(Query('#orig_ip:{192\.168\.210\.27}'))
Results for "#orig_ip:{192\.168\.210\.27}":
0
UPDATE: Working schema definition:
So it turns out even though Zeek is only using the . in field names vice using it to create an object, but the . in the field names was the culprit in my query failures. I needed to access the fields for the index as follows:
# Schema definition
schema = (
TagField('$.orig_l2_addr', as_name='orig_mac'),
TagField('$.["id.orig_h"]', as_name='orig_ip'), #Fixed field reference
TagField('$.["id.resp_h"]', as_name='resp_ip'), #Fixed field reference
NumericField('$.orig_bytes', as_name='orig_bytes'),
NumericField('$.resp_bytes', as_name='resp_bytes'),
NumericField('$.ts', as_name='timestamp')
)
After recreating the index with this schema, I get results with my query:
Results for "#orig_ip:{192\.168\.210\.27}":
Document {'id': 'uid:CPvYfTI4Zb1Afp2l5',....
Thanks to this stackoverflow question for finally walking me to the cause of my troubles: How to get objects value if its name contains dots?
Putting this answer here so this question gets marked as having one. See the updated question/code above!
I am currently learning RStudio (beginner level) and I have a question regarding stargazer function and especially how to create the table of descriptive statistics. I did start by updloading my dataset (called d) and all relevant libraries like stargazer. I did run command line:
stargazer(d, type = 'text', title = "Statistiques descriptives",digits = 1, out="table1.txt")
There is an error message:
*Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { :
missing value where TRUE / FALSE is required*
How can I complete the table with relevant information (mean, standard deviation...) ?
Thank you
Try to describe your data more in detail. Provide a minimal working example, if possible. The command is fine in principle:
library(stargazer)
stargazer(mtcars, type = 'text', title = "Statistiques descriptives",digits = 1, out="table1.txt")
Same issue was related to underscore in variable names:
How to fix 'Error in if (nchar(text.matrix[r, c]) > max.length[real.c]) { : missing value where TRUE/FALSE needed' using stargazer in rstudio?
Please provide str of your dataframe.
I meet a problem with count request of neo4j with nodejs.
Here my problem :
When I insert a data, it will present like this:
start a = node(0)
create unique a-[:HAS_ID]->(b{id:'xx'})
create unique b-[:HAS_INFO]->(c{info:'xx'})
return a,b,c;
because it's unique node, so that it will not insert a new node if there are a same node exist. But, I wanna count how many request to call this query.
Ex :
request: -domain/id01/info
--return a node[0], b node[1] and c node[2]
add another data:
request: -domain/id02/info
-- return : a node[0], b node[3], c node[4]
call it again :
request: -domain/id01/info
--return a node[0], b node[1] and c node[2] //but here is any attribute or properties count to 2.
I've read any solution about strength. It told me create an properties of relationship as example :
[:HAS_INFO{strength:num}]
and let it increase but I still don't get it.
Anyone please give me solution and tell me how to do it.
Thank you.
more info : Representing (and incrementing) relationship strength in Neo4j
You can use the CASE statement, see http://gist.neo4j.org/?6052414 for an example. Feel free to for the underlying gist and improve it!
MATCH path=(a)-[rel:HAS_INFO]->(b)
WHERE a.name?='A' AND b.name?='Info'
SET rel.weight = (
CASE
WHEN not(has(rel.weight))
THEN 0
ELSE rel.weight + 1
END)
RETURN path, rel.weight;
In a Firebird database, I need to create a DOMAIN with default value taken from the context variable.
It should be something like
CREATE DOMAIN USER_ID AS INTEGER
DEFAULT RDB$GET_CONTEXT('USER_SESSION','UID') NOT NULL;
When I execute this, I am getting the following error
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 2, column 13.
RDB$GET_CONTEXT.
How can this be done, maybe there is another way than the DEFAULT clause?
Just create a BEFORE INSERT trigger:
CREATE TRIGGER your_trigger_name FOR your_table
BEFORE INSERT
POSITION 0
AS
BEGIN
IF (NEW.your_field IS NULL) THEN
NEW.your_field = RDB$GET_CONTEXT('USER_SESSION','UID');
END