How delete Semantic Model

Hi
I created a semantic model with locations, equipments and points. But looks it was too much for it. It is now “Loading…” for ever. How may I delete all Semantic Model data, so I may try something else?

Go to each of your Items that have a semantic tag and remove the tags. Or just delete all your Items. The model isn’t something separate, it is entirely tags on Items and Group membership. Nothing more, nothing less.

It is unlikely that the problem you are seeing is related to the model itself though. I recommend filing an issue on the openhab-webui repo and be sure to gather all the information requested in the template.

Hi Rich
thanks. As I defined the Semantics through the UI, the item file was not changed. But restoring the “org.openhab.core.items.Item.json” from backup directory did help.
Toni

You cannot create a model in the UI with Items defined in .items files. The UI cannot add the necessary semantic tags to the Items in the .items file.

So if I understand correct: if items are defined by items file also semantic tags must be defined in the items file and not by UI.

Correct.

And to take it a step further - recommendation is to either define Semantic Model Items in files only, or UI only, but not a mixture.

and is it also correct, that only “names” of this list
openhab-core/SemanticTags.csv at main · openhab/openhab-core · GitHub
may be used, include the given parent/child definitions?
If so, why does the UI not restrict to this names?

This is where being precise in the language is important.

An Item can have any name as long as it’s unique.

An Item can have any label; it doesn’t even have to be unique.

If you want to make a Group Item represent a Location in the semantic model, you tag it with one from that list that has “Location” in the first column. When creating a new Location from the Model screen, it does limited you to choosing only from those tags in the UI.

If you want to make a Group Item or regular Item represent an Equipment in the semantic model, you tag it with one from that list that has Equipment in the first column. When creating a new Equipment from the Model Screen or from a Thing’s screen, it does limit you to choosing only from those tags in the UI.

If you want to make an Item represent a Point in the semantic model, you tag it with one from that list that has Point in the first column. When creating a Point from the Model screen it does limit you to choosing only from those tags in the UI.

Optionally, all Point Items can also have an additional Properties tag added. This optional tag can be any from the list with “Property” in the first column. In the UI, when you have a Point Item, the field to select the Property tag does only list those Property tags.

However, when you create an Item or have a preexisting Item in other ways, there is no way for the UI to know what type of concept the Item needs to represent. So it offers all of the tag types to you.

In .items files you have to be careful not to mix and match tags as well. A Properties can only be paired with a Point tag, never a Location nor an Equipment tag and it cannot stand alone. Also, any semantically tagged Item can only be a direct member of one Equipment or Location tagged Group. You cannot have a Point or Equipment in two locations at the same time. You can’t have a Point or Equipment be a part of two or more Equipment at the same time. Put another way, any Item can only appear once in the semantic hierarchy.

It’s a lot harder to make those mistakes when building the model through the UI because it mostly prevents you from doing it. That is one reason why I tend to promote using the UI over text configs.

2 Likes

Hi Rich, many thanks for your clarifications.
There’s only one thing left: The structure of the semantic model is ONLY given by the structure of the groups in the item file. Means, the “parent” in the list has no effect to the structure.
I appreciate your help very much.

I don’t know what you mean. If you are not using the ui then yes of course the model is only going to be in your .items files.

Only Items that are properly semantically tagged are a part of the model. If it’s not tagged it won’t be a part of the hierarchy.

If you are using .items files, you can’t edit those items in the UI. This includes editing the model.

I mean editing in the .items files: In

most “Locations” have a parent. What is it for? To construct a hierarchy in the model beside my group hierarchy?

It’s to define the “is a” relationships. A kitchen is a room which is a location. It adds meaning to the model to help distinguish between a building and a kitchen, for example. Remember, the whole purpose of the tags and model is to provide more meaning so the computer can understand and reason better.