Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-07-2022 06:47 AM
My queries for "Tag" : one for inserting tag and some queries to retrieve them knowing that every tag has one type of alarm so i expected two possibilities :
every alarm node type with its own properties but the problem will be that i don't have Unique id for every alarm because every node is just about some readings
Solved! Go to Solution.
09-07-2022 08:15 PM
If a tag represents some sensor or hardware, then you should be able to assign some unique ID to it, such as asset number, serial number, etc. Can you use a data model as illustrated in the screenshot? Each tag (piece of hardware) emits sensor readings or alarms if a threshold is reached. Either way, you can capture these events in an 'Alarm' or "Measurement" node, which is linked to the sensor/hardware that generated the data/alarm. Each node has two labels, one representing its generic type, such as Tag or Alarm, and one representing the type, such as Digital or Analog.
09-07-2022 08:36 AM
are there any other possibilities ?
if no , please tell me which approach is better
if yes , please tell me what are the other possibilities ?
@elaine_rosenber Thank u so much for your cooperation
09-07-2022 09:28 AM
I am confused with your use case. Do you have a bunch of sensors reporting measurements you are trying to track? What does a 'tag' represent, as specific sensor? Is an 'alarm' a measurement, or is an alarm raised under some condition? What kind of information do you want to retrieve from the graph?
09-07-2022 11:55 AM
Tag is something like sensor, To be accurate tag represents a specific hardware, every tag has alarm readings depending on tag type
Is it clear now ?
09-07-2022 12:00 PM
Alarm readings change uder different conditions, like High pressure alarm (it's a property with specific value)
I want to retrieve every tag alarm reading depending on tag type
09-07-2022 08:15 PM
If a tag represents some sensor or hardware, then you should be able to assign some unique ID to it, such as asset number, serial number, etc. Can you use a data model as illustrated in the screenshot? Each tag (piece of hardware) emits sensor readings or alarms if a threshold is reached. Either way, you can capture these events in an 'Alarm' or "Measurement" node, which is linked to the sensor/hardware that generated the data/alarm. Each node has two labels, one representing its generic type, such as Tag or Alarm, and one representing the type, such as Digital or Analog.
09-08-2022 04:13 AM
Thank you for your great effort
09-07-2022 02:24 PM
Try this:
MERGE (a:DigitalTag {state0: line.State0, state1: line.State1})
MERGE (b:AnalogTag {alarmLLValue: line.`Alarm LL Value`, alarmLValue: line.`Alarm L Value`, alarmLLValue: line.`Alarm LL Value`, alarmHValue: line.`Alarm H Value`, alarmHHValue: line.`Alarm HH Value`})
09-08-2022 04:20 AM
Thank u so much
09-07-2022 11:11 PM - edited 09-07-2022 11:11 PM
Try this:
LOAD CSV WITH HEADERS FROM 'file:///xxx.csv' AS line
WITH line, line.`I/O Type` as iType
CALL
{
WITH line, iType
WITH line, iType
WHERE iType contains("Digital")
MERGE (a:DigitalTag {state0: line.State0, state1: line.State1})
//Add your relationship cypher below....
MERGE (b)-[:HAS_DIGITAL_ALARM]->(a)
}
CALL
{
WITH line, iType
WITH line, iType
WHERE iType contains("Analog")
MERGE (b:AnalogTag {alarmLLValue: line.`Alarm LL Value`, alarmLValue: line.`Alarm L Value`, alarmLLValue: line.`Alarm LL Value`, alarmHValue: line.`Alarm H Value`, alarmHHValue: line.`Alarm HH Value`})
//Add your relationship cypher below....
MERGE (b)-[:HAS_ANALOG_ALARM]->(a)
}
09-08-2022 04:20 AM
Thank u very much
All the sessions of the conference are now available online