#869 Haystack 4 relationships vs references

David Waterworth Wed 11 Nov 2020


I'm trying to understand the difference between relationship and a reference in Haystack 4.0

For example https://project-haystack.dev/example/alpha/a-024d there's an airRef from the VAV back to the parent AHU, the VAV is itself a member of children collection of the AHU.

Are ref tags themselves relationships - i.e. https://project-haystack.dev/doc/index-relationship - the documentation for airRef (https://project-haystack.dev/doc/lib-phIoT/airRef) doesn't indicate this but perhaps this is a limitation of the tool which generates the html doc from the ontology definition?

Regards David

Brian Frank Wed 11 Nov 2020

Probably the best way to explain is to look at two examples:

// this is definition for a subtype of relationship
def: ^inputs
is: ^relationship
reciprocalOf: ^outputs
doc: "The entity inputs a substance from the referent.
  The value of this tag is what is received."

// this is definition for a subtype of ref
def: ^airRef
is: ^ref
of: ^air-output
tagOn: ^air-input
inputs: ^air
doc: "Air flows from the referent to this entity"

The relationship defines the semantics of an entity-to-entity relationship: what does the relationship mean in prose, is it transitive, does it have a reciprocal. These aspects are useful for inference engines, mapping to RDF OWL, etc.

The ref is a definition for a tag you stick on entities to model a relationship in your actual instance models. In this case when you use the airRef tag you are defining a relationship that "air is input from the referent".

The ref tag uses a relationship tag in its def - its a meta-model concept. We designed it this way for a couple of reasons:

  1. A given ref tag could implement multiple relationships
  2. Most relationships in our domain are substance/energy flows and we wanted to capture the concept of "what" flows with one tag versus some complicated design using indirection

Login or Signup to reply.