Look at the Design Pattern postings. This particular DP is called Design Pattern: Associated Items.
DPs are not really documenting the language but showing ways to use the language to solve common problems.
There is no way I know of built in to OH. However there are a couple of approaches you can use.
-
Make sure every Item is a member of a global Group. Then
if(gAll.members.findFirst[ i | i.name = "ItemName"] !== null) // Item exists
. -
Use the REST API. `if(sendHttpGetRequest(“http://localhost:8080/rest/items/ItemName/state").contains("Item Foo does not exist!”)) // Item does not exist
There has been talk on the forum of wanting a default global Group that all Items belong to but I guess no one felt strongly enough about it to actually implement a PR to add it.