Goal: Query assets using Niagara's tag/relation model (N4.4+) Interface: Workbench
CTRL+LRequires:tagDictionarymodule + N4.4 minimum
station:|slot:[scope]|neql:[dictionary]:[tagName]|bql:select [columns]
NEQL acts as a pre-filter — it selects entities by tag before BQL runs.
station:|slot:|neql:n:point|bql:select displayName, slotPath, ord
station:|slot:|neql:n:equip|bql:select displayName, slotPath
station:|slot:|neql:n:history|bql:select displayName, slotPath
station:|slot:|neql:n:ordInSession|bql:select displayName, ordInSession, ord
station:|slot:/Drivers|bql:select name, vykonPro:Lib.tagValue('n:vendor') as 'Vendor' from baja:Component where vykonPro:Lib.hasTag('n:vendor') = 'true'
station:|slot:/Drivers/BacnetNetwork|neql:n:point|bql:select displayName, slotPath, ord
station:|slot:|neql:hs:site|bql:select displayName, slotPath
station:|slot:|neql:hs:site|bql:select count(out)|cell:0,0
station:|slot:|neql:hs:equip|bql:select displayName, slotPath
station:|slot:|neql:hs:point|bql:select displayName, slotPath
station:|slot:|neql:hs:chiller|bql:select displayName, slotPath
station:|slot:|neql:hs:ahu|bql:select displayName, slotPath
station:|slot:|neql:hs:vav|bql:select displayName, slotPath
station:|slot:|neql:hs:equip|bql:select displayName, slotPath, count(name) as 'Points'
Use the Tags editor in Workbench to add tag my:deviceForQuery (marker) to each device you want to cross-query, then:
station:|slot:|neql:my:deviceForQuery|bql:select displayName, slotPath, status
station:|slot:|neql:my:building|bql:select displayName, slotPath
station:|slot:/Drivers|neql:n:point|bql:select displayName, out, status
station:|slot:|neql:hs:site|bql:select displayName, count(name) as 'Points'
station:|slot:|neql:hs:equip|bql:select count(out)|cell:0,0
Relations must be traversed in Java code, not via BQL/NEQL in Workbench.
// Find the chilled water plant related to a chiller
Id plantRef = Id.newId("hs", "chilledWaterPlantRef");
chiller.relations().get(plantRef, Relations.OUT).ifPresent(relation -> {
Entity plant = relation.getEndpoint();
System.out.println(plant.getOrdToEntity());
});
// Get all BACnet devices tagged hs:chiller
Id chillerId = Id.newId("hs:chiller");
bacnetNetwork.relations().getAll(Id.newId("n:childDevice"))
.stream()
.map(Relation::getEndpoint)
.filter(entity -> entity.tags().get(chillerId).isPresent())
.forEach(entity -> System.out.println(entity.getOrdToEntity()));| Prefix | Dictionary | Common Tags |
|---|---|---|
n: |
Niagara built-in | point, equip, history, vendor, ordInSession, childDevice |
hs: |
Project Haystack | site, equip, point, chiller, ahu, vav, boiler, fan, sensor, cmd, sp |
b: |
Custom Baja | User-defined (e.g., b:floor, b:zone, b:buildingId) |
my: |
Site-specific | Anything your team defines in TagDictionaryService |
// Add a direct tag
Tag floorTag = Tag.newTag("b:floor", BInteger.make(1));
entity.tags().set(floorTag);
// Add via Component model
myComponent.add(SlotPath.escape("b:floor"), BInteger.make(1), Flags.METADATA);
// Check if tag exists
boolean hasTag = entity.tags().get(Id.newId("n:point")).isPresent();
// Add a relation
Relation r = entity.relations().add(Id.newId("hs:ahuRef"), otherEntity);