#819 Custom Tag Compliance

Heem Othman Wed 27 May 2020

Hi,

I'm wondering what the implications are of creating custom tags. So if I created and added hs:bread to a point for instance, is there anything else I need to do to make sure it complies with Haystack rules? Or does making it a part of the hs:xxxx dictionary make it automatically comply? Would there be any issues later on down the road if Haystack decided to add hs:bread to their dictionary?

Thanks.

Brian Frank Wed 27 May 2020

Just a note the "hs:" part of the tag is part of the Niagara implementation. In Haystack tags do not use prefixes like that. They are organized into modules, but in everyday use they are just simple names. Its more like a programming language where you "import" the tag names as symbols into a namespace.

So you should avoid generic terms for future proofing, usually by giving your own tags a unique prefix.

This is discussed in Haystack 4 docs here

Josiah Johnston Thu 28 May 2020

Hi Heem,

Here is some related discussion from a few months ago about some of the nitty-gritty of defining modules: https://project-haystack.org/forum/topic/788

At the time, I couldn't find as many details as I needed in the Haystack 4 docs.

Best, Josiah

Heem Othman Wed 3 Jun 2020

Thanks guys! I'll give both of those links a read.

Heem Othman Tue 9 Jun 2020

Alright so after a lot of reading I think I understand a little bit more, but still not enough to get everything going.

If any of this is wrong, correct me so that I can understand better:

Within Niagara, I was originally thinking I can just create a tag with the dictionary of hs: and everything will be fine, but after reading information in the links you guys sent, I realize that that's not the case and those tags wouldn't be a part of Haystack; I would need to create my own Haystack namespace and that would make it a part of Haystack/Haystack compliant.

In order to create my own Haystack namespace, I need to make a folder, let's call it customNamespace, and then inside of it I need to have a folder called lib and inside of that needs to be a lib.trio file which will look something like this:

------------------------------------------------------
def: ^lib:customNamespace
doc: "This is a custom dictionary"
version: "1.0"
baseUri: ``
------------------------------------------------------

Any other .trio files within lib will just be definitions of tags:

------------------------------------------------------
def: ^newTag
is: ^marker
doc: "This is a custom tag"
------------------------------------------------------

Assuming all of that is correct, how would I go about creating my custom namespace to include all of Haystack's libs so I essentially just have my new tags on top of all of Haystack's? I know that I can use

includes: [^lib:ph, ^lib:phIct, ^lib:phIoT, ^lib:phScience]

in my lib.trio file but do I have to have those folders (ph, phIct, phIoT, phScience) as siblings next to my customNamespace folder?

Once the custom namespace folder is created and I have my new tags, how can I import it into Niagara to have Niagara read my new tags?

Brian Frank Tue 9 Jun 2020

Yes you are exactly correct in how to create a new library. Although in last go around we changed includes tag to be depends.

However, Niagara doesn't actually understand Haystack 4 or libs yet AFAIK. You would have to ask Tridium what their plans are to support Haystack 4 (maybe one of them can comment on this post)

Login or Signup to reply.